1
0
forked from Mirror/wren

Merge pull request #513 from snocl/replfix

Fix REPL being broken by latest commit
This commit is contained in:
Bob Nystrom
2018-03-19 14:08:04 -07:00
committed by GitHub
2 changed files with 12 additions and 18 deletions

View File

@ -11,11 +11,6 @@ class Repl {
_history = []
_historyIndex = 0
// Whether or not we allow ASCI escape sequences for showing colors and
// moving the cursor. When this is false, the REPL has reduced
// functionality.
_allowAnsi = false
}
cursor { _cursor }
@ -172,15 +167,17 @@ class Repl {
token.type == Token.varKeyword ||
token.type == Token.whileKeyword
var fiber
var closure
if (isStatement) {
fiber = Meta.compile(input)
closure = Meta.compile(input)
} else {
fiber = Meta.compileExpression(input)
closure = Meta.compileExpression(input)
}
// Stop if there was a compile error.
if (fiber == null) return
if (closure == null) return
var fiber = Fiber.new(closure)
var result = fiber.try()
if (fiber.error != null) {

View File

@ -13,11 +13,6 @@ static const char* replModuleSource =
"\n"
" _history = []\n"
" _historyIndex = 0\n"
"\n"
" // Whether or not we allow ASCI escape sequences for showing colors and\n"
" // moving the cursor. When this is false, the REPL has reduced\n"
" // functionality.\n"
" _allowAnsi = false\n"
" }\n"
"\n"
" cursor { _cursor }\n"
@ -174,15 +169,17 @@ static const char* replModuleSource =
" token.type == Token.varKeyword ||\n"
" token.type == Token.whileKeyword\n"
"\n"
" var fiber\n"
" var closure\n"
" if (isStatement) {\n"
" fiber = Meta.compile(input)\n"
" closure = Meta.compile(input)\n"
" } else {\n"
" fiber = Meta.compileExpression(input)\n"
" closure = Meta.compileExpression(input)\n"
" }\n"
"\n"
" // Stop if there was a compile error.\n"
" if (fiber == null) return\n"
" if (closure == null) return\n"
"\n"
" var fiber = Fiber.new(closure)\n"
"\n"
" var result = fiber.try()\n"
" if (fiber.error != null) {\n"