Add a writer1.is_marked method.

This commit is contained in:
Nigel Tao committed 2017-11-09 10:38:24 +11:00
1 parent 545f043d94
commit e2ce9f1b1d
7 files changed
+38 -5

No files matched your search

+11
View File
@@ -185,6 +185,7 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
aPrefix, aPrefix, bPrefix, aPrefix)
return nil
}
// TODO: reader1.is_marked, not just writer1.is_marked?
if isInDst(g.tm, n, t.KeyLimit, 1) {
return fmt.Errorf(`TODO: cgen an "in.dst.limit" expression`)
}
@@ -203,6 +204,16 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
aPrefix, aPrefix, bPrefix, aPrefix)
return nil
}
if isInDst(g.tm, n, t.KeyIsMarked, 0) {
if pp == parenthesesMandatory {
b.writeb('(')
}
b.printf("%sdst.private_impl.mark != NULL", aPrefix)
if pp == parenthesesMandatory {
b.writeb(')')
}
return nil
}
if isInDst(g.tm, n, t.KeyCopyFromReader32, 2) {
b.printf("puffs_base__writer1__copy_from_reader32(&%swptr_dst, %swend_dst", bPrefix, bPrefix)
// TODO: don't assume that the first argument is "in.src".
+1
View File
@@ -785,6 +785,7 @@ func isInDst(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool {
methodName != t.KeyCopyFromSlice32 &&
methodName != t.KeyCopyFromSlice &&
methodName != t.KeySinceMark &&
methodName != t.KeyIsMarked &&
methodName != t.KeyMark &&
methodName != t.KeyLimit
// TODO: check that n.Args() is "(x:bar)".