aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-11-01 19:26:22 +0000
committergingerBill <bill@gingerbill.org>2019-11-01 19:26:22 +0000
commit3b898e5224872a507bd4a8e8be75c80643943d2a (patch)
treecb07b7ad1945061de9e900d9957b0aec7147a6cb /src/parser.cpp
parent44a303e5778fb8564964d53523634f34f8589489 (diff)
Add `@force` to `foreign import`
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 10aa10119..cb04ca1f5 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -1049,6 +1049,8 @@ Ast *ast_foreign_import_decl(AstFile *f, Token token, Array<Token> filepaths, To
result->ForeignImportDecl.library_name = library_name;
result->ForeignImportDecl.docs = docs;
result->ForeignImportDecl.comment = comment;
+ result->ForeignImportDecl.attributes.allocator = heap_allocator();
+
return result;
}
@@ -3865,7 +3867,9 @@ Ast *parse_attribute(AstFile *f, Token token, TokenKind open_kind, TokenKind clo
array_add(&decl->ValueDecl.attributes, attribute);
} else if (decl->kind == Ast_ForeignBlockDecl) {
array_add(&decl->ForeignBlockDecl.attributes, attribute);
- } else {
+ } else if (decl->kind == Ast_ForeignImportDecl) {
+ array_add(&decl->ForeignImportDecl.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);
}