Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Unexpected token SyntaxError doesn't trigger multi-line input anymore #8874

Closed
@misterdjules

Description

With node 0.10.x, it is possible to trigger multi-line input with an 'Unexpected token' syntax error:

$ node --version
v0.10.33
$ node
> var foo = 'foo \
... bar';
undefined
> foo
'foo bar'
> 

I'm not sure this is a desirable feature, since it also triggers multi-line input on 'Unexpected token' syntax errors from which it seems impossible to recover:

> % foo
...

However, the behavior is different with node 0.11.x. An 'Unexpected token' syntax error doesn't trigger multi-line input anymore, and instead the SyntaxError bubbles up:

$ ./node --version
v0.11.15-pre
$ ./node          
> var foo = 'foo \
SyntaxError: Unexpected token ILLEGAL
    at Object.exports.createScript (vm.js:44:10)
    at REPLServer.defaultEval (repl.js:117:23)
    at bound (domain.js:254:14)
    at REPLServer.runBound [as eval] (domain.js:267:12)
    at REPLServer.<anonymous> (repl.js:279:12)
    at REPLServer.emit (events.js:107:17)
    at REPLServer.Interface._onLine (readline.js:213:10)
    at REPLServer.Interface._line (readline.js:552:8)
    at REPLServer.Interface._ttyWrite (readline.js:829:14)
    at ReadStream.onkeypress (readline.js:108:10)
>

The original commit that broke this behavior is 9ef9a9d. It also seems that b517500 was an attempt to bring this back.

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions