| ... | @@ -3180,7 +3180,7 @@ static VariableTableEntry *create_local_var(CodeGen *codegen, AstNode *node, Sco | ... | @@ -3180,7 +3180,7 @@ static VariableTableEntry *create_local_var(CodeGen *codegen, AstNode *node, Sco |
| 3180 | buf_sprintf("variable shadows type '%s'", buf_ptr(&type->name))); | 3180 | buf_sprintf("variable shadows type '%s'", buf_ptr(&type->name))); |
| 3181 | variable_entry->value.type = codegen->builtin_types.entry_invalid; | 3181 | variable_entry->value.type = codegen->builtin_types.entry_invalid; |
| 3182 | } else { | 3182 | } else { |
| 3183 | Tld *tld = find_decl(parent_scope, name); | 3183 | Tld *tld = find_decl(codegen, parent_scope, name); |
| 3184 | if (tld && tld->id != TldIdVar) { | 3184 | if (tld && tld->id != TldIdVar) { |
| 3185 | ErrorMsg *msg = add_node_error(codegen, node, | 3185 | ErrorMsg *msg = add_node_error(codegen, node, |
| 3186 | buf_sprintf("redefinition of '%s'", buf_ptr(name))); | 3186 | buf_sprintf("redefinition of '%s'", buf_ptr(name))); |
| ... | @@ -3676,7 +3676,7 @@ static IrInstruction *ir_gen_symbol(IrBuilder *irb, Scope *scope, AstNode *node, | ... | @@ -3676,7 +3676,7 @@ static IrInstruction *ir_gen_symbol(IrBuilder *irb, Scope *scope, AstNode *node, |
| 3676 | return ir_build_load_ptr(irb, scope, node, var_ptr); | 3676 | return ir_build_load_ptr(irb, scope, node, var_ptr); |
| 3677 | } | 3677 | } |
| 3678 | | 3678 | |
| 3679 | Tld *tld = find_decl(scope, variable_name); | 3679 | Tld *tld = find_decl(irb->codegen, scope, variable_name); |
| 3680 | if (tld) | 3680 | if (tld) |
| 3681 | return ir_gen_decl_ref(irb, node, tld, lval, scope); | 3681 | return ir_gen_decl_ref(irb, node, tld, lval, scope); |
| 3682 | | 3682 | |
| ... | @@ -4210,7 +4210,7 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo | ... | @@ -4210,7 +4210,7 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo |
| 4210 | return irb->codegen->invalid_instruction; | 4210 | return irb->codegen->invalid_instruction; |
| 4211 | } | 4211 | } |
| 4212 | Buf *variable_name = arg0_node->data.symbol_expr.symbol; | 4212 | Buf *variable_name = arg0_node->data.symbol_expr.symbol; |
| 4213 | Tld *tld = find_decl(scope, variable_name); | 4213 | Tld *tld = find_decl(irb->codegen, scope, variable_name); |
| 4214 | if (!tld) { | 4214 | if (!tld) { |
| 4215 | add_node_error(irb->codegen, node, buf_sprintf("use of undeclared identifier '%s'", | 4215 | add_node_error(irb->codegen, node, buf_sprintf("use of undeclared identifier '%s'", |
| 4216 | buf_ptr(variable_name))); | 4216 | buf_ptr(variable_name))); |
| ... | @@ -9333,19 +9333,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru | ... | @@ -9333,19 +9333,7 @@ static TypeTableEntry *ir_analyze_instruction_field_ptr(IrAnalyze *ira, IrInstru |
| 9333 | | 9333 | |
| 9334 | ImportTableEntry *namespace_import = namespace_val->data.x_import; | 9334 | ImportTableEntry *namespace_import = namespace_val->data.x_import; |
| 9335 | | 9335 | |
| 9336 | Tld *tld = find_decl(&namespace_import->decls_scope->base, field_name); | 9336 | Tld *tld = find_decl(ira->codegen, &namespace_import->decls_scope->base, field_name); |
| 9337 | if (!tld) { | | |
| 9338 | // we must now resolve all the use decls | | |
| 9339 | // TODO move this check to find_decl? | | |
| 9340 | for (size_t i = 0; i < namespace_import->use_decls.length; i += 1) { | | |
| 9341 | AstNode *use_decl_node = namespace_import->use_decls.at(i); | | |
| 9342 | if (use_decl_node->data.use.resolution == TldResolutionUnresolved) { | | |
| 9343 | preview_use_decl(ira->codegen, use_decl_node); | | |
| 9344 | } | | |
| 9345 | resolve_use_decl(ira->codegen, use_decl_node); | | |
| 9346 | } | | |
| 9347 | tld = find_decl(&namespace_import->decls_scope->base, field_name); | | |
| 9348 | } | | |
| 9349 | if (tld) { | 9337 | if (tld) { |
| 9350 | if (tld->visib_mod == VisibModPrivate && | 9338 | if (tld->visib_mod == VisibModPrivate && |
| 9351 | tld->import != source_node->owner) | 9339 | tld->import != source_node->owner) |