-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix .env regex constants #130072
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 .env regex constants #130072
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
bbf61cb to
f922e5d
Compare
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.
I believe what Zach meant was lifting these invocations of hte RegExp constructor out of these methods and into static fields that are only allocated once. I believe the string literals are already constant.
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.
I first tried to make RegExp objects as const but unfortunatelly the ˋRegExp` object doesn't have a const constructor.
There is already a linked issue about this topic dart-lang/sdk#27613
I can make it static final maybe ?
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.
yes, they should be final. the point here is not about making them constant, but about avoiding a new allocation each time the methods are invoked.
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.
I moved all the RegExp constructors. They are now build only one time.
f922e5d to
b0133b1
Compare
b0133b1 to
a8a7bfd
Compare
a8a7bfd to
3fe20e5
Compare
andrewkolos
left a comment
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.
LGTM
christopherfujino
left a comment
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.
LGTM
|
manually set the google testing to green, this change shouldn't affect google targets |
Set `.env` regex list as constants. This pull request fixes the nit related in this comment: flutter#128668 (comment)
Set
.envregex list as constants.This pull request fixes the nit related in this comment: #128668 (comment)
Pre-launch Checklist
///).