diff options
author | Araq <rumpf_a@web.de> | 2014-03-13 02:52:51 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-03-13 02:52:51 +0100 |
commit | 1c35fb3c89bbac393b50c4bc6fe8205af2b7fb9d (patch) | |
tree | 6f72beee37e3873a1434e10e8bb0fd156acdef78 /compiler/sem.nim | |
parent | 2fc84325c7cfba82c54c652a5f1a795845b169a9 (diff) | |
parent | d2f130c3fc1ffa786e8d323c3cd3c51fd45124da (diff) | |
download | Nim-1c35fb3c89bbac393b50c4bc6fe8205af2b7fb9d.tar.gz |
Merge branch 'devel' of https://github.com/Araq/Nimrod into devel
Diffstat (limited to 'compiler/sem.nim')
-rw-r--r-- | compiler/sem.nim | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim index c8228618b..093fc9452 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -219,14 +219,26 @@ proc tryConstExpr(c: PContext, n: PNode): PNode = result = getConstExpr(c.module, e) if result != nil: return + let oldErrorCount = msgs.gErrorCounter + let oldErrorMax = msgs.gErrorMax + let oldErrorOutputs = errorOutputs + + errorOutputs = {} + msgs.gErrorMax = high(int) + try: result = evalConstExpr(c.module, e) if result == nil or result.kind == nkEmpty: - return nil + result = nil + else: + result = fixupTypeAfterEval(c, result, e) - result = fixupTypeAfterEval(c, result, e) except ERecoverableError: - return nil + result = nil + + msgs.gErrorCounter = oldErrorCount + msgs.gErrorMax = oldErrorMax + errorOutputs = oldErrorOutputs proc semConstExpr(c: PContext, n: PNode): PNode = var e = semExprWithType(c, n) |