Repository navigation
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The new expression-continuation path combines multiple grammar stages in the shared JavaScript parser, requiring broader review of precedence and parser-state interactions.
No open issues 🎉
What changed in this PR
Fixes two import-related parsing bugs in the JavaScript extractor so expression statements beginning with import.meta or dynamic import(...) are parsed completely.
Changes:
- Adds reusable parsing helpers to continue from an already-parsed expression atom.
- Routes import-led statements through full expression parsing, including operators beyond property access and calls.
- Adds regression fixtures and expected extraction output covering operators, comments, and whitespace.
| File | Description |
|---|---|
javascript/extractor/tests/esnext/output/trap/import-meta.js.trap |
Expected extraction output for import.meta cases. |
javascript/extractor/tests/esnext/output/trap/dynamic-import-expr.js.trap |
Expected extraction output for dynamic-import expressions. |
javascript/extractor/tests/esnext/input/import-meta.js |
Regression cases for import-meta statements and whitespace variants. |
javascript/extractor/tests/esnext/input/dynamic-import-expr.js |
Regression cases for dynamic imports with logical, conditional, and comma operators. |
javascript/extractor/src/com/semmle/jcorn/Parser.java |
Extracts expression-continuation helpers. |
javascript/extractor/src/com/semmle/jcorn/ESNextParser.java |
Uses full expression parsing for import-led statements. |
Review effort: Balanced (adaptive)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes two parsing bugs:
import.meta. For example:import(...)followed by non-subscript operators. For example:Commit-by-commit review recommended.
DCA was uneventful.