bugfix: 'nimrod i' works again
This commit is contained in:
parent
9b8afc9321
commit
cb6ad8cb74
3 changed files with 10 additions and 5 deletions
|
|
@ -215,6 +215,8 @@ proc SemStmtAndGenerateGenerics(c: PContext, n: PNode): PNode =
|
||||||
if result.kind != nkEmpty: addSon(a, result)
|
if result.kind != nkEmpty: addSon(a, result)
|
||||||
result = a
|
result = a
|
||||||
result = hloStmt(c, result)
|
result = hloStmt(c, result)
|
||||||
|
if gCmd == cmdInteractive and not isEmptyType(result.typ):
|
||||||
|
result = buildEchoStmt(c, result)
|
||||||
result = transformStmt(c.module, result)
|
result = transformStmt(c.module, result)
|
||||||
|
|
||||||
proc RecoverContext(c: PContext) =
|
proc RecoverContext(c: PContext) =
|
||||||
|
|
|
||||||
|
|
@ -712,13 +712,12 @@ proc semExprNoType(c: PContext, n: PNode): PNode =
|
||||||
sfDiscardable in n.sons[0].sym.flags
|
sfDiscardable in n.sons[0].sym.flags
|
||||||
result = semExpr(c, n, {efWantStmt})
|
result = semExpr(c, n, {efWantStmt})
|
||||||
if result.typ != nil and result.typ.kind notin {tyStmt, tyEmpty}:
|
if result.typ != nil and result.typ.kind notin {tyStmt, tyEmpty}:
|
||||||
if gCmd == cmdInteractive:
|
if result.kind == nkNilLit:
|
||||||
result = buildEchoStmt(c, result)
|
|
||||||
elif result.kind == nkNilLit:
|
|
||||||
# XXX too much work and fixing would break bootstrapping:
|
# XXX too much work and fixing would break bootstrapping:
|
||||||
#Message(n.info, warnNilStatement)
|
#Message(n.info, warnNilStatement)
|
||||||
result.typ = nil
|
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)
|
localError(n.info, errDiscardValue)
|
||||||
|
|
||||||
proc isTypeExpr(n: PNode): bool =
|
proc isTypeExpr(n: PNode): bool =
|
||||||
|
|
|
||||||
|
|
@ -202,3 +202,7 @@ proc compileSpecialTests(r: var TResults, options: string) =
|
||||||
compileDLLTests(r, options)
|
compileDLLTests(r, options)
|
||||||
compileDebuggerTests(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)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue