diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-02-17 22:34:06 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-02-17 22:34:06 -0700 |
| commit | 29daf10639149bd023db0be4e04eaf154dce0f83 (patch) | |
| tree | 13dc178febddc98b4cc72b6a4f341b796a2a008e /src/astgen.zig | |
| parent | 5a2620fcca55813d87000f3018e70509b1d325e0 (diff) | |
| download | zig-29daf10639149bd023db0be4e04eaf154dce0f83.tar.gz zig-29daf10639149bd023db0be4e04eaf154dce0f83.zip | |
stage2: fix a couple more compilation errors
Diffstat (limited to 'src/astgen.zig')
| -rw-r--r-- | src/astgen.zig | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/astgen.zig b/src/astgen.zig index 125e9bceda..a018d58d2f 100644 --- a/src/astgen.zig +++ b/src/astgen.zig @@ -539,6 +539,7 @@ pub fn comptimeExpr( } const tree = parent_scope.tree(); + const token_starts = tree.tokens.items(.start); // Make a scope to collect generated instructions in the sub-expression. var block_scope: Scope.GenZIR = .{ @@ -693,7 +694,7 @@ pub fn blockExpr( rl: ResultLoc, block_node: ast.Node.Index, statements: []const ast.Node.Index, -) InnerError!void { +) InnerError!*zir.Inst { const tracy = trace(@src()); defer tracy.end(); @@ -1174,20 +1175,6 @@ fn negation( return addZIRBinOp(mod, scope, src, op_inst_tag, lhs, rhs); } -fn ptrType(mod: *Module, scope: *Scope, node: *ast.Node.PtrType) InnerError!*zir.Inst { - const tree = scope.tree(); - const src = token_starts[node.op_token]; - return ptrSliceType(mod, scope, src, &node.ptr_info, node.rhs, switch (tree.token_ids[node.op_token]) { - .Asterisk, .AsteriskAsterisk => .One, - // TODO stage1 type inference bug - .LBracket => @as(std.builtin.TypeInfo.Pointer.Size, switch (tree.token_ids[node.op_token + 2]) { - .identifier => .C, - else => .Many, - }), - else => unreachable, - }); -} - fn ptrSliceType(mod: *Module, scope: *Scope, src: usize, ptr_info: *ast.PtrInfo, rhs: *ast.Node, size: std.builtin.TypeInfo.Pointer.Size) InnerError!*zir.Inst { const simple = ptr_info.allowzero_token == null and ptr_info.align_info == null and |
