diff options
| author | gingerBill <bill@gingerbill.org> | 2023-08-22 12:05:25 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-08-22 12:05:25 +0100 |
| commit | 1cdb975c9183cb1be269ae394cc11b3a55cf9dfc (patch) | |
| tree | 506433686dbff34ae73668f53c9edab6c8dc3964 /src/parser.cpp | |
| parent | cd42d26eb32d69fcd80c50deba6005a6c44436ed (diff) | |
Add attribute `@(require) import "foo"` to replace/supplement `_ :: foo`
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index 53fc45a59..cdf3c239c 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1212,6 +1212,7 @@ gb_internal Ast *ast_import_decl(AstFile *f, Token token, Token relpath, Token i result->ImportDecl.import_name = import_name; result->ImportDecl.docs = docs; result->ImportDecl.comment = comment; + result->ImportDecl.attributes.allocator = ast_allocator(f); return result; } @@ -4634,7 +4635,9 @@ gb_internal Ast *parse_attribute(AstFile *f, Token token, TokenKind open_kind, T array_add(&decl->ForeignBlockDecl.attributes, attribute); } else if (decl->kind == Ast_ForeignImportDecl) { array_add(&decl->ForeignImportDecl.attributes, attribute); - }else { + } else if (decl->kind == Ast_ImportDecl) { + array_add(&decl->ImportDecl.attributes, attribute); + } else { syntax_error(decl, "Expected a value or foreign declaration after an attribute, got %.*s", LIT(ast_strings[decl->kind])); return ast_bad_stmt(f, token, f->curr_token); } |