Skip to content

support 'regex' property when 'value' is null#396

Merged
michaelficarra merged 1 commit intoestools:masterfrom
fabiosantoscode:master
Jan 18, 2020
Merged

support 'regex' property when 'value' is null#396
michaelficarra merged 1 commit intoestools:masterfrom
fabiosantoscode:master

Conversation

@fabiosantoscode
Copy link
Copy Markdown
Contributor

Hello there! Thank you very much for the work that's gone into this library :)

I come with a PR to fix an issue which came up while using escodegen to test Terser's mozilla AST generation.

According to the spec it's possible to set a RegExpLiteral's value to null such that the RegExp is fully defined in the regex property. We need to do this always in Terser since we print the estree serialized JSON to standard output, which is a medium that doesn't allow us to use actual regular expressions.

To fix this, I just placed the logic that tests whether the Literal is a RegExpLiteral (IE checking for the regex property) above the other checks, which allows it to circumvent an early return of 'null' in this case.

Thanks! :D

@fabiosantoscode fabiosantoscode changed the title support 'regex' property when 'value' is null read the regex property of a Literal when value is null Sep 5, 2019
@fabiosantoscode fabiosantoscode changed the title read the regex property of a Literal when value is null read the regex property of a Literal when value is null Sep 5, 2019
fabiosantoscode added a commit to terser/terser that referenced this pull request Sep 5, 2019
@michaelficarra michaelficarra changed the title read the regex property of a Literal when value is null support 'regex' property when 'value' is null Jan 18, 2020
@michaelficarra michaelficarra merged commit 6eb8e31 into estools:master Jan 18, 2020
bizob2828 pushed a commit to Contrast-Security-OSS/escodegen that referenced this pull request Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants