mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 08:47:28 +01:00
Add built-in slice functions
This commit is contained in:
1 parent
333b11dc65
commit
339673ae82
8 files changed
+120
-45
No files matched your search
@@ -365,7 +365,7 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
|
||||
if err := g.writeExpr(b, n.LHS().Expr(), rp, parenthesesMandatory, depth); err != nil {
|
||||
return err
|
||||
}
|
||||
if lTyp := n.LHS().Expr().MType(); lTyp.Decorator().Key() == t.KeyColon {
|
||||
if lTyp := n.LHS().Expr().MType(); lTyp.IsSliceType() {
|
||||
// TODO: don't assume that the slice is a slice of u8.
|
||||
b.writes(".ptr")
|
||||
}
|
||||
@@ -521,7 +521,7 @@ func (g *gen) writeCTypeName(b *buffer, n *a.TypeExpr, varNamePrefix string, var
|
||||
|
||||
// TODO: fix this, allow slices of all types, not just of u8's. Also allow
|
||||
// arrays of slices, slices of pointers, etc.
|
||||
if n.Decorator().Key() == t.KeyColon {
|
||||
if n.IsSliceType() {
|
||||
o := n.Inner()
|
||||
if o.Decorator() == 0 && o.Name().Key() == t.KeyU8 && !o.IsRefined() {
|
||||
b.writes("wuffs_base__slice_u8")
|
||||
|
||||
@@ -295,7 +295,7 @@ func (g *gen) writeStatement(b *buffer, n *a.Node, depth uint32) error {
|
||||
if err := g.writeExpr(b, v, replaceCallSuspendibles, parenthesesMandatory, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
} else if n.XType().Decorator().Key() == t.KeyColon {
|
||||
} else if n.XType().IsSliceType() {
|
||||
// TODO: don't assume that the slice is a slice of u8.
|
||||
b.printf("((wuffs_base__slice_u8){})")
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user