-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More accurately emulating node's REPL behaviour with regard to
_
assignment. Also addresses `i for i in [1..3]` regression introduced by fff4c9c and noticed by @satyr
- Loading branch information
1 parent
60e51a2
commit b9c3e0e
Showing
2 changed files
with
11 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,10 +101,11 @@ exports.eval = (code, options = {}) -> | |
o = {} | ||
o[k] = v for own k, v of options | ||
o.bare = on # ensure return value | ||
js = compile "(#{code}\n)", o | ||
_ = Script.runInContext js, sandbox | ||
sandbox._ = _ if _? | ||
_ | ||
js = compile "_=(#{code}\n)", o | ||
_ = sandbox._ | ||
returnValue = Script.runInContext js, sandbox | ||
sandbox._ = _ if returnValue is undefined | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
satyr
Collaborator
|
||
returnValue | ||
|
||
# Instantiate a Lexer for our use here. | ||
lexer = new Lexer | ||
|
isnt