Commit f4b2b9be authored by Mathias Bynens's avatar Mathias Bynens Committed by Commit Bot

Ship RegExp `dotAll` mode / `s` flag

Intent to ship:
https://groups.google.com/a/chromium.org/d/msg/blink-dev/0uSHjqvgAwQ/CqmFd6KNAwAJ

BUG=v8:6172

Cq-Include-Trybots: master.tryserver.v8:v8_linux_noi18n_rel_ng
Change-Id: I50fab93516065195b4e9eea0d3be14ccf935a04f
Reviewed-on: https://chromium-review.googlesource.com/589150Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46960}
parent d4c1b2aa
......@@ -211,10 +211,9 @@ DEFINE_IMPLICATION(es_staging, harmony)
// Features that are complete (but still behind --harmony/es-staging flag).
#define HARMONY_STAGED(V) \
V(harmony_function_tostring, "harmony Function.prototype.toString") \
V(harmony_regexp_dotall, "harmony regexp dotall flag") \
V(harmony_regexp_lookbehind, "harmony regexp lookbehind") \
V(harmony_regexp_named_captures, "harmony regexp named captures") \
V(harmony_regexp_property, "harmony unicode regexp property classes") \
V(harmony_regexp_property, "harmony Unicode regexp property classes") \
V(harmony_strict_legacy_accessor_builtins, \
"treat __defineGetter__ and related functions as strict") \
V(harmony_template_escapes, \
......@@ -225,10 +224,11 @@ DEFINE_IMPLICATION(es_staging, harmony)
V(harmony_dynamic_import, "harmony dynamic import")
// Features that are shipping (turned on by default, but internal flag remains).
#define HARMONY_SHIPPING(V) \
V(harmony_restrictive_generators, \
"harmony restrictions on generator declarations") \
V(harmony_object_rest_spread, "harmony object rest spread properties")
#define HARMONY_SHIPPING(V) \
V(harmony_restrictive_generators, \
"harmony restrictions on generator declarations") \
V(harmony_object_rest_spread, "harmony object rest spread properties") \
V(harmony_regexp_dotall, "harmony regexp dotAll flag")
// Once a shipping feature has proved stable in the wild, it will be dropped
// from HARMONY_SHIPPING, all occurrences of the FLAG_ variable are removed,
......
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This tests that RegExp dotall features are not enabled when
// --harmony-regexp-dotall is not passed.
// Flags: --no-harmony-regexp-dotall
// Construction does not throw.
{
assertThrows("/./s", SyntaxError);
assertThrows(() => RegExp(".", "s"), SyntaxError);
assertThrows(() => new RegExp(".", "s"), SyntaxError);
assertThrows(() => new RegExp(".", "wtf"), SyntaxError);
}
// The flags accessors.
{
let re = /./gimyu;
assertEquals("gimuy", re.flags);
assertTrue(re.global);
assertTrue(re.ignoreCase);
assertTrue(re.multiline);
assertTrue(re.sticky);
assertTrue(re.unicode);
assertEquals(re.dotAll, undefined);
assertFalse("dotAll" in re);
let callCount = 0;
re.__defineGetter__("dotAll", () => { callCount++; return undefined; });
assertEquals("gimuy", re.flags);
assertEquals(callCount, 0);
}
// Default '.' behavior.
{
let re = /^.$/;
assertTrue(re.test("a"));
assertTrue(re.test("3"));
assertTrue(re.test("π"));
assertTrue(re.test("\u2027"));
assertTrue(re.test("\u0085"));
assertTrue(re.test("\v"));
assertTrue(re.test("\f"));
assertTrue(re.test("\u180E"));
assertFalse(re.test("\u{10300}")); // Supplementary plane.
assertFalse(re.test("\n"));
assertFalse(re.test("\r"));
assertFalse(re.test("\u2028"));
assertFalse(re.test("\u2029"));
}
// Default '.' behavior (unicode).
{
let re = /^.$/u;
assertTrue(re.test("a"));
assertTrue(re.test("3"));
assertTrue(re.test("π"));
assertTrue(re.test("\u2027"));
assertTrue(re.test("\u0085"));
assertTrue(re.test("\v"));
assertTrue(re.test("\f"));
assertTrue(re.test("\u180E"));
assertTrue(re.test("\u{10300}")); // Supplementary plane.
assertFalse(re.test("\n"));
assertFalse(re.test("\r"));
assertFalse(re.test("\u2028"));
assertFalse(re.test("\u2029"));
}
......@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-regexp-dotall
function toSlowMode(re) {
re.exec = (str) => RegExp.prototype.exec.call(re, str);
return re;
......
......@@ -44,7 +44,6 @@ FEATURE_FLAGS = {
'object-rest': '--harmony-object-rest-spread',
'object-spread': '--harmony-object-rest-spread',
'async-iteration': '--harmony-async-iteration',
'regexp-dotall': '--harmony-regexp-dotall',
'regexp-named-groups': '--harmony-regexp-named-captures',
'regexp-unicode-property-escapes': '--harmony-regexp-property',
'regexp-lookbehind': '--harmony-regexp-lookbehind',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment