Skip to content

ES6, rest parameter with array destructuring pattern #1365

Closed
@motopods

Description

@motopods
import { parse } from "acorn";

parse('function foo(...[options]) {}',
	{ ecmaVersion: 2015 },
);
3645 |   var loc = getLineInfo(this.input, pos);
3646 |   message += " (" + loc.line + ":" + loc.column + ")";
3647 |   if (this.sourceFile) {
3648 |     message += " in " + this.sourceFile;
3649 |   }
3650 |   var err = new SyntaxError(message);
                   ^
SyntaxError: Unexpected token (1:16)
      pos: 16,
      loc: Position {
  line: 1,
  column: 16,
  offset: [Function: offset],
},
 raisedAt: 17,

ES6 should support this feature without throwing an error.

rspack-contrib/rsbuild-plugin-check-syntax#36

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions