diff options
author | Rich Trott <rtrott@gmail.com> | 2016-04-05 17:17:33 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2016-04-08 13:58:48 -0700 |
commit | c5afd98b4868bb2f258a8125dd8447e3ccfba1c5 (patch) | |
tree | e71ac481defaaecc9f1250f6e3ba74cd7466828b /lib | |
parent | e67fee0fb54ddbc8685081f61ca92224fd8225f5 (diff) | |
download | android-node-v8-c5afd98b4868bb2f258a8125dd8447e3ccfba1c5.tar.gz android-node-v8-c5afd98b4868bb2f258a8125dd8447e3ccfba1c5.tar.bz2 android-node-v8-c5afd98b4868bb2f258a8125dd8447e3ccfba1c5.zip |
repl: refactor repl.js
There is some unnecessary logic in repl.js. Remove it.
PR-URL: https://github.com/nodejs/node/pull/6071
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/repl.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/repl.js b/lib/repl.js index a43ff42d8d..44aed66a6d 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -398,7 +398,6 @@ function REPLServer(prompt, self.on('line', function(cmd) { debug('line %j', cmd); sawSIGINT = false; - var skipCatchall = false; // leading whitespaces in template literals should not be trimmed. if (self._inTemplateLiteral) { @@ -417,11 +416,12 @@ function REPLServer(prompt, return; } else if (!self.bufferedCommand) { self.outputStream.write('Invalid REPL keyword\n'); - skipCatchall = true; + finish(null); + return; } } - if (!skipCatchall && (cmd || (!cmd && self.bufferedCommand))) { + if (cmd || self.bufferedCommand) { var evalCmd = self.bufferedCommand + cmd; if (/^\s*\{/.test(evalCmd) && /\}\s*$/.test(evalCmd)) { // It's confusing for `{ a : 1 }` to be interpreted as a block @@ -1022,7 +1022,7 @@ REPLServer.prototype.memory = function memory(cmd) { // self.lines.level.length === 0 // TODO? keep a log of level so that any syntax breaking lines can // be cleared on .break and in the case of a syntax error? - // TODO? if a log was kept, then I could clear the bufferedComand and + // TODO? if a log was kept, then I could clear the bufferedCommand and // eval these lines and throw the syntax error } else { self.lines.level = []; |