Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spread Syntax sometimes fails #1949

Closed
dbryan0516 opened this issue Aug 13, 2018 · 0 comments
Closed

Spread Syntax sometimes fails #1949

dbryan0516 opened this issue Aug 13, 2018 · 0 comments

Comments

@dbryan0516
Copy link

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

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

No branches or pull requests

1 participant