zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit a217ad59c770eb3915f5b98f177a012181b7f48e (tree)
parent 22338d781679f3210fe599a4a4972d4835589adb
Author: Isaac Freund <ifreund@ifreund.xyz>
Date:   Fri, 26 Mar 2021 23:39:29 +0100

astgen: fix result location for sliced objects

Diffstat:
Msrc/astgen.zig | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/astgen.zig b/src/astgen.zig @@ -436,7 +436,7 @@ pub fn expr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) In .@"for" => return forExpr(mod, scope, rl, node, tree.forFull(node)), .slice_open => { - const lhs = try expr(mod, scope, .{ .ty = .usize_type }, node_datas[node].lhs); + const lhs = try expr(mod, scope, .ref, node_datas[node].lhs); const start = try expr(mod, scope, .{ .ty = .usize_type }, node_datas[node].rhs); const result = try gz.addPlNode(.slice_start, node, zir.Inst.SliceStart{ .lhs = lhs, @@ -445,7 +445,7 @@ pub fn expr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) In return rvalue(mod, scope, rl, result, node); }, .slice => { - const lhs = try expr(mod, scope, .{ .ty = .usize_type }, node_datas[node].lhs); + const lhs = try expr(mod, scope, .ref, node_datas[node].lhs); const extra = tree.extraData(node_datas[node].rhs, ast.Node.Slice); const start = try expr(mod, scope, .{ .ty = .usize_type }, extra.start); const end = try expr(mod, scope, .{ .ty = .usize_type }, extra.end); @@ -457,7 +457,7 @@ pub fn expr(mod: *Module, scope: *Scope, rl: ResultLoc, node: ast.Node.Index) In return rvalue(mod, scope, rl, result, node); }, .slice_sentinel => { - const lhs = try expr(mod, scope, .{ .ty = .usize_type }, node_datas[node].lhs); + const lhs = try expr(mod, scope, .ref, node_datas[node].lhs); const extra = tree.extraData(node_datas[node].rhs, ast.Node.SliceSentinel); const start = try expr(mod, scope, .{ .ty = .usize_type }, extra.start); const end = try expr(mod, scope, .{ .ty = .usize_type }, extra.end);