| ... | @@ -4021,8 +4021,8 @@ static TypeTableEntry *analyze_import(CodeGen *g, ImportTableEntry *import, Bloc | ... | @@ -4021,8 +4021,8 @@ static TypeTableEntry *analyze_import(CodeGen *g, ImportTableEntry *import, Bloc |
| 4021 | { | 4021 | { |
| 4022 | assert(node->type == NodeTypeFnCallExpr); | 4022 | assert(node->type == NodeTypeFnCallExpr); |
| 4023 | | 4023 | |
| 4024 | if (context != import->block_context) { | 4024 | if (context->fn_entry) { |
| 4025 | add_node_error(g, node, buf_sprintf("@import valid only at top level scope")); | 4025 | add_node_error(g, node, buf_sprintf("@import invalid inside function bodies")); |
| 4026 | return g->builtin_types.entry_invalid; | 4026 | return g->builtin_types.entry_invalid; |
| 4027 | } | 4027 | } |
| 4028 | | 4028 | |
| ... | @@ -4096,8 +4096,8 @@ static TypeTableEntry *analyze_c_import(CodeGen *g, ImportTableEntry *parent_imp | ... | @@ -4096,8 +4096,8 @@ static TypeTableEntry *analyze_c_import(CodeGen *g, ImportTableEntry *parent_imp |
| 4096 | { | 4096 | { |
| 4097 | assert(node->type == NodeTypeFnCallExpr); | 4097 | assert(node->type == NodeTypeFnCallExpr); |
| 4098 | | 4098 | |
| 4099 | if (parent_context != parent_import->block_context) { | 4099 | if (parent_context->fn_entry) { |
| 4100 | add_node_error(g, node, buf_sprintf("@c_import valid only at top level scope")); | 4100 | add_node_error(g, node, buf_sprintf("@c_import invalid inside function bodies")); |
| 4101 | return g->builtin_types.entry_invalid; | 4101 | return g->builtin_types.entry_invalid; |
| 4102 | } | 4102 | } |
| 4103 | | 4103 | |