mirror of https://github.com/exaloop/codon.git
Fix import scoping
parent
ea390f7de9
commit
3e988f904d
|
@ -93,7 +93,8 @@ void SimplifyVisitor::visit(ImportStmt *stmt) {
|
|||
LOG("-> fix {} :: {}", import.moduleName, i.first);
|
||||
c = import.ctx->findDominatingBinding(i.first);
|
||||
}
|
||||
ctx->add(i.first, c);
|
||||
// Imports should ignore noShadow property
|
||||
ctx->Context<SimplifyItem>::add(i.first, c);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -106,7 +107,8 @@ void SimplifyVisitor::visit(ImportStmt *stmt) {
|
|||
E(Error::IMPORT_NO_NAME, i, i->value, file->module);
|
||||
if (c->isConditional())
|
||||
c = import.ctx->findDominatingBinding(i->value);
|
||||
ctx->add(stmt->as.empty() ? i->value : stmt->as, c);
|
||||
// Imports should ignore noShadow property
|
||||
ctx->Context<SimplifyItem>::add(stmt->as.empty() ? i->value : stmt->as, c);
|
||||
}
|
||||
|
||||
if (!resultStmt) {
|
||||
|
|
|
@ -164,8 +164,8 @@ types::TypePtr TypecheckVisitor::realize(types::TypePtr typ) {
|
|||
auto name = f->ast->name;
|
||||
std::string name_args;
|
||||
if (startswith(name, "._import_")) {
|
||||
name = name.substr(10);
|
||||
auto p = name.find('_');
|
||||
name = name.substr(9);
|
||||
auto p = name.rfind('_');
|
||||
if (p != std::string::npos)
|
||||
name = name.substr(0, p);
|
||||
name = "<import " + name + ">";
|
||||
|
|
Loading…
Reference in New Issue