diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-02-19 20:57:06 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-02-19 20:57:06 -0700 |
| commit | 5b597a16c6c4ac36a8d2004d5eeed62c38c75253 (patch) | |
| tree | fe6c14025e5b4337134cbf29b972321e55908047 /src/Module.zig | |
| parent | d8560edc2941016a12a03df36035cabd537dde77 (diff) | |
| download | zig-5b597a16c6c4ac36a8d2004d5eeed62c38c75253.tar.gz zig-5b597a16c6c4ac36a8d2004d5eeed62c38c75253.zip | |
stage2: fix not setting up ZIR arg instruction correctly
This is a regression from when I briefly flirted with changing how arg
ZIR instructions work in this branch, and then failed to revert it
correctly.
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Module.zig b/src/Module.zig index 9a918321c4..7af4648c79 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -1340,13 +1340,15 @@ fn astgenAndSemaFn( const name_token = param.name_token.?; const src = token_starts[name_token]; const param_name = try mod.identifierTokenString(&gen_scope.base, name_token); - const arg = try decl_arena.allocator.create(zir.Inst.NoOp); + const arg = try decl_arena.allocator.create(zir.Inst.Arg); arg.* = .{ .base = .{ .tag = .arg, .src = src, }, - .positionals = .{}, + .positionals = .{ + .name = param_name, + }, .kw_args = .{}, }; gen_scope.instructions.items[i] = &arg.base; @@ -3929,7 +3931,9 @@ pub fn validateVarType(mod: *Module, scope: *Scope, src: usize, ty: Type) !void /// Identifier token -> String (allocated in scope.arena()) pub fn identifierTokenString(mod: *Module, scope: *Scope, token: ast.TokenIndex) InnerError![]const u8 { const tree = scope.tree(); + const token_tags = tree.tokens.items(.tag); const token_starts = tree.tokens.items(.start); + assert(token_tags[token] == .identifier); const ident_name = tree.tokenSlice(token); if (mem.startsWith(u8, ident_name, "@")) { |
