Remove a dummy parameter hack

This commit is contained in:
Nigel Tao committed 2018-05-02 20:45:36 +10:00
1 parent dd18633a8a
commit bc9e91b9e9
4 files changed
+1 -53

No files matched your search

-9
View File
@@ -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;
-14
View File
@@ -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
-26
View File
@@ -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:
+1 -4
View File
@@ -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