mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 16:47:28 +01:00
Add a data:etc argument to io_bind
This commit is contained in:
1 parent
badbdfc487
commit
6d2bb77bb7
9 files changed
+77
-75
No files matched your search
@@ -237,12 +237,8 @@ func (q *checker) bcheckStatement(n *a.Node) error {
|
||||
if _, err := q.bcheckExpr(n.IO(), 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if n.Keyword() == t.IDIOBind {
|
||||
// No-op.
|
||||
} else {
|
||||
if _, err := q.bcheckExpr(n.Limit(), 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := q.bcheckExpr(n.Arg1(), 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := q.bcheckBlock(n.Body()); err != nil {
|
||||
return err
|
||||
|
||||
+11
-10
@@ -128,17 +128,18 @@ func (q *checker) tcheckStatement(n *a.Node) error {
|
||||
n.Keyword().Str(q.tm), n.IO().Str(q.tm), typ.Str(q.tm))
|
||||
}
|
||||
|
||||
if n.Keyword() == t.IDIOBind {
|
||||
// No-op.
|
||||
} else {
|
||||
if err := q.tcheckExpr(n.Limit(), 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if typ := n.Limit().MType(); !typ.Eq(typeExprU64) {
|
||||
return fmt.Errorf("check: %s expression %q, of type %q, does not have base.u64 type",
|
||||
n.Keyword().Str(q.tm), n.Limit().Str(q.tm), typ.Str(q.tm))
|
||||
}
|
||||
arg1Typ := typeExprSliceU8
|
||||
if n.Keyword() == t.IDIOLimit {
|
||||
arg1Typ = typeExprU64
|
||||
}
|
||||
if err := q.tcheckExpr(n.Arg1(), 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if typ := n.Arg1().MType(); !typ.Eq(arg1Typ) {
|
||||
return fmt.Errorf("check: %s expression %q, of type %q, does not have type %q",
|
||||
n.Keyword().Str(q.tm), n.Arg1().Str(q.tm), typ.Str(q.tm), arg1Typ.Str(q.tm))
|
||||
}
|
||||
|
||||
for _, o := range n.Body() {
|
||||
// TODO: prohibit jumps (breaks, continues), rets (returns, yields)
|
||||
// and retry-calling ? methods while inside an io_bind body.
|
||||
|
||||
Reference in new issue
Block a user