Skip to content

Spread Syntax sometimes fails #1949

Closed
Closed

Description

@dbryan0516

Steps to reproduce

When using recast to parse, it fails on a spread syntax object.

query = {
      ...query, // FAILS here, line 477
      $or: [
        {_id: { $in: req.jwt.var}},
        {owner: req.jwt.var2}
      ]
    };

Expected output

Program completes parsing normally.

Actual output

gitdir\node_modules\esprima\dist\esprima.js:1995
                throw this.unexpectedTokenError(token, message);
                ^
Error: Line 477: Unexpected token ...
    at ErrorHandler.constructError (gitdir\node_modules\esprima\dist\esprima.js:5012:22)
    at ErrorHandler.createError (gitdir\node_modules\esprima\dist\esprima.js:5028:27)
    at Parser.unexpectedTokenError (gitdir\node_modules\esprima\dist\esprima.js:1985:39)
    at Parser.throwUnexpectedToken (gitdir\node_modules\esprima\dist\esprima.js:1995:21)
    at Parser.parseObjectPropertyKey (gitdir\node_modules\esprima\dist\esprima.js:2499:33)
    at Parser.parseObjectProperty (gitdir\node_modules\esprima\dist\esprima.js:2534:25)
    at Parser.parseObjectInitializer (gitdir\node_modules\esprima\dist\esprima.js:2602:35)
    at Parser.inheritCoverGrammar (gitdir\node_modules\esprima\dist\esprima.js:2285:37)
    at Parser.parsePrimaryExpression (gitdir\node_modules\esprima\dist\esprima.js:2354:38)
    at Parser.inheritCoverGrammar (gitdir\node_modules\esprima\dist\esprima.js:2285:37)

Commenting out that line (477), and it ran successfully

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