Skip to content

Syntax Error with yield new #9374

@tyler-johnson

Description

@tyler-johnson

Bug Report

Current Behavior
The code yield new Foo() results in a syntax error:

SyntaxError: Unexpected token, expected ";" 

Input Code

export function* test() {
  yield new Foo();
}

Expected behavior/code
I expect this valid code to parse successfully.

Babel Configuration (.babelrc, package.json, cli command)
This will fail with no configuration (ie. the default). I've also tried a few different combinations of presets/plugins to get this work but it always fails.

Environment

  • Babel version(s): @babel/cli v7.2.0, @babel/parser v7.3.0
  • Node/npm version: Node.js v11.6.0, NPM 6.6.0
  • OS: MacOS 10.14.2
  • Monorepo: no
  • How you are using Babel: cli

Metadata

Metadata

Assignees

Labels

outdatedA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions