mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 16:47:28 +01:00
Remove a dummy parameter hack
This commit is contained in:
1 parent
dd18633a8a
commit
bc9e91b9e9
4 files changed
+1
-53
No files matched your search
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user