fix(compiler): prevent syntax error when using exact with all system modifiers#13325
Open
wdskuki wants to merge 1 commit intovuejs:mainfrom
Open
fix(compiler): prevent syntax error when using exact with all system modifiers#13325wdskuki wants to merge 1 commit intovuejs:mainfrom
wdskuki wants to merge 1 commit intovuejs:mainfrom
Conversation
… modifiers Fixes vuejs#12319 When using .exact modifier with all system modifiers (.ctrl.shift.alt.meta.exact), the compiler generated syntax error code like 'if()return null;' because the filter resulted in an empty array. Changes: - Only add the exact modifier guard when there are remaining modifiers to check - This prevents generating empty condition in the if statement Before: if()return null; // SyntaxError: Unexpected token ')' After: // No empty condition generated, code is valid Added test case to verify the fix works correctly.
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.
Fixes #12319
Problem
When using exact modifier with all system modifiers (ctrl+shift+alt+meta+exact), the compiler generated syntax error code because the filter resulted in an empty array.
Solution
Only add the exact modifier guard when there are remaining modifiers to check.
Changes
Before
if()return null; // SyntaxError
After
Valid code generated