diff options
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index 0d9fad8c7..07afc56d6 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1434,7 +1434,7 @@ gb_internal Token expect_closing_brace_of_field_list(AstFile *f) { return token; } bool ok = true; - if (!f->allow_newline) { + if (f->allow_newline) { ok = !skip_possible_newline(f); } if (ok && allow_token(f, Token_Semicolon)) { @@ -3191,6 +3191,15 @@ gb_internal Ast *parse_foreign_block(AstFile *f, Token token) { return decl; } +gb_internal void print_comment_group(CommentGroup *group) { + if (group) { + for (Token const &token : group->list) { + gb_printf_err("%.*s\n", LIT(token.string)); + } + gb_printf_err("\n"); + } +} + gb_internal Ast *parse_value_decl(AstFile *f, Array<Ast *> names, CommentGroup *docs) { bool is_mutable = true; @@ -3232,6 +3241,8 @@ gb_internal Ast *parse_value_decl(AstFile *f, Array<Ast *> names, CommentGroup * values.allocator = heap_allocator(); } + CommentGroup *end_comment = f->lead_comment; + if (f->expr_level >= 0) { if (f->curr_token.kind == Token_CloseBrace && f->curr_token.pos.line == f->prev_token.pos.line) { @@ -3252,7 +3263,7 @@ gb_internal Ast *parse_value_decl(AstFile *f, Array<Ast *> names, CommentGroup * } } - return ast_value_decl(f, names, type, values, is_mutable, docs, f->line_comment); + return ast_value_decl(f, names, type, values, is_mutable, docs, end_comment); } gb_internal Ast *parse_simple_stmt(AstFile *f, u32 flags) { |