-
-
Notifications
You must be signed in to change notification settings - Fork 430
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
feat(minifier): implement folding charCodeAt
string fns
#6475
base: main
Are you sure you want to change the base?
feat(minifier): implement folding charCodeAt
string fns
#6475
Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
05a79d4
to
273f6f5
Compare
5124d0f
to
561ec3d
Compare
CodSpeed Performance ReportMerging #6475 will not alter performanceComparing Summary
|
fold_same("x = 'abcde'.charCodeAt(0, ++z)"); // or (++z, 97) | ||
// START: note the following test cases outputs differ from Google's | ||
fold("x = 'abcde'.charCodeAt()", "x = 97"); | ||
fold("x = 'abcde'.charCodeAt(0, ++z)", "x = 97"); |
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.
This does not appear correct. z++
is missing.
273f6f5
to
096e590
Compare
561ec3d
to
7d686fc
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 don't have enough time these days, so if things ready, call @Boshen to review and merge.
let char_at_index: Option<f64> = match call_expr.arguments.first() { | ||
Some(Argument::NumericLiteral(numeric_lit)) => Some(numeric_lit.value), | ||
Some(Argument::UnaryExpression(unary_expr)) | ||
if unary_expr.operator == UnaryOperator::UnaryNegation => | ||
{ | ||
let Expression::NumericLiteral(numeric_lit) = &unary_expr.argument else { | ||
return None; | ||
}; | ||
Some(-(numeric_lit.value)) | ||
} | ||
None => None, | ||
_ => return None, | ||
}; |
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.
let char_at_index = call_expr.arguments.first().and_then(|idx| ctx.get_number_value(idx))
Similar approches, you don't need to handle it manually.
No description provided.