mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 00:52:18 +01:00
lang: refactor anticipating io_forget_history
This commit is contained in:
1 parent
c21cc95713
commit
e8af2d0635
5 files changed
+60
-44
No files matched your search
+13
-8
@@ -160,16 +160,21 @@ func (q *checker) tcheckStatement(n *a.Node) error {
|
||||
n.Keyword().Str(q.tm), n.IO().Str(q.tm), typ.Str(q.tm))
|
||||
}
|
||||
|
||||
arg1Typ := typeExprSliceU8
|
||||
if n.Keyword() == t.IDIOLimit {
|
||||
arg1Typ := (*a.TypeExpr)(nil)
|
||||
switch n.Keyword() {
|
||||
case t.IDIOBind:
|
||||
arg1Typ = typeExprSliceU8
|
||||
case t.IDIOLimit:
|
||||
arg1Typ = typeExprU64
|
||||
}
|
||||
if err := q.tcheckExpr(n.Arg1(), 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if typ := n.Arg1().MType(); !typ.EqIgnoringRefinementsLHSReadOnly(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))
|
||||
if arg1Typ != nil {
|
||||
if err := q.tcheckExpr(n.Arg1(), 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if typ := n.Arg1().MType(); !typ.EqIgnoringRefinementsLHSReadOnly(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))
|
||||
}
|
||||
}
|
||||
|
||||
if n.Keyword() == t.IDIOBind {
|
||||
|
||||
Reference in new issue
Block a user