_ prefixed top-level symbols now file-local
This commit is contained in:
@@ -1226,18 +1226,18 @@ load_package :: proc(state: ^State, path: string, import_span: source.Span, is_r
|
||||
return pkg_id
|
||||
}
|
||||
|
||||
declaration_conflicts :: proc(module: ^ast.Module, pkg: ast.Package_Id, name: symbol.Id) -> bool {
|
||||
declaration_conflicts :: proc(module: ^ast.Module, pkg: ast.Package_Id, file: ast.File_Id, name: symbol.Id) -> bool {
|
||||
for function in module.functions {
|
||||
if function.pkg == pkg && function.name == name {
|
||||
if function.pkg == pkg && function.name == name && (!function.file_hidden || function.file == file) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
for global in module.globals {
|
||||
if global.pkg == pkg && global.name == name {
|
||||
if global.pkg == pkg && global.name == name && (!global.file_hidden || global.file == file) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
type_id := types.find_named(&module.type_store, u32(pkg), u32(name))
|
||||
type_id := types.find_named(&module.type_store, u32(pkg), u32(name), file=u32(file))
|
||||
type_item, type_ok := types.node(&module.type_store, type_id)
|
||||
if type_ok && type_item.declared {
|
||||
return true
|
||||
@@ -1260,7 +1260,7 @@ validate_imports :: proc(state: ^State) {
|
||||
)
|
||||
state.module.imports[import_id].valid = false
|
||||
}
|
||||
if declaration_conflicts(state.module, import_item.pkg, alias) {
|
||||
if declaration_conflicts(state.module, import_item.pkg, import_item.file, alias) {
|
||||
state.module.imports[import_id].diagnostic = source.addf(
|
||||
state.diagnostics,
|
||||
import_item.span,
|
||||
|
||||
Reference in New Issue
Block a user