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.
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.
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.
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.
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
|
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
///).