_ prefixed top-level symbols now file-local

This commit is contained in:
2026-07-11 23:37:30 +02:00
parent 6dd6b7ff54
commit 220b1c6e82
15 changed files with 282 additions and 90 deletions
+6 -6
View File
@@ -933,9 +933,9 @@ ct_eval_expr :: proc(
if !available {
return INVALID_CT_VALUE, ct_flow(.Normal), ct_fail(state, .Not_Comptime, expr.span, "unavailable imported package")
}
global := find_global(checker, expr.name, target_pkg)
global := find_global(checker, expr.name, target_pkg, expr_lookup_file(expr, state.file))
if global == ast.INVALID_GLOBAL || int(global) >= len(checker.ast_module.globals) {
template := find_template(checker, expr.name, target_pkg)
template := find_template(checker, expr.name, target_pkg, expr_lookup_file(expr, state.file))
if template != ast.INVALID_FUNCTION {
pointer_type, _, function_ok := function_pointer_type_for_template(
checker,
@@ -1218,7 +1218,7 @@ ct_eval_struct_expr :: proc(state: ^Ct_State, expr: ast.Expr, expected: types.Ty
struct_type := types.INVALID
if symbol.is_valid(expr.name) {
target_pkg, available := expr_package(checker, expr, state.pkg, state.file, false)
struct_type = types.find_named(store, u32(target_pkg), u32(expr.name)) if available else types.INVALID
struct_type = types.find_named(store, u32(target_pkg), u32(expr.name), file=u32(expr_lookup_file(expr, state.file))) if available else types.INVALID
struct_type = types.resolve_alias(struct_type, store)
} else {
struct_type = types.resolve_alias(expected, store)
@@ -1622,7 +1622,7 @@ ct_eval_place :: proc(
if !available {
return INVALID_CT_PLACE, types.INVALID, false, ct_flow(.Normal), ct_fail(state, .Not_Comptime, expr.span, "unavailable imported package")
}
global := find_global(checker, expr.name, target_pkg)
global := find_global(checker, expr.name, target_pkg, expr_lookup_file(expr, state.file))
if global == ast.INVALID_GLOBAL || int(global) >= len(checker.ast_module.globals) {
return INVALID_CT_PLACE, types.INVALID, false, ct_flow(.Normal), ct_failf(state, .Not_Comptime, expr.span, "unresolved comptime value '%s'", symbol_text(checker, expr.name))
}
@@ -1926,7 +1926,7 @@ ct_eval_call_expr :: proc(state: ^Ct_State, expr: ast.Expr, expected: types.Type
if !available {
return INVALID_CT_VALUE, ct_flow(.Normal), ct_fail(state, .Not_Comptime, expr.span, "unavailable function package")
}
template := find_template(checker, expr.name, target_pkg)
template := find_template(checker, expr.name, target_pkg, expr_lookup_file(expr, state.file))
if template == ast.INVALID_FUNCTION || int(template) >= len(checker.ast_module.functions) {
if !symbol.is_valid(expr.qualifier) {
if index, ok := ct_find_binding_index(state, expr.name); ok {
@@ -1936,7 +1936,7 @@ ct_eval_call_expr :: proc(state: ^Ct_State, expr: ast.Expr, expected: types.Type
}
}
}
global := find_global(checker, expr.name, target_pkg)
global := find_global(checker, expr.name, target_pkg, expr_lookup_file(expr, state.file))
if global != ast.INVALID_GLOBAL && int(global) < len(checker.ast_module.globals) {
g := checker.ast_module.globals[global]
if !g.external && g.immutable && !g.writable {