Drop the "?" from "copy_from32?".

Also add a PUFFS_COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND macro.

Also add a loop to decoder.decode, as the code generator was previously
(incorrectly) not generating a coro_susp_point at the end of the
function.
This commit is contained in:
Nigel Tao committed 2017-10-07 14:34:31 +11:00
1 parent 0e09aa8c10
commit 585ea2024d
10 files changed
+218 -134

No files matched your search

+4 -2
View File
@@ -388,7 +388,7 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
n.SetMType(typeExprPlaceholder16) // HACK.
} else if isInDst(q.tm, n, t.KeySlice, 0) {
n.SetMType(typeExprSliceU8) // HACK.
} else if isInDst(q.tm, n, t.KeyCopyHistory32, 2) {
} else if isInDst(q.tm, n, t.KeyCopyFrom32, 2) || isInDst(q.tm, n, t.KeyCopyHistory32, 2) {
n.SetMType(typeExprU32) // HACK.
} else {
n.SetMType(typeExprPlaceholder) // HACK.
@@ -603,7 +603,9 @@ func isInSrc(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool {
}
func isInDst(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool {
callSuspendible := methodName != t.KeyCopyHistory32 && methodName != t.KeySlice
callSuspendible := methodName != t.KeyCopyFrom32 &&
methodName != t.KeyCopyHistory32 &&
methodName != t.KeySlice
// TODO: check that n.Args() is "(x:bar)".
if n.ID0().Key() != t.KeyOpenParen || n.CallSuspendible() != callSuspendible || len(n.Args()) != nArgs {
return false