diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2022-05-31 11:52:24 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-31 11:52:24 +0100 |
| commit | a1f15c2c69b557be5a95882d18137d1f74d980ee (patch) | |
| tree | 3f484753712a6d9d9cf1074f56bc91af6d6432c1 /src/parser.cpp | |
| parent | a6c779b50ecf5c8c0cb86c9d49768ab34508b1d2 (diff) | |
| parent | 516f6647b46c69a67139154c02c74b436cd4b999 (diff) | |
Merge pull request #1807 from odin-lang/simd-dev
Generic #simd type and intrinsics
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index d19e249e5..5280fd4b0 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -360,6 +360,7 @@ Ast *clone_ast(Ast *node) { case Ast_ArrayType: n->ArrayType.count = clone_ast(n->ArrayType.count); n->ArrayType.elem = clone_ast(n->ArrayType.elem); + n->ArrayType.tag = clone_ast(n->ArrayType.tag); break; case Ast_DynamicArrayType: n->DynamicArrayType.elem = clone_ast(n->DynamicArrayType.elem); @@ -2127,7 +2128,18 @@ Ast *parse_operand(AstFile *f, bool lhs) { Token name = expect_token(f, Token_Ident); if (name.string == "type") { return ast_helper_type(f, token, parse_type(f)); - } else if (name.string == "soa" || name.string == "simd") { + } else if ( name.string == "simd") { + Ast *tag = ast_basic_directive(f, token, name); + Ast *original_type = parse_type(f); + Ast *type = unparen_expr(original_type); + switch (type->kind) { + case Ast_ArrayType: type->ArrayType.tag = tag; break; + default: + syntax_error(type, "Expected a fixed array type after #%.*s, got %.*s", LIT(name.string), LIT(ast_strings[type->kind])); + break; + } + return original_type; + } else if (name.string == "soa") { Ast *tag = ast_basic_directive(f, token, name); Ast *original_type = parse_type(f); Ast *type = unparen_expr(original_type); |