infer static parameters even when more complicated arithmetic is involved

This commit is contained in:
Zahary Karadjov 2016-08-12 03:25:59 +03:00
commit 0f2c4be129
10 changed files with 139 additions and 48 deletions

View file

@ -627,6 +627,7 @@ proc evalAtCompileTime(c: PContext, n: PNode): PNode =
proc semStaticExpr(c: PContext, n: PNode): PNode =
let a = semExpr(c, n.sons[0])
if a.findUnresolvedStatic != nil: return a
result = evalStaticExpr(c.module, c.cache, a, c.p.owner)
if result.isNil:
localError(n.info, errCannotInterpretNodeX, renderTree(n))