mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
bugfix: 'nimrod i' works again
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -202,3 +202,7 @@ proc compileSpecialTests(r: var TResults, options: string) =
|
||||
compileDLLTests(r, options)
|
||||
compileDebuggerTests(r, options)
|
||||
|
||||
var given = callCompiler("nimrod i", "nimrod i", options)
|
||||
r.addResult("nimrod i", given.msg, if given.err: reFailure else: reSuccess)
|
||||
if not given.err: inc(r.passed)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user