diff --git a/src/compiler.pr b/src/compiler.pr index 5c7183f..7e38c8d 100644 --- a/src/compiler.pr +++ b/src/compiler.pr @@ -3210,7 +3210,10 @@ def walk_Identifier(node: &parser::Node, state: &State) -> Value { if (@val).global { let name = val.assembly_name(state) (@(@state).module).imported.add(name) - if val.module != state.module { + if val.module != state.module and + not is_function(val.tpe) and + not state.module.result.globals.contains(name) { + state.module.result.globals(name) = [ tpe = val.tpe, name = name, diff --git a/src/consteval.pr b/src/consteval.pr index 7e130c5..cdffde9 100644 --- a/src/consteval.pr +++ b/src/consteval.pr @@ -306,9 +306,9 @@ export def walk_Def(node: &parser::Node, state: &typechecking::State) { let impl = node.value.def_.impl let has_yield = node.value.def_.has_yield - let prev_context = state.context - state.context = state.module.scope - defer state.context = prev_context + //let prev_context = state.context + //state.context = state.module.scope + //defer state.context = prev_context var body = node.value.def_.body let imported = (share !int & parser::ShareMarker::IMPORT !int) != 0 diff --git a/src/parser.pr b/src/parser.pr index e8b3970..2a3953c 100644 --- a/src/parser.pr +++ b/src/parser.pr @@ -433,7 +433,7 @@ export let invalid_loc: SourceLoc = [ ] !SourceLoc export def is_invalid(loc: SourceLoc) -> bool { - return loc.filename == null + return not to_bool(loc.filename) } export def == (this: SourceLoc, other: SourceLoc) -> bool {