This repository has been archived by the owner on Aug 18, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 239
Fix: Convert RegExpLieteral value to RegExp object (fixes #477) #478
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you give a scenario in tests that handles when the
value
isnull
? Also, perhaps we should have it default to{}
as it was before? Otherwise this could be a breaking change right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A scenario where
value
is null is when the flagsu
andy
are not supported. I have tests cases for these and it will produce null when run in node v4 and v5.I'm not sure this is a breaking change since the output is was producing is a bug and did not match what espree, or esprima produce. The reason the test pass is it only compared the
typeof
, which were both objects, but not from the same class. We could set the default to{}
but that would not match the ESTree spec for RegExp Literal nodes.https://github.com/estree/estree/blob/master/es5.md#regexpliteral
This does fix an issue with eslint eslint/eslint#8655 and setting the default to
{}
might cause other rule failures.The estree plugin for babylon does produce the correct output so if this were to be considered a breaking change we could wait till that is implemented in this parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've convinced me. Thanks 😄