diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-07-18 17:12:19 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-07-18 19:02:06 -0700 |
| commit | 0153f3a8f9b93ebef7b5cd70db8560fcac658ce7 (patch) | |
| tree | 7d4b799c06a0fd3470667051f3271abbde096e8b /src/Module.zig | |
| parent | 47499bf47ba73ab49503298a87123b9e873e3693 (diff) | |
| download | zig-0153f3a8f9b93ebef7b5cd70db8560fcac658ce7.tar.gz zig-0153f3a8f9b93ebef7b5cd70db8560fcac658ce7.zip | |
Sema: fix crash: array_in_c_exported_function
Fuck it, we're storing decl indexes in LazySrcLoc now.
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/Module.zig b/src/Module.zig index d9ee3a57ad..3ae78c30b1 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -1821,8 +1821,8 @@ pub const SrcLoc = struct { return tree.firstToken(src_loc.parent_decl_node); } - pub fn declRelativeToNodeIndex(src_loc: SrcLoc, offset: i32) Ast.TokenIndex { - return @as(Ast.Node.Index, @bitCast(offset + @as(i32, @bitCast(src_loc.parent_decl_node)))); + pub fn declRelativeToNodeIndex(src_loc: SrcLoc, offset: i32) Ast.Node.Index { + return @bitCast(offset + @as(i32, @bitCast(src_loc.parent_decl_node))); } pub const Span = struct { @@ -2829,14 +2829,15 @@ pub const LazySrcLoc = union(enum) { /// The Decl is determined contextually. for_capture_from_input: i32, /// The source location points to the argument node of a function call. - /// The Decl is determined contextually. call_arg: struct { + decl: Decl.Index, /// Points to the function call AST node. call_node_offset: i32, /// The index of the argument the source location points to. arg_index: u32, }, fn_proto_param: struct { + decl: Decl.Index, /// Points to the function prototype AST node. fn_proto_node_offset: i32, /// The index of the parameter the source location points to. @@ -2931,13 +2932,18 @@ pub const LazySrcLoc = union(enum) { .node_offset_store_operand, .for_input, .for_capture_from_input, - .call_arg, - .fn_proto_param, => .{ .file_scope = decl.getFileScope(mod), .parent_decl_node = decl.src_node, .lazy = lazy, }, + inline .call_arg, + .fn_proto_param, + => |x| .{ + .file_scope = decl.getFileScope(mod), + .parent_decl_node = mod.declPtr(x.decl).src_node, + .lazy = lazy, + }, }; } }; |
