Skip to content

Inconsistent behavior of REPL #45252

Open
@p51lee

Description

@p51lee

Version

v18.11.0

Platform

Darwin MacBook-Pro.local 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000 arm64

Subsystem

No response

What steps will reproduce the bug?

There is an inconsistent behavior of nodejs REPL executing try { for ( await of [ ] ); } catch { } with respect to just executing test.js file.

// test.js
try {
  for ( await of [ ] );
} catch { }
$ node test.js
// no error
$ node
Welcome to Node.js v18.11.0.
Type ".help" for more information.
> try{ for ( await of [ ] ); } catch { }
Uncaught SyntaxError:
try{ for ( await of [ ] ); } catch { }
                      ^

Unexpected token ']'

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior?

No response

What do you see instead?

Running try{ for ( await of [ ] ); } catch { } with nodejs REPL throws SyntaxError but executing the test.js file using nodejs terminates without error.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    replIssues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions