diff options
| author | Evan Haas <evan@lagerdata.com> | 2022-07-25 09:53:40 -0700 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-07-27 14:03:08 +0300 |
| commit | 7ba1f9bfb52a1f6fa776eeafb45790331be4388f (patch) | |
| tree | e893b174fc9b7e88ea15190f75e05753b315e940 /src/translate_c | |
| parent | c8c798685f3a7d6454bc06d5f47531ad6f615eb5 (diff) | |
| download | zig-7ba1f9bfb52a1f6fa776eeafb45790331be4388f.tar.gz zig-7ba1f9bfb52a1f6fa776eeafb45790331be4388f.zip | |
translate-c: take address of functions before passing them to @ptrToInt
Fixes #12194
Diffstat (limited to 'src/translate_c')
| -rw-r--r-- | src/translate_c/ast.zig | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/translate_c/ast.zig b/src/translate_c/ast.zig index 3e30b33abc..b88b481ae7 100644 --- a/src/translate_c/ast.zig +++ b/src/translate_c/ast.zig @@ -36,6 +36,7 @@ pub const Node = extern union { /// "string"[0..end] string_slice, identifier, + fn_identifier, @"if", /// if (!operand) break; if_not_break, @@ -335,6 +336,7 @@ pub const Node = extern union { .char_literal, .enum_literal, .identifier, + .fn_identifier, .warning, .type, .helpers_macro, @@ -1058,6 +1060,14 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex { .data = undefined, }); }, + .fn_identifier => { + const payload = node.castTag(.fn_identifier).?.data; + return c.addNode(.{ + .tag = .identifier, + .main_token = try c.addIdentifier(payload), + .data = undefined, + }); + }, .float_literal => { const payload = node.castTag(.float_literal).?.data; return c.addNode(.{ @@ -2234,6 +2244,7 @@ fn renderNodeGrouped(c: *Context, node: Node) !NodeIndex { .char_literal, .enum_literal, .identifier, + .fn_identifier, .field_access, .ptr_cast, .type, |
