Skip to content
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

Open
wants to merge 2 commits into
base: master
from
Open

Issue#412 #418

wants to merge 2 commits into from

Conversation

@YLeight
Copy link

YLeight commented Nov 24, 2016

@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.

elitvyakov added 2 commits Nov 24, 2016
@ljharb ljharb force-pushed the YLeight:issue#412 branch 2 times, most recently from 54e30ea to e44022d Jan 7, 2020
Copy link
Member

ljharb left a comment

@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.

}

if (result[groupIndex] && !result[groupIndex].isResulting) {
result.splice(groupIndex, 1);

This comment has been minimized.

Copy link
@ljharb

ljharb Jan 7, 2020

Member

we should definitely not rely on:

  • splice working properly
  • splice being present

nor should we mutate the array like this.

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);

This comment has been minimized.

Copy link
@ljharb

ljharb Jan 7, 2020

Member

delete Array.prototype.slice would break this code.

Suggested change
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;

This comment has been minimized.

Copy link
@ljharb

ljharb Jan 7, 2020

Member

assigning to arguments is a massive deoptimization, and is mutation anyways. we'll have to avoid this.

}
}

return replaceValue.apply(this, arguments);

This comment has been minimized.

Copy link
@ljharb

ljharb Jan 7, 2020

Member
Suggested change
return replaceValue.apply(this, arguments);
return apply.call(replaceValue, this, arguments);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.