Skip to content

Invalid UpdateExpression's arguments #2115

@wind-of

Description

@wind-of

Invalid UpdateExpression's arguments

Esprima' UpdateExpression's argument is one of: ObjectExpression, ArrayExpression, MemberExpression, Identifier.

Consider behaviour of V8:
image

Should be:
Argument of UpdateExpression is one of: Identifier, MemberExpression

Steps to reproduce

esprima.parse('--[]') // or --{}, []--, (++[]), etc.

Expected output

Expected "Invalid left-hand side expression in prefix operation"

Actual output

{
  "type": "UpdateExpression",
  "operator": "--",
  "argument": {
    "type": "ArrayExpression",
    "elements": []
  },
  "prefix": true
}

Relevant references

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions