Add io_bind history_position arg

This commit is contained in:
Nigel Tao committed 2021-08-15 08:36:14 +10:00
1 parent b60a2cacd9
commit 28a54baa19
11 files changed
+87 -24

No files matched your search

+5
View File
@@ -258,6 +258,11 @@ func (q *checker) bcheckStatement(n *a.Node) error {
if _, err := q.bcheckExpr(n.Arg1(), 0); err != nil {
return err
}
if histPos := n.HistoryPosition(); histPos != nil {
if _, err := q.bcheckExpr(histPos, 0); err != nil {
return err
}
}
if err := q.bcheckBlock(n.Body()); err != nil {
return err
}
+10
View File
@@ -171,6 +171,16 @@ func (q *checker) tcheckStatement(n *a.Node) error {
n.Keyword().Str(q.tm), n.Arg1().Str(q.tm), typ.Str(q.tm), arg1Typ.Str(q.tm))
}
if n.Keyword() == t.IDIOBind {
if err := q.tcheckExpr(n.HistoryPosition(), 0); err != nil {
return err
}
if typ := n.HistoryPosition().MType(); !typ.IsIdeal() && !typ.EqIgnoringRefinements(typeExprU64) {
return fmt.Errorf("check: %s expression %q, of type %q, does not have type %q",
n.Keyword().Str(q.tm), n.HistoryPosition().Str(q.tm), typ.Str(q.tm), typeExprU64.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.