mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 08:47:56 +01:00
First cut at a "[] u8" slice type.
This commit is contained in:
1 parent
ceedd8c3b9
commit
519ec373f2
15 files changed
+123
-32
No files matched your search
@@ -353,7 +353,7 @@ func (q *checker) bcheckAssignment1(lhs *a.Expr, op t.ID, rhs *a.Expr) error {
|
||||
rMin, rMax := (*big.Int)(nil), (*big.Int)(nil)
|
||||
if op == t.IDEq {
|
||||
if cv := rhs.ConstValue(); cv != nil {
|
||||
if cv.Cmp(lMin) < 0 || cv.Cmp(lMax) > 0 {
|
||||
if (lMin != nil && cv.Cmp(lMin) < 0) || (lMax != nil && cv.Cmp(lMax) > 0) {
|
||||
return fmt.Errorf("check: constant %v is not within bounds [%v..%v]", cv, lMin, lMax)
|
||||
}
|
||||
return nil
|
||||
@@ -951,7 +951,7 @@ func (q *checker) bcheckTypeExpr(n *a.TypeExpr) (*big.Int, *big.Int, error) {
|
||||
}
|
||||
|
||||
switch n.Decorator().Key() {
|
||||
case t.KeyPtr, t.KeyOpenBracket:
|
||||
case t.KeyPtr, t.KeyOpenBracket, t.KeyColon:
|
||||
return nil, nil, nil
|
||||
}
|
||||
switch n.Name().Key() {
|
||||
|
||||
+3
-5
@@ -925,11 +925,6 @@ swtch:
|
||||
}
|
||||
return fmt.Errorf("check: %q is not a type", n.Name().String(q.tm))
|
||||
|
||||
case t.KeyPtr:
|
||||
if err := q.tcheckTypeExpr(n.Inner(), depth); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
case t.KeyOpenBracket:
|
||||
aLen := n.ArrayLength()
|
||||
if err := q.tcheckExpr(aLen, 0); err != nil {
|
||||
@@ -938,6 +933,9 @@ swtch:
|
||||
if aLen.ConstValue() == nil {
|
||||
return fmt.Errorf("check: %q is not constant", aLen.String(q.tm))
|
||||
}
|
||||
fallthrough
|
||||
|
||||
case t.KeyPtr, t.KeyColon:
|
||||
if err := q.tcheckTypeExpr(n.Inner(), depth); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user