-
-
Notifications
You must be signed in to change notification settings - Fork 893
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
Issue#412 #418
base: master
Are you sure you want to change the base?
Issue#412 #418
Conversation
54e30ea
to
e44022d
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.
@YLeight sorry for the long delay here.
I've rebased this and cleaned up a number of lint violations. However, there's still some left, plus some additional comments.
es5-shim.js
Outdated
} | ||
|
||
if (result[groupIndex] && !result[groupIndex].isResulting) { | ||
result.splice(groupIndex, 1); |
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.
we should definitely not rely on:
splice
working properlysplice
being present
nor should we mutate the array like this.
es5-shim.js
Outdated
searchValue.lastIndex = originalLastIndex; // eslint-disable-line no-param-reassign | ||
pushCall(args, arguments[length - 2], arguments[length - 1]); | ||
return replaceValue.apply(this, args); | ||
var groups = ArrayPrototype.slice.call(arguments, 1, -2); |
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.
delete Array.prototype.slice
would break this code.
var groups = ArrayPrototype.slice.call(arguments, 1, -2); | |
var groups = arraySlice(arguments, 1, -2); |
for (var i = 0; i < groups.length; i++) { | ||
var argumentIndex = i + 1; | ||
if (groups[i] === '' && extendedGroups[i].mayBeMissing) { | ||
arguments[argumentIndex] = undefined; |
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.
assigning to arguments
is a massive deoptimization, and is mutation anyways. we'll have to avoid this.
es5-shim.js
Outdated
} | ||
} | ||
|
||
return replaceValue.apply(this, arguments); |
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.
return replaceValue.apply(this, arguments); | |
return apply.call(replaceValue, this, arguments); |
ping @YLeight; i've rebased this, but there's still linting issues as well as mutation. |
@ljharb I have added two tests which show thin places of both decisions in FF versions > 34 (current one and my previous one) from line 39 on
My current solution is a littlle bit difficult, but I have not found more simple one yet.