@@ -222,6 +222,10 @@ function REPLServer(prompt,
222222  function  defaultEval ( code ,  context ,  file ,  cb )  { 
223223    var  err ,  result ,  retry  =  false ,  input  =  code ,  wrappedErr ; 
224224    // first, create the Script object to check the syntax 
225+ 
226+     if  ( code  ===  '\n' ) 
227+       return  cb ( null ) ; 
228+ 
225229    while  ( true )  { 
226230      try  { 
227231        if  ( ! / ^ \s * $ / . test ( code )  && 
@@ -419,28 +423,24 @@ function REPLServer(prompt,
419423      } 
420424    } 
421425
422-     if  ( cmd  ||  self . bufferedCommand )  { 
423-       var  evalCmd  =  self . bufferedCommand  +  cmd ; 
424-       if  ( / ^ \s * \{ / . test ( evalCmd )  &&  / \} \s * $ / . test ( evalCmd ) )  { 
425-         // It's confusing for `{ a : 1 }` to be interpreted as a block 
426-         // statement rather than an object literal.  So, we first try 
427-         // to wrap it in parentheses, so that it will be interpreted as 
428-         // an expression. 
429-         evalCmd  =  '('  +  evalCmd  +  ')\n' ; 
430-         self . wrappedCmd  =  true ; 
431-       }  else  { 
432-         // otherwise we just append a \n so that it will be either 
433-         // terminated, or continued onto the next expression if it's an 
434-         // unexpected end of input. 
435-         evalCmd  =  evalCmd  +  '\n' ; 
436-       } 
437- 
438-       debug ( 'eval %j' ,  evalCmd ) ; 
439-       self . eval ( evalCmd ,  self . context ,  'repl' ,  finish ) ; 
426+     var  evalCmd  =  self . bufferedCommand  +  cmd ; 
427+     if  ( / ^ \s * \{ / . test ( evalCmd )  &&  / \} \s * $ / . test ( evalCmd ) )  { 
428+       // It's confusing for `{ a : 1 }` to be interpreted as a block 
429+       // statement rather than an object literal.  So, we first try 
430+       // to wrap it in parentheses, so that it will be interpreted as 
431+       // an expression. 
432+       evalCmd  =  '('  +  evalCmd  +  ')\n' ; 
433+       self . wrappedCmd  =  true ; 
440434    }  else  { 
441-       finish ( null ) ; 
435+       // otherwise we just append a \n so that it will be either 
436+       // terminated, or continued onto the next expression if it's an 
437+       // unexpected end of input. 
438+       evalCmd  =  evalCmd  +  '\n' ; 
442439    } 
443440
441+     debug ( 'eval %j' ,  evalCmd ) ; 
442+     self . eval ( evalCmd ,  self . context ,  'repl' ,  finish ) ; 
443+ 
444444    function  finish ( e ,  ret )  { 
445445      debug ( 'finish' ,  e ,  ret ) ; 
446446      self . memory ( cmd ) ; 
0 commit comments