@@ -78,10 +78,6 @@ exports.writer = util.inspect;
7878exports . _builtinLibs = internalModule . builtinLibs ;
7979
8080
81- const BLOCK_SCOPED_ERROR = 'Block-scoped declarations (let, const, function, ' +
82- 'class) not yet supported outside strict mode' ;
83-
84-
8581class LineParser {
8682
8783 constructor ( ) {
@@ -266,7 +262,6 @@ function REPLServer(prompt,
266262 code = code . replace ( / \n $ / , '' ) ;
267263 code = preprocess ( code ) ;
268264
269- var retry = false ;
270265 var input = code ;
271266 var err , result , wrappedErr ;
272267 // first, create the Script object to check the syntax
@@ -277,9 +272,9 @@ function REPLServer(prompt,
277272 while ( true ) {
278273 try {
279274 if ( ! / ^ \s * $ / . test ( code ) &&
280- ( self . replMode === exports . REPL_MODE_STRICT || retry ) ) {
281- // "void 0" keeps the repl from returning "use strict" as the
282- // result value for let/const statements.
275+ self . replMode === exports . REPL_MODE_STRICT ) {
276+ // "void 0" keeps the repl from returning "use strict" as the result
277+ // value for statements and declarations that don't return a value .
283278 code = `'use strict'; void 0;\n${ code } ` ;
284279 }
285280 var script = vm . createScript ( code , {
@@ -288,17 +283,11 @@ function REPLServer(prompt,
288283 } ) ;
289284 } catch ( e ) {
290285 debug ( 'parse error %j' , code , e ) ;
291- if ( self . replMode === exports . REPL_MODE_MAGIC &&
292- e . message === BLOCK_SCOPED_ERROR &&
293- ! retry || self . wrappedCmd ) {
294- if ( self . wrappedCmd ) {
295- self . wrappedCmd = false ;
296- // unwrap and try again
297- code = `${ input . substring ( 1 , input . length - 2 ) } \n` ;
298- wrappedErr = e ;
299- } else {
300- retry = true ;
301- }
286+ if ( self . wrappedCmd ) {
287+ self . wrappedCmd = false ;
288+ // unwrap and try again
289+ code = `${ input . substring ( 1 , input . length - 2 ) } \n` ;
290+ wrappedErr = e ;
302291 continue ;
303292 }
304293 // preserve original error for wrapped command
0 commit comments