From 61e26d818835fd7bcffddc6c4918367fe4ffe39a Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Tue, 14 Feb 2023 12:27:17 +0100 Subject: [PATCH] Fixes to $include --- src/compiler/parse_global.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/parse_global.c b/src/compiler/parse_global.c index ee85d5cb8..f58eb2ea8 100644 --- a/src/compiler/parse_global.c +++ b/src/compiler/parse_global.c @@ -2666,7 +2666,7 @@ static Decl *parse_include(ParseContext *c) TokenData old_data = c->data; SourceSpan old_prev = c->prev_span; SourceSpan old_span = c->span; - + c->tok = TOKEN_INVALID_TOKEN; c->lexer = (Lexer){ .file = decl->include.file, .context = c }; lexer_init(&c->lexer); // Prime everything @@ -2676,10 +2676,10 @@ static Decl *parse_include(ParseContext *c) while (!tok_is(c, TOKEN_EOF)) { Decl *inner = parse_top_level_statement(c, &c); - if (!decl) continue; - if (!decl_ok(decl)) + if (!inner) continue; + if (!decl_ok(inner)) { - decl_poison(decl); + decl_poison(inner); goto END; } add_decl_to_list(&list, inner);