@@ -396,7 +396,6 @@ function REPLServer(prompt,
396396 self . on ( 'line' , function ( cmd ) {
397397 debug ( 'line %j' , cmd ) ;
398398 sawSIGINT = false ;
399- var skipCatchall = false ;
400399
401400 // leading whitespaces in template literals should not be trimmed.
402401 if ( self . _inTemplateLiteral ) {
@@ -415,11 +414,12 @@ function REPLServer(prompt,
415414 return ;
416415 } else if ( ! self . bufferedCommand ) {
417416 self . outputStream . write ( 'Invalid REPL keyword\n' ) ;
418- skipCatchall = true ;
417+ finish ( null ) ;
418+ return ;
419419 }
420420 }
421421
422- if ( ! skipCatchall && ( cmd || ( ! cmd && self . bufferedCommand ) ) ) {
422+ if ( cmd || self . bufferedCommand ) {
423423 var evalCmd = self . bufferedCommand + cmd ;
424424 if ( / ^ \s * \{ / . test ( evalCmd ) && / \} \s * $ / . test ( evalCmd ) ) {
425425 // It's confusing for `{ a : 1 }` to be interpreted as a block
@@ -1002,7 +1002,7 @@ REPLServer.prototype.memory = function memory(cmd) {
10021002 // self.lines.level.length === 0
10031003 // TODO? keep a log of level so that any syntax breaking lines can
10041004 // be cleared on .break and in the case of a syntax error?
1005- // TODO? if a log was kept, then I could clear the bufferedComand and
1005+ // TODO? if a log was kept, then I could clear the bufferedCommand and
10061006 // eval these lines and throw the syntax error
10071007 } else {
10081008 self . lines . level = [ ] ;
0 commit comments