Make writer1.slice's args implicitly (start, ptr).

This commit is contained in:
Nigel Tao committed 2017-10-02 13:52:34 +11:00
1 parent fcf1f2b5ae
commit 4aa9fce311
5 files changed
+13 -24

No files matched your search

+3 -9
View File
@@ -158,15 +158,9 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
}
return nil
}
if isInDst(g.tm, n, t.KeySlice, 2) {
b.printf("puffs_base_make_slice_u8_from_ptrs(%sdst.buf ? %sdst.buf->ptr : NULL,", aPrefix, aPrefix)
for _, o := range n.Args() {
if err := g.writeExpr(b, o.Arg().Value(), rp, parenthesesOptional, depth); err != nil {
return err
}
b.writes(".ptr,")
}
b.printf("%sdst.buf ? %swptr_dst : NULL)", aPrefix, bPrefix)
if isInDst(g.tm, n, t.KeySlice, 0) {
b.printf("((puffs_base_slice_u8){ .ptr = %swstart_dst, .len = %swptr_dst - %swstart_dst, })",
bPrefix, bPrefix, bPrefix)
return nil
}
if isThatMethod(g.tm, n, t.KeyCopyFrom, 1) {