| ... | ... | @@ -5847,6 +5847,22 @@ fn parseCPrimaryExprInner(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!* |
| 5847 | 5847 | } else { |
| 5848 | 5848 | return transCreateNodeIdentifierUnchecked(c, "c_int"); |
| 5849 | 5849 | }, |
| 5850 | .Keyword_enum, .Keyword_struct, .Keyword_union => { |
| 5851 | // struct Foo will be declared as struct_Foo by transRecordDecl |
| 5852 | const next_id = m.next().?; |
| 5853 | if (next_id != .Identifier) { |
| 5854 | try m.fail(c, "unable to translate C expr: expected Identifier instead got: {}", .{@tagName(next_id)}); |
| 5855 | return error.ParseError; |
| 5856 | } |
| 5857 | |
| 5858 | const ident_token = try appendTokenFmt(c, .Identifier, "{}_{}", .{slice, m.slice()}); |
| 5859 | const identifier = try c.arena.create(ast.Node.OneToken); |
| 5860 | identifier.* = .{ |
| 5861 | .base = .{ .tag = .Identifier }, |
| 5862 | .token = ident_token, |
| 5863 | }; |
| 5864 | return &identifier.base; |
| 5865 | }, |
| 5850 | 5866 | .Identifier => { |
| 5851 | 5867 | const mangled_name = scope.getAlias(slice); |
| 5852 | 5868 | return transCreateNodeIdentifier(c, checkForBuiltinTypedef(mangled_name) orelse mangled_name); |
| ... | ... | @@ -5856,7 +5872,7 @@ fn parseCPrimaryExprInner(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!* |
| 5856 | 5872 | |
| 5857 | 5873 | const next_id = m.next().?; |
| 5858 | 5874 | if (next_id != .RParen) { |
| 5859 | | try m.fail(c, "unable to translate C expr: expected ')'' instead got: {}", .{@tagName(next_id)}); |
| 5875 | try m.fail(c, "unable to translate C expr: expected ')' instead got: {}", .{@tagName(next_id)}); |
| 5860 | 5876 | return error.ParseError; |
| 5861 | 5877 | } |
| 5862 | 5878 | var saw_l_paren = false; |
| ... | ... | @@ -5886,7 +5902,7 @@ fn parseCPrimaryExprInner(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!* |
| 5886 | 5902 | const node_to_cast = try parseCExpr(c, m, scope); |
| 5887 | 5903 | |
| 5888 | 5904 | if (saw_l_paren and m.next().? != .RParen) { |
| 5889 | | try m.fail(c, "unable to translate C expr: expected ')''", .{}); |
| 5905 | try m.fail(c, "unable to translate C expr: expected ')'", .{}); |
| 5890 | 5906 | return error.ParseError; |
| 5891 | 5907 | } |
| 5892 | 5908 | |