Skip to content

Commit

Permalink
Fix effect of pointer[n] for n > 0.
Browse files Browse the repository at this point in the history
Pointer[n] was incorrectly getting translated to
slice(n, n+1)[n], instead of slice(n, n+1)[0].
  • Loading branch information
AWoloszyn committed Jan 31, 2019
1 parent 2caca15 commit 44c6681
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gapil/resolver/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ func index(rv *resolver, in *ast.Index) semantic.Expression {
// pointer[n]
r := &semantic.BinaryOp{LHS: n, Operator: ast.OpSlice, RHS: n + 1}
slice := &semantic.PointerRange{AST: in, Pointer: object, Type: at.Slice, Range: r}
out := &semantic.SliceIndex{AST: in, Slice: slice, Type: at.Slice, Index: n}
out := &semantic.SliceIndex{AST: in, Slice: slice, Type: at.Slice, Index: semantic.Uint64Value(0)}
rv.mappings.Add(in, out)
return out
}
Expand Down

0 comments on commit 44c6681

Please sign in to comment.