From bc9e91b9e959e222f6f06e6e022dd0d4fa7e1e1b Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Wed, 2 May 2018 20:45:36 +1000 Subject: [PATCH] Remove a dummy parameter hack --- gen/c/std/gif.c | 9 --------- lang/check/bounds.go | 14 -------------- lang/check/type.go | 26 -------------------------- std/gif/decode_gif.wuffs | 5 +---- 4 files changed, 1 insertion(+), 53 deletions(-) diff --git a/gen/c/std/gif.c b/gen/c/std/gif.c index b4f7cbc6..c9f233a3 100644 --- a/gen/c/std/gif.c +++ b/gen/c/std/gif.c @@ -2930,11 +2930,6 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id( ? (b_rptr_src - a_src.private_impl.buf->ptr) : 0); { - if (a_src.private_impl.buf) { - size_t n = b_rptr_src - (a_src.private_impl.buf->ptr + - a_src.private_impl.buf->ri); - a_src.private_impl.buf->ri += n; - } if (a_src.private_impl.buf) { size_t n = b_rptr_src - (a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri); @@ -2946,10 +2941,6 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id( b_rptr_src = a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri; } - if (a_src.private_impl.buf) { - b_rptr_src = - a_src.private_impl.buf->ptr + a_src.private_impl.buf->ri; - } v_z = t_14; } a_src.private_impl.bounds[1] = o_0_bounds1_src; diff --git a/lang/check/bounds.go b/lang/check/bounds.go index d343d0a9..f8883d5e 100644 --- a/lang/check/bounds.go +++ b/lang/check/bounds.go @@ -814,20 +814,6 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (*big.Int, *big.Int, // TODO: should return be break? return nil, nil, nil } - // TODO: delete this hack that only matches "foo.decode(etc)". - if isThatMethod(q.tm, n, q.tm.ByName("decode"), 3) { - for _, o := range n.Args() { - a := o.Arg().Value() - aMin, aMax, err := q.bcheckExpr(a, depth) - if err != nil { - return nil, nil, err - } - // TODO: check that aMin and aMax is within the function's - // declared arg bounds. - _, _ = aMin, aMax - } - return nil, nil, nil - } if err := q.bcheckExprCall(n, depth); err != nil { return nil, nil, err diff --git a/lang/check/type.go b/lang/check/type.go index b683a3c9..ea645d74 100644 --- a/lang/check/type.go +++ b/lang/check/type.go @@ -453,32 +453,6 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error { case t.IDOpenParen, t.IDTry: // n is a function call. - - // TODO: be consistent about type-checking n.LHS().Expr() or - // n.LHS().Expr().LHS().Expr(). Doing this properly will probably - // require a TypeExpr being able to express function and method types. - - // TODO: delete this hack that only matches "foo.decode(etc)". - if idDecode := q.tm.ByName("decode"); isThatMethod(q.tm, n, idDecode, 3) { - foo := n.LHS().Expr().LHS().Expr() - if err := q.tcheckExpr(foo, depth); err != nil { - return err - } - n.LHS().SetTypeChecked() - n.LHS().Expr().SetMType(a.NewTypeExpr(t.IDFunc, 0, idDecode, foo.MType().Node(), nil, nil)) - for _, o := range n.Args() { - if err := q.tcheckArg(o.Arg(), nil, nil, depth); err != nil { - return err - } - } - if n.Operator() != t.IDTry { - return fmt.Errorf("TODO: foo.decode(etc) outside of a try statement") - } - // TODO: be more principled about inferring "try etc"'s type. - n.SetMType(typeExprStatus) - return nil - } - return q.tcheckExprCall(n, depth) case t.IDOpenBracket: diff --git a/std/gif/decode_gif.wuffs b/std/gif/decode_gif.wuffs index f610b60e..299eb2c7 100644 --- a/std/gif/decode_gif.wuffs +++ b/std/gif/decode_gif.wuffs @@ -314,10 +314,7 @@ pri func decoder.decode_id?(dst base.io_writer, src base.io_reader)() { in.src.mark() io_bind (in.src) { in.src.set_limit(l:block_size) - // TODO: remove the dummy param. It's needed for now so that - // writeSaveExprDerivedVars updates e.g. the b_rptr_src derived - // variables. - var z base.status = try this.lzw.decode?(dst:in.dst, src:in.src, dummy:in.src) + var z base.status = try this.lzw.decode?(dst:in.dst, src:in.src) } if z.is_ok() { break