Remove unused checker.exprConstValue method

This commit is contained in:
Nigel Tao committed 2020-06-10 11:43:46 +10:00
1 parent 74d291453d
commit 7dc73a856a
1 file changed
+2 -17
+2 -17
View File
@@ -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,