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

fix exception in macros babel plugin #1156

Merged
merged 1 commit into from Mar 8, 2022
Merged

fix exception in macros babel plugin #1156

merged 1 commit into from Mar 8, 2022

Conversation

ef4
Copy link
Contributor

@ef4 ef4 commented Mar 8, 2022

This fixes a crash in the macros babel plugin that could be triggered by a particular combination of SpreadElement and OptionalMemberExpression.

This fixes a crash in the macros babel plugin that could be triggered by a particular combination of SpreadElement and OptionalMemberExpression.
@ef4
Copy link
Contributor Author

ef4 commented Mar 8, 2022

For searchability, the failure looks like:

TypeError: /path/to/some.js: Cannot read property 'type' of undefined
      201 |     // Here we are glossing over the lack of a real OptionalMemberExpression type
      202 |     // in our @babel/traverse typings.
    > 203 |     if (path.node.type === 'OptionalMemberExpression') {
          |                   ^
      204 |       return this.evaluateMember(path as NodePath<t.OptionalMemberExpression>, true);
      205 |     }
      206 |

      at Evaluator.realEvaluate (src/babel/evaluate-json.ts:203:19)
      at Evaluator.evaluate (src/babel/evaluate-json.ts:187:23)

@ef4 ef4 merged commit cf9a93b into main Mar 8, 2022
@ef4 ef4 deleted the macro-exception branch March 8, 2022 04:08
@ef4 ef4 added the bug Something isn't working label Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant