mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
small REPL improvements
This commit is contained in:
@@ -1532,10 +1532,11 @@ var oldErrorCount: int
|
||||
|
||||
proc myProcess(c: PPassContext, n: PNode): PNode =
|
||||
# don't eval errornous code:
|
||||
if oldErrorCount != msgs.gErrorCounter:
|
||||
oldErrorCount = msgs.gErrorCounter
|
||||
return n
|
||||
result = eval(PEvalContext(c), n)
|
||||
if oldErrorCount == msgs.gErrorCounter:
|
||||
result = eval(PEvalContext(c), n)
|
||||
else:
|
||||
result = n
|
||||
oldErrorCount = msgs.gErrorCounter
|
||||
|
||||
const evalPass* = makePass(myOpen, nil, myProcess, myProcess)
|
||||
|
||||
|
||||
@@ -91,7 +91,8 @@ proc errorSym*(c: PContext, n: PNode): PSym =
|
||||
result.typ = errorType(c)
|
||||
incl(result.flags, sfDiscardable)
|
||||
# pretend it's imported from some unknown module to prevent cascading errors:
|
||||
c.importTable.addSym(result)
|
||||
if gCmd != cmdInteractive:
|
||||
c.importTable.addSym(result)
|
||||
|
||||
type
|
||||
TOverloadIterMode* = enum
|
||||
|
||||
Reference in New Issue
Block a user