Remove p[i] for ptr-typed p

This commit is contained in:
Nigel Tao committed 2018-05-04 13:29:51 +10:00
1 parent 1435f1d43c
commit 877b4f648f
4 files changed
+2 -13

No files matched your search

-4
View File
@@ -872,9 +872,6 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (*big.Int, *big.Int,
lengthExpr := (*a.Expr)(nil)
if lTyp := lhs.MType(); lTyp.IsArrayType() {
lengthExpr = lTyp.ArrayLength()
} else if lTyp.IsPtrType() {
// TODO: don't skip bounds checking p[i] for ptr-typed p.
break
} else {
lengthExpr = makeSliceLength(lhs)
}
@@ -894,7 +891,6 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (*big.Int, *big.Int,
return nil, nil, nil
}
// TODO: slicing "ptr T" types?
lengthExpr := (*a.Expr)(nil)
if lTyp := lhs.MType(); lTyp.IsArrayType() {
lengthExpr = lTyp.ArrayLength()