diff --git a/doc/changelog.md b/doc/changelog.md index 4fae72ca..6c83512b 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -20,7 +20,6 @@ - Renamed `buf1`, `reader1`, etc to `io_buffer`, `io_reader`, etc. - Renamed `u32`, `io_reader`, etc to `base.u32`, `base.io_reader`, etc. - Added a `base.image_config` type. -- Allow `p[i]` for pointer-typed `p`. - Tweaked how marks and limits work. - Supported animated (not just single frame) GIFs. - Marked the `std/gif` LZW decoder as private. diff --git a/lang/ast/ast.go b/lang/ast/ast.go index 8a7320c4..e7a1fef7 100644 --- a/lang/ast/ast.go +++ b/lang/ast/ast.go @@ -727,11 +727,6 @@ func (n *TypeExpr) IsArrayType() bool { return n.id0 == t.IDArray } -func (n *TypeExpr) IsPtrType() bool { - // TODO: nptr?? - return n.id0 == t.IDPtr -} - func (n *TypeExpr) IsSliceType() bool { return n.id0 == t.IDSlice } diff --git a/lang/check/bounds.go b/lang/check/bounds.go index 023eddb9..78109c7b 100644 --- a/lang/check/bounds.go +++ b/lang/check/bounds.go @@ -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() diff --git a/lang/check/type.go b/lang/check/type.go index e7f4b3da..43cce235 100644 --- a/lang/check/type.go +++ b/lang/check/type.go @@ -467,8 +467,8 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error { return err } lTyp := lhs.MType() - if key := lTyp.Decorator(); key != t.IDArray && key != t.IDPtr && key != t.IDSlice { - return fmt.Errorf("check: %s is an index expression but %s has type %s, not an array, ptr or slice type", + if key := lTyp.Decorator(); key != t.IDArray && key != t.IDSlice { + return fmt.Errorf("check: %s is an index expression but %s has type %s, not an array or slice type", n.Str(q.tm), lhs.Str(q.tm), lTyp.Str(q.tm)) } rTyp := rhs.MType() @@ -514,7 +514,6 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error { n.Str(q.tm), lhs.Str(q.tm), lTyp.Str(q.tm)) case t.IDArray: n.SetMType(a.NewTypeExpr(t.IDSlice, 0, 0, nil, nil, lTyp.Inner())) - // TODO: case t.IDPtr? case t.IDSlice: n.SetMType(lTyp) }