Propagate const-values to idents of consts

This commit is contained in:
Nigel Tao committed 2020-04-16 09:37:05 +10:00
1 parent 9f6c40246f
commit 1f424b2ea7
3 files changed
+39 -49

No files matched your search

+1
View File
@@ -370,6 +370,7 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error {
// TODO: check somewhere that a global ident (i.e. a const) is
// not directly in the LHS of an assignment.
n.SetGlobalIdent()
n.SetConstValue(c.Value().ConstValue())
n.SetMType(c.XType())
return nil
}