mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 00:52:18 +01:00
Remove the obsolete limit method
This commit is contained in:
1 parent
b9b398dc9a
commit
c71a13e20e
4 files changed
+6
-23
No files matched your search
@@ -158,9 +158,6 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
|
|||||||
b.writes(")")
|
b.writes(")")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if isInSrc(g.tm, n, t.IDLimit, 1) {
|
|
||||||
return fmt.Errorf(`TODO: cgen an "in.src.limit" expression`)
|
|
||||||
}
|
|
||||||
if isInSrc(g.tm, n, t.IDSetLimit, 1) {
|
if isInSrc(g.tm, n, t.IDSetLimit, 1) {
|
||||||
b.printf("wuffs_base__io_reader__set_limit_internal(&%ssrc,", aPrefix)
|
b.printf("wuffs_base__io_reader__set_limit_internal(&%ssrc,", aPrefix)
|
||||||
if err := g.writeExpr(b, n.Args()[0].Arg().Value(), rp, parenthesesOptional, depth); err != nil {
|
if err := g.writeExpr(b, n.Args()[0].Arg().Value(), rp, parenthesesOptional, depth); err != nil {
|
||||||
@@ -182,9 +179,6 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
|
|||||||
aPrefix, bPrefix, aPrefix)
|
aPrefix, bPrefix, aPrefix)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if isInDst(g.tm, n, t.IDLimit, 1) {
|
|
||||||
return fmt.Errorf(`TODO: cgen an "in.dst.limit" expression`)
|
|
||||||
}
|
|
||||||
if isInDst(g.tm, n, t.IDMark, 0) {
|
if isInDst(g.tm, n, t.IDMark, 0) {
|
||||||
// TODO: is a private_impl.bounds[0] the right representation? What
|
// TODO: is a private_impl.bounds[0] the right representation? What
|
||||||
// if the function is passed a (ptr io_writer) instead of a
|
// if the function is passed a (ptr io_writer) instead of a
|
||||||
@@ -327,9 +321,6 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare
|
|||||||
b.writes(")\n")
|
b.writes(")\n")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if isThatMethod(g.tm, n, t.IDLimit, 1) {
|
|
||||||
return fmt.Errorf(`TODO: cgen a "foo.limit" expression`)
|
|
||||||
}
|
|
||||||
if isThatMethod(g.tm, n, t.IDMark, 0) {
|
if isThatMethod(g.tm, n, t.IDMark, 0) {
|
||||||
// TODO: don't hard-code v_r or b_rptr_src.
|
// TODO: don't hard-code v_r or b_rptr_src.
|
||||||
b.printf("wuffs_base__io_reader__mark(&v_r, b_rptr_src)")
|
b.printf("wuffs_base__io_reader__mark(&v_r, b_rptr_src)")
|
||||||
|
|||||||
@@ -850,8 +850,7 @@ func (g *gen) writeReadUXX(b *buffer, n *a.Expr, name string, size uint32, endia
|
|||||||
func isInSrc(tm *t.Map, n *a.Expr, methodName t.ID, nArgs int) bool {
|
func isInSrc(tm *t.Map, n *a.Expr, methodName t.ID, nArgs int) bool {
|
||||||
callSuspendible := methodName != t.IDSinceMark &&
|
callSuspendible := methodName != t.IDSinceMark &&
|
||||||
methodName != t.IDMark &&
|
methodName != t.IDMark &&
|
||||||
methodName != t.IDSetLimit &&
|
methodName != t.IDSetLimit
|
||||||
methodName != t.IDLimit
|
|
||||||
if n.Operator() != t.IDOpenParen || n.CallSuspendible() != callSuspendible || len(n.Args()) != nArgs {
|
if n.Operator() != t.IDOpenParen || n.CallSuspendible() != callSuspendible || len(n.Args()) != nArgs {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -873,8 +872,7 @@ func isInDst(tm *t.Map, n *a.Expr, methodName t.ID, nArgs int) bool {
|
|||||||
methodName != t.IDCopyFromSlice32 &&
|
methodName != t.IDCopyFromSlice32 &&
|
||||||
methodName != t.IDCopyFromSlice &&
|
methodName != t.IDCopyFromSlice &&
|
||||||
methodName != t.IDSinceMark &&
|
methodName != t.IDSinceMark &&
|
||||||
methodName != t.IDMark &&
|
methodName != t.IDMark
|
||||||
methodName != t.IDLimit
|
|
||||||
// TODO: check that n.Args() is "(x:bar)".
|
// TODO: check that n.Args() is "(x:bar)".
|
||||||
if n.Operator() != t.IDOpenParen || n.CallSuspendible() != callSuspendible || len(n.Args()) != nArgs {
|
if n.Operator() != t.IDOpenParen || n.CallSuspendible() != callSuspendible || len(n.Args()) != nArgs {
|
||||||
return false
|
return false
|
||||||
|
|||||||
+2
-4
@@ -409,11 +409,10 @@ const (
|
|||||||
IDAvailable = ID(0xCA)
|
IDAvailable = ID(0xCA)
|
||||||
IDPrefix = ID(0xCB)
|
IDPrefix = ID(0xCB)
|
||||||
IDSuffix = ID(0xCC)
|
IDSuffix = ID(0xCC)
|
||||||
IDLimit = ID(0xCD)
|
IDSetLimit = ID(0xCD)
|
||||||
IDLowBits = ID(0xCE)
|
IDLowBits = ID(0xCE)
|
||||||
IDHighBits = ID(0xCF)
|
IDHighBits = ID(0xCF)
|
||||||
IDUnreadU8 = ID(0xD0)
|
IDUnreadU8 = ID(0xD0)
|
||||||
IDSetLimit = ID(0xD1)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var builtInsByID = [nBuiltInIDs]string{
|
var builtInsByID = [nBuiltInIDs]string{
|
||||||
@@ -583,11 +582,10 @@ var builtInsByID = [nBuiltInIDs]string{
|
|||||||
IDAvailable: "available",
|
IDAvailable: "available",
|
||||||
IDPrefix: "prefix",
|
IDPrefix: "prefix",
|
||||||
IDSuffix: "suffix",
|
IDSuffix: "suffix",
|
||||||
IDLimit: "limit",
|
IDSetLimit: "set_limit",
|
||||||
IDLowBits: "low_bits",
|
IDLowBits: "low_bits",
|
||||||
IDHighBits: "high_bits",
|
IDHighBits: "high_bits",
|
||||||
IDUnreadU8: "unread_u8",
|
IDUnreadU8: "unread_u8",
|
||||||
IDSetLimit: "set_limit",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var builtInsByName = map[string]ID{}
|
var builtInsByName = map[string]ID{}
|
||||||
|
|||||||
@@ -310,8 +310,7 @@ pri func decoder.decode_id?(dst base.io_writer, src base.io_reader)() {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
while true {
|
while true {
|
||||||
// TODO: should "mark" be "set_mark" or "set_mark_here"? Unlike
|
// TODO: should "mark" be "set_mark" or "set_mark_here"?
|
||||||
// "limit", "mark" does not return a different io_reader.
|
|
||||||
in.src.mark()
|
in.src.mark()
|
||||||
io_bind (in.src) {
|
io_bind (in.src) {
|
||||||
in.src.set_limit(l:block_size)
|
in.src.set_limit(l:block_size)
|
||||||
@@ -319,10 +318,7 @@ pri func decoder.decode_id?(dst base.io_writer, src base.io_reader)() {
|
|||||||
// TODO: remove the dummy param. It's needed for now so that
|
// TODO: remove the dummy param. It's needed for now so that
|
||||||
// writeSaveExprDerivedVars updates e.g. the b_rptr_src derived
|
// writeSaveExprDerivedVars updates e.g. the b_rptr_src derived
|
||||||
// variables.
|
// variables.
|
||||||
//
|
var z base.status = try this.lzw.decode?(dst:in.dst, src:r, dummy:in.src)
|
||||||
// TODO: enforce that limit can only be called in a "foo?"
|
|
||||||
// call?
|
|
||||||
var z base.status = try this.lzw.decode?(dst:in.dst, src:r.limit(l:block_size), dummy:in.src)
|
|
||||||
}
|
}
|
||||||
if z.is_ok() {
|
if z.is_ok() {
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in new issue
Block a user