Allow table base.u8 as a type

This commit is contained in:
Nigel Tao committed 2018-05-18 10:31:24 +10:00
1 parent 2301c763c3
commit eda326726a
10 files changed
+60 -27

No files matched your search

+2 -2
View File
@@ -463,7 +463,7 @@ func (q *checker) bcheckAssignment1(lhs *a.Expr, op t.ID, rhs *a.Expr) error {
case t.IDArray:
// TODO: handle.
return nil
// TODO: t.IDSlice?
// TODO: t.IDSlice, t.IDTable?
}
_, _, err := q.bcheckExpr(lhs, 0)
@@ -1218,7 +1218,7 @@ func (q *checker) bcheckTypeExpr(typ *a.TypeExpr) (*big.Int, *big.Int, error) {
switch typ.Decorator() {
// TODO: case t.IDFunc.
case t.IDPtr, t.IDArray, t.IDSlice:
case t.IDPtr, t.IDArray, t.IDSlice, t.IDTable:
return nil, nil, nil
}
+1
View File
@@ -54,6 +54,7 @@ var (
typeExprStatus = a.NewTypeExpr(0, t.IDBase, t.IDStatus, nil, nil, nil)
typeExprSliceU8 = a.NewTypeExpr(t.IDSlice, 0, 0, nil, nil, typeExprU8)
typeExprTableU8 = a.NewTypeExpr(t.IDTable, 0, 0, nil, nil, typeExprU8)
)
// typeMap maps from variable names (as token IDs) to types.
+1 -1
View File
@@ -987,7 +987,7 @@ swtch:
fallthrough
// TODO: also check t.IDNptr? Where else should we look for nptr?
case t.IDPtr, t.IDSlice:
case t.IDPtr, t.IDSlice, t.IDTable:
if err := q.tcheckTypeExpr(typ.Inner(), depth); err != nil {
return err
}