diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-08-23 11:43:37 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-08-23 11:43:37 -0400 |
| commit | 3865b6ad8f8ba71dca06c81828ec2e29f3019879 (patch) | |
| tree | cfadbebe532708c931bddcc8e5b262d63946c78d /src/parser.cpp | |
| parent | 79a4b7a2365dc50d01eb6bc29bbb77244a1620cf (diff) | |
| parent | ec2f9ef4e8be5995ab652dde59b12ee340a9e28d (diff) | |
| download | zig-3865b6ad8f8ba71dca06c81828ec2e29f3019879.tar.gz zig-3865b6ad8f8ba71dca06c81828ec2e29f3019879.zip | |
Merge remote-tracking branch 'origin/master' into fix-field-alignment-kludge
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index 1e7e36d0bd..6cd6c2f045 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -782,24 +782,26 @@ static AstNode *ast_parse_var_decl(ParseContext *pc) { return res; } -// ContainerField <- IDENTIFIER (COLON TypeExpr)? (EQUAL Expr)? +// ContainerField <- IDENTIFIER (COLON TypeExpr ByteAlign?)? (EQUAL Expr)? static AstNode *ast_parse_container_field(ParseContext *pc) { Token *identifier = eat_token_if(pc, TokenIdSymbol); if (identifier == nullptr) return nullptr; AstNode *type_expr = nullptr; - if (eat_token_if(pc, TokenIdColon) != nullptr) + if (eat_token_if(pc, TokenIdColon) != nullptr) { type_expr = ast_expect(pc, ast_parse_type_expr); + } + AstNode *align_expr = ast_parse_byte_align(pc); AstNode *expr = nullptr; if (eat_token_if(pc, TokenIdEq) != nullptr) expr = ast_expect(pc, ast_parse_expr); - AstNode *res = ast_create_node(pc, NodeTypeStructField, identifier); res->data.struct_field.name = token_buf(identifier); res->data.struct_field.type = type_expr; res->data.struct_field.value = expr; + res->data.struct_field.align_expr = align_expr; return res; } |
