diff options
Diffstat (limited to 'src/parser')
| -rw-r--r-- | src/parser/parser_core.c | 14 | ||||
| -rw-r--r-- | src/parser/parser_stmt.c | 16 |
2 files changed, 29 insertions, 1 deletions
diff --git a/src/parser/parser_core.c b/src/parser/parser_core.c index d575693..ac578a1 100644 --- a/src/parser/parser_core.c +++ b/src/parser/parser_core.c @@ -516,6 +516,20 @@ ASTNode *parse_program_nodes(ParserContext *ctx, Lexer *l) } } + if (s && s->type == NODE_STRUCT) + { + s->strct.is_export = attr_export; + s->strct.is_packed = attr_packed || s->strct.is_packed; + if (attr_align) + { + s->strct.align = attr_align; + } + if (attr_deprecated && s->strct.name) + { + register_deprecated_func(ctx, s->strct.name, deprecated_msg); + } + } + if (s) { if (!h) diff --git a/src/parser/parser_stmt.c b/src/parser/parser_stmt.c index 6250392..ab5b89c 100644 --- a/src/parser/parser_stmt.c +++ b/src/parser/parser_stmt.c @@ -3178,6 +3178,21 @@ char *run_comptime_block(ParserContext *ctx, Lexer *l) curr = next; } + { + StructRef *ref = ctx->parsed_funcs_list; + while (ref) + { + ASTNode *fn = ref->node; + if (fn && fn->type == NODE_FUNCTION && fn->func.is_comptime) + { + emit_func_signature(f, fn, NULL); + fprintf(f, ";\n"); + codegen_node_single(ctx, fn, f); + } + ref = ref->next; + } + } + fprintf(f, "int main() {\n"); curr = stmts; while (curr) @@ -3241,7 +3256,6 @@ char *run_comptime_block(ParserContext *ctx, Lexer *l) output_src = xstrdup(""); // Empty output is valid } - // Cleanup remove(filename); remove(bin); remove(out_file); |
