mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 08:55:11 +01:00
Add a slice.length method.
This commit is contained in:
1 parent
fda696bf95
commit
51f2b183a2
7 files changed
+57
-6
No files matched your search
@@ -144,6 +144,21 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if isLength(g.tm, n) {
|
||||
if pp == parenthesesMandatory {
|
||||
b.writeb('(')
|
||||
}
|
||||
b.writes("(uint64_t)(")
|
||||
x := n.LHS().Expr().LHS().Expr()
|
||||
if err := g.writeExpr(b, x, rp, parenthesesMandatory, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
b.writes(".len)")
|
||||
if pp == parenthesesMandatory {
|
||||
b.writeb(')')
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// TODO.
|
||||
|
||||
case t.KeyOpenBracket:
|
||||
|
||||
Reference in new issue
Block a user