From 7dc73a856a163aec0fc93f0b64ab94a2fcb7e7c4 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Wed, 10 Jun 2020 11:43:46 +1000 Subject: [PATCH] Remove unused checker.exprConstValue method --- lang/check/type.go | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/lang/check/type.go b/lang/check/type.go index ac99f25f..648b622f 100644 --- a/lang/check/type.go +++ b/lang/check/type.go @@ -1018,7 +1018,7 @@ swtch: if err := q.tcheckExpr(b, 0); err != nil { return err } - if q.exprConstValue(b) == nil { + if b.ConstValue() == nil { return fmt.Errorf("check: %q is not constant", b.Str(q.tm)) } } @@ -1044,7 +1044,7 @@ swtch: if err := q.tcheckExpr(aLen, 0); err != nil { return err } - if q.exprConstValue(aLen) == nil { + if aLen.ConstValue() == nil { return fmt.Errorf("check: %q is not constant", aLen.Str(q.tm)) } fallthrough @@ -1061,21 +1061,6 @@ swtch: return nil } -func (q *checker) exprConstValue(n *a.Expr) *big.Int { - if cv := n.ConstValue(); cv != nil { - return cv - } - if n.Operator() == 0 { - if c, ok := q.c.consts[t.QID{0, n.Ident()}]; ok { - if cv := c.Value().ConstValue(); cv != nil { - n.SetConstValue(cv) - return cv - } - } - } - return nil -} - var comparisonOps = [...]bool{ t.IDXBinaryNotEq: true, t.IDXBinaryLessThan: true,