feat(frontends/lean/dependencies): do not stop computing dependencies at error, compute as many as possible, and sign error in the end
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
3f50fd3ddd
commit
bd3fb3489b
1 changed files with 18 additions and 10 deletions
|
@ -20,6 +20,7 @@ void display_deps(environment const & env, std::ostream & out, char const * fnam
|
||||||
throw exception(sstream() << "failed to open file '" << fname << "'");
|
throw exception(sstream() << "failed to open file '" << fname << "'");
|
||||||
scanner s(in, fname);
|
scanner s(in, fname);
|
||||||
optional<unsigned> k;
|
optional<unsigned> k;
|
||||||
|
std::unique_ptr<exception> ex;
|
||||||
std::string base = dirname(fname);
|
std::string base = dirname(fname);
|
||||||
bool import_prefix = false;
|
bool import_prefix = false;
|
||||||
bool import_args = false;
|
bool import_args = false;
|
||||||
|
@ -31,6 +32,8 @@ void display_deps(environment const & env, std::ostream & out, char const * fnam
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (t == scanner::token_kind::Eof) {
|
if (t == scanner::token_kind::Eof) {
|
||||||
|
if (ex)
|
||||||
|
ex->rethrow();
|
||||||
return;
|
return;
|
||||||
} else if (t == scanner::token_kind::CommandKeyword && s.get_token_info().value() == import) {
|
} else if (t == scanner::token_kind::CommandKeyword && s.get_token_info().value() == import) {
|
||||||
k = optional<unsigned>();
|
k = optional<unsigned>();
|
||||||
|
@ -42,6 +45,7 @@ void display_deps(environment const & env, std::ostream & out, char const * fnam
|
||||||
k = *k + 1;
|
k = *k + 1;
|
||||||
} else if ((import_prefix || import_args) && t == scanner::token_kind::Identifier) {
|
} else if ((import_prefix || import_args) && t == scanner::token_kind::Identifier) {
|
||||||
import_args = true;
|
import_args = true;
|
||||||
|
try {
|
||||||
std::string m_name = find_file(base, k, name_to_file(s.get_name_val()), {".lean", ".olean", ".lua"});
|
std::string m_name = find_file(base, k, name_to_file(s.get_name_val()), {".lean", ".olean", ".lua"});
|
||||||
int last_idx = m_name.find_last_of(".");
|
int last_idx = m_name.find_last_of(".");
|
||||||
std::string rawname = m_name.substr(0, last_idx);
|
std::string rawname = m_name.substr(0, last_idx);
|
||||||
|
@ -52,6 +56,10 @@ void display_deps(environment const & env, std::ostream & out, char const * fnam
|
||||||
k = optional<unsigned>();
|
k = optional<unsigned>();
|
||||||
import_prefix = true;
|
import_prefix = true;
|
||||||
out << "\n";
|
out << "\n";
|
||||||
|
} catch (exception & new_ex) {
|
||||||
|
if (!ex)
|
||||||
|
ex.reset(new_ex.clone());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
import_args = false;
|
import_args = false;
|
||||||
import_prefix = false;
|
import_prefix = false;
|
||||||
|
|
Loading…
Reference in a new issue