Fix match default behavior on strings for ES2015 semantics
String.prototype.match is specified to call out to the current value of RegExp.prototype[Symbol.match] when passed a string argument, rather than the original value. This patch updates the RegExp code to do that. R=yangguo@chromium.org BUG=v8:4602 LOG=Y Review URL: https://codereview.chromium.org/1821773003 Cr-Commit-Position: refs/heads/master@{#35001}
This commit is contained in:
parent
bdcefb9dc1
commit
64b2b1ac33
@ -779,7 +779,6 @@ for (var i = 1; i < 10; ++i) {
|
||||
|
||||
utils.Export(function(to) {
|
||||
to.RegExpExec = DoRegExpExec;
|
||||
to.RegExpExecNoTests = RegExpExecNoTests;
|
||||
to.RegExpLastMatchInfo = RegExpLastMatchInfo;
|
||||
to.RegExpTest = RegExpTest;
|
||||
to.IsRegExp = IsRegExp;
|
||||
|
@ -21,7 +21,6 @@ var MakeTypeError;
|
||||
var MaxSimple;
|
||||
var MinSimple;
|
||||
var matchSymbol = utils.ImportNow("match_symbol");
|
||||
var RegExpExecNoTests;
|
||||
var replaceSymbol = utils.ImportNow("replace_symbol");
|
||||
var searchSymbol = utils.ImportNow("search_symbol");
|
||||
var splitSymbol = utils.ImportNow("split_symbol");
|
||||
@ -34,7 +33,6 @@ utils.Import(function(from) {
|
||||
MakeTypeError = from.MakeTypeError;
|
||||
MaxSimple = from.MaxSimple;
|
||||
MinSimple = from.MinSimple;
|
||||
RegExpExecNoTests = from.RegExpExecNoTests;
|
||||
});
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
@ -163,7 +161,7 @@ function StringMatchJS(pattern) {
|
||||
|
||||
// Non-regexp argument.
|
||||
var regexp = new GlobalRegExp(pattern);
|
||||
return RegExpExecNoTests(regexp, subject, 0);
|
||||
return regexp[matchSymbol](subject);
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,7 +109,6 @@
|
||||
# happens to be thrown for some other reason (e.g,
|
||||
# built-ins/RegExp/prototype/Symbol.match/builtin-failure-set-lastindex-err)
|
||||
'built-ins/RegExp/prototype/Symbol.match/*': [SKIP],
|
||||
'built-ins/String/prototype/match/invoke-builtin-match': [FAIL],
|
||||
|
||||
# https://code.google.com/p/v8/issues/detail?id=4343
|
||||
'built-ins/RegExp/prototype/Symbol.replace/*': [SKIP],
|
||||
|
Loading…
Reference in New Issue
Block a user