Invalid UpdateExpression's arguments · Issue #2115 · jquery/esprima · GitHub
Skip to content

Invalid UpdateExpression's arguments #2115

Open

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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