This commit is contained in:
Araq 2014-11-27 08:36:58 +01:00
commit 7edf6fc1d2
3 changed files with 20 additions and 2 deletions

View file

@ -117,7 +117,9 @@ proc isDeepConstExpr*(n: PNode): bool =
of nkCurly, nkBracket, nkPar, nkObjConstr, nkClosure:
for i in 0 .. <n.len:
if not isDeepConstExpr(n.sons[i]): return false
result = true
# XXX once constant objects are supported by the codegen this needs to be
# weakened:
result = n.typ.isNil or n.typ.skipTypes({tyGenericInst, tyDistinct}).kind != tyObject
else: discard
proc flattenTreeAux(d, a: PNode, op: TMagic) =