diff options
author | Araq <rumpf_a@web.de> | 2012-09-18 20:59:14 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-09-18 20:59:14 +0200 |
commit | cb6ad8cb745f3d458a28e0b0738d50e5390ed3bb (patch) | |
tree | f4bd178df83f7ffb501966b727efc64d6bffdaa9 /compiler | |
parent | 9b8afc9321e53f270c13418d9aa18ebc1e9d40f4 (diff) | |
download | Nim-cb6ad8cb745f3d458a28e0b0738d50e5390ed3bb.tar.gz |
bugfix: 'nimrod i' works again
Diffstat (limited to 'compiler')
-rwxr-xr-x | compiler/sem.nim | 4 | ||||
-rwxr-xr-x | compiler/semexprs.nim | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim index d13609b8a..16dd2d107 100755 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -215,8 +215,10 @@ proc SemStmtAndGenerateGenerics(c: PContext, n: PNode): PNode = if result.kind != nkEmpty: addSon(a, result) result = a result = hloStmt(c, result) + if gCmd == cmdInteractive and not isEmptyType(result.typ): + result = buildEchoStmt(c, result) result = transformStmt(c.module, result) - + proc RecoverContext(c: PContext) = # clean up in case of a semantic error: We clean up the stacks, etc. This is # faster than wrapping every stack operation in a 'try finally' block and diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 3c630eeec..a08d50307 100755 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -712,13 +712,12 @@ proc semExprNoType(c: PContext, n: PNode): PNode = sfDiscardable in n.sons[0].sym.flags result = semExpr(c, n, {efWantStmt}) if result.typ != nil and result.typ.kind notin {tyStmt, tyEmpty}: - if gCmd == cmdInteractive: - result = buildEchoStmt(c, result) - elif result.kind == nkNilLit: + if result.kind == nkNilLit: # XXX too much work and fixing would break bootstrapping: #Message(n.info, warnNilStatement) result.typ = nil - elif not ImplicitelyDiscardable(result) and result.typ.kind != tyError: + elif not ImplicitelyDiscardable(result) and result.typ.kind != tyError and + gCmd != cmdInteractive: localError(n.info, errDiscardValue) proc isTypeExpr(n: PNode): bool = |