Commit fd51f615 authored by caitpotter88's avatar caitpotter88 Committed by Commit bot

[es6] remove --harmony-templates flag

BUG=v8:3230
R=dslomov@chromium.org, arv@chromium.org
LOG=N

Review URL: https://codereview.chromium.org/1027593005

Cr-Commit-Position: refs/heads/master@{#27352}
parent 56d2ee03
......@@ -221,6 +221,7 @@ action("js2c") {
"src/debug-debugger.js",
"src/mirror-debugger.js",
"src/liveedit-debugger.js",
"src/templates.js",
"src/macros.py",
]
......@@ -263,7 +264,6 @@ action("js2c_experimental") {
"src/harmony-array-includes.js",
"src/harmony-typedarray.js",
"src/harmony-tostring.js",
"src/harmony-templates.js",
"src/harmony-regexp.js",
"src/harmony-reflect.js"
]
......
......@@ -1660,7 +1660,6 @@ EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_regexps)
EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_arrow_functions)
EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_numeric_literals)
EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_tostring)
EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_templates)
EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_sloppy)
EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode)
EMPTY_NATIVE_FUNCTIONS_FOR_FEATURE(harmony_unicode_regexps)
......@@ -1692,7 +1691,6 @@ EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_arrow_functions)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_numeric_literals)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_tostring)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_proxies)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_templates)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_sloppy)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_unicode)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_computed_property_names)
......@@ -2315,8 +2313,6 @@ bool Genesis::InstallExperimentalNatives() {
static const char* harmony_numeric_literals_natives[] = {NULL};
static const char* harmony_tostring_natives[] = {"native harmony-tostring.js",
NULL};
static const char* harmony_templates_natives[] = {
"native harmony-templates.js", NULL};
static const char* harmony_sloppy_natives[] = {NULL};
static const char* harmony_unicode_natives[] = {NULL};
static const char* harmony_unicode_regexps_natives[] = {NULL};
......
......@@ -203,7 +203,6 @@ DEFINE_IMPLICATION(es_staging, harmony)
// Features that are shipping (turned on by default, but internal flag remains).
#define HARMONY_SHIPPING(V) \
V(harmony_numeric_literals, "harmony numeric literals") \
V(harmony_templates, "harmony template literals") \
V(harmony_classes, "harmony classes (implies object literal extension)") \
V(harmony_object_literals, "harmony object literal extensions")
......
......@@ -875,7 +875,6 @@ Parser::Parser(ParseInfo* info)
set_allow_harmony_numeric_literals(FLAG_harmony_numeric_literals);
set_allow_harmony_classes(FLAG_harmony_classes);
set_allow_harmony_object_literals(FLAG_harmony_object_literals);
set_allow_harmony_templates(FLAG_harmony_templates);
set_allow_harmony_sloppy(FLAG_harmony_sloppy);
set_allow_harmony_unicode(FLAG_harmony_unicode);
set_allow_harmony_computed_property_names(
......@@ -4173,7 +4172,6 @@ PreParser::PreParseResult Parser::ParseLazyFunctionBodyWithPreParser(
reusable_preparser_->set_allow_harmony_classes(allow_harmony_classes());
reusable_preparser_->set_allow_harmony_object_literals(
allow_harmony_object_literals());
reusable_preparser_->set_allow_harmony_templates(allow_harmony_templates());
reusable_preparser_->set_allow_harmony_sloppy(allow_harmony_sloppy());
reusable_preparser_->set_allow_harmony_unicode(allow_harmony_unicode());
reusable_preparser_->set_allow_harmony_computed_property_names(
......
......@@ -107,7 +107,6 @@ class ParserBase : public Traits {
bool allow_harmony_object_literals() const {
return allow_harmony_object_literals_;
}
bool allow_harmony_templates() const { return scanner()->HarmonyTemplates(); }
bool allow_harmony_sloppy() const { return allow_harmony_sloppy_; }
bool allow_harmony_unicode() const { return scanner()->HarmonyUnicode(); }
bool allow_harmony_computed_property_names() const {
......@@ -138,9 +137,6 @@ class ParserBase : public Traits {
void set_allow_harmony_object_literals(bool allow) {
allow_harmony_object_literals_ = allow;
}
void set_allow_harmony_templates(bool allow) {
scanner()->SetHarmonyTemplates(allow);
}
void set_allow_harmony_sloppy(bool allow) {
allow_harmony_sloppy_ = allow;
}
......
......@@ -38,7 +38,6 @@ Scanner::Scanner(UnicodeCache* unicode_cache)
harmony_modules_(false),
harmony_numeric_literals_(false),
harmony_classes_(false),
harmony_templates_(false),
harmony_unicode_(false) {}
......@@ -655,10 +654,8 @@ void Scanner::Scan() {
break;
case '`':
if (HarmonyTemplates()) {
token = ScanTemplateStart();
break;
}
token = ScanTemplateStart();
break;
default:
if (c0_ < 0) {
......
......@@ -462,8 +462,6 @@ class Scanner {
void SetHarmonyClasses(bool classes) {
harmony_classes_ = classes;
}
bool HarmonyTemplates() const { return harmony_templates_; }
void SetHarmonyTemplates(bool templates) { harmony_templates_ = templates; }
bool HarmonyUnicode() const { return harmony_unicode_; }
void SetHarmonyUnicode(bool unicode) { harmony_unicode_ = unicode; }
......@@ -745,8 +743,6 @@ class Scanner {
bool harmony_numeric_literals_;
// Whether we scan 'class', 'extends', 'static' and 'super' as keywords.
bool harmony_classes_;
// Whether we scan TEMPLATE_SPAN and TEMPLATE_TAIL
bool harmony_templates_;
// Whether we allow \u{xxxxx}.
bool harmony_unicode_;
};
......
......@@ -1091,6 +1091,29 @@ function StringFromCodePoint(_) { // length = 1
}
// -------------------------------------------------------------------
// String methods related to templates
// ES6 Draft 03-17-2015, section 21.1.2.4
function StringRaw(callSite) {
// TODO(caitp): Use rest parameters when implemented
var numberOfSubstitutions = %_ArgumentsLength();
var cooked = ToObject(callSite);
var raw = ToObject(cooked.raw);
var literalSegments = ToLength(raw.length);
if (literalSegments <= 0) return "";
var result = ToString(raw[0]);
for (var i = 1; i < literalSegments; ++i) {
if (i < numberOfSubstitutions) {
result += ToString(%_Arguments(i));
}
result += ToString(raw[i]);
}
return result;
}
// -------------------------------------------------------------------
......@@ -1105,7 +1128,8 @@ function StringFromCodePoint(_) { // length = 1
// Set up the non-enumerable functions on the String object.
InstallFunctions(GlobalString, DONT_ENUM, GlobalArray(
"fromCharCode", StringFromCharCode,
"fromCodePoint", StringFromCodePoint
"fromCodePoint", StringFromCodePoint,
"raw", StringRaw
));
// Set up the non-enumerable functions on the String prototype object.
......
......@@ -58,37 +58,3 @@ function GetTemplateCallSite(siteObj, rawStrings, hash) {
return SetCachedCallSite(%ObjectFreeze(siteObj), hash);
}
// ES6 Draft 10-14-2014, section 21.1.2.4
function StringRaw(callSite) {
// TODO(caitp): Use rest parameters when implemented
var numberOfSubstitutions = %_ArgumentsLength();
var cooked = ToObject(callSite);
var raw = ToObject(cooked.raw);
var literalSegments = ToLength(raw.length);
if (literalSegments <= 0) return "";
var result = ToString(raw[0]);
for (var i = 1; i < literalSegments; ++i) {
if (i < numberOfSubstitutions) {
result += ToString(%_Arguments(i));
}
result += ToString(raw[i]);
}
return result;
}
function ExtendStringForTemplates() {
%CheckIsBootstrapping();
// Set up the non-enumerable functions on the String object.
InstallFunctions($String, DONT_ENUM, $Array(
"raw", StringRaw
));
}
ExtendStringForTemplates();
......@@ -1378,7 +1378,6 @@ enum ParserFlag {
kAllowHarmonyClasses,
kAllowHarmonyObjectLiterals,
kAllowHarmonyRestParameters,
kAllowHarmonyTemplates,
kAllowHarmonySloppy,
kAllowHarmonyUnicode,
kAllowHarmonyComputedPropertyNames,
......@@ -1405,7 +1404,6 @@ void SetParserFlags(i::ParserBase<Traits>* parser,
parser->set_allow_harmony_arrow_functions(
flags.Contains(kAllowHarmonyArrowFunctions));
parser->set_allow_harmony_classes(flags.Contains(kAllowHarmonyClasses));
parser->set_allow_harmony_templates(flags.Contains(kAllowHarmonyTemplates));
parser->set_allow_harmony_rest_params(
flags.Contains(kAllowHarmonyRestParameters));
parser->set_allow_harmony_sloppy(flags.Contains(kAllowHarmonySloppy));
......@@ -4704,9 +4702,7 @@ TEST(ScanTemplateLiterals) {
"`foo${\r a}`",
"`foo${'a' in a}`",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonyTemplates};
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, NULL, 0);
}
......@@ -4741,9 +4737,7 @@ TEST(ScanTaggedTemplateLiterals) {
"tag`foo${\r a}`",
"tag`foo${'a' in a}`",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonyTemplates};
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, NULL, 0);
}
......@@ -4770,9 +4764,7 @@ TEST(TemplateMaterializedLiterals) {
NULL
};
static const ParserFlag always_flags[] = {kAllowHarmonyTemplates};
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, NULL, 0);
}
......@@ -4806,9 +4798,7 @@ TEST(ScanUnterminatedTemplateLiterals) {
"`foo${fn(}`",
"`foo${1 if}`",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonyTemplates};
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError, NULL, 0, NULL, 0);
}
......@@ -4828,9 +4818,7 @@ TEST(TemplateLiteralsIllegalTokens) {
"`hello${1}\\x\n${2}`",
NULL};
static const ParserFlag always_flags[] = {kAllowHarmonyTemplates};
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
arraysize(always_flags));
RunParserSyncTest(context_data, data, kError, NULL, 0, NULL, 0);
}
......
......@@ -70,7 +70,6 @@
"path": ["Templates"],
"main": "run.js",
"resources": ["templates.js"],
"flags": ["--harmony-templates"],
"run_count": 5,
"units": "score",
"results_regexp": "^%s\\-Templates\\(Score\\): (.+)$",
......
......@@ -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-templates
(function testStringRawArity() {
assertEquals(1, String.raw.length);
})();
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-templates --harmony-unicode
// Flags: --harmony-unicode
var num = 5;
var str = "str";
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --strong-mode --harmony_rest_parameters --harmony_arrow_functions --harmony_classes --harmony_computed-property_names --harmony_templates
// Flags: --strong-mode --harmony_rest_parameters --harmony_arrow_functions --harmony_classes --harmony_computed-property_names
// Note that it's essential for these tests that the reference is inside dead
// code (because we already produce ReferenceErrors for run-time unresolved
......
......@@ -1707,6 +1707,7 @@
'../../src/debug-debugger.js',
'../../src/mirror-debugger.js',
'../../src/liveedit-debugger.js',
'../../src/templates.js',
'../../src/macros.py',
],
'experimental_library_files': [
......@@ -1717,7 +1718,6 @@
'../../src/harmony-array-includes.js',
'../../src/harmony-tostring.js',
'../../src/harmony-typedarray.js',
'../../src/harmony-templates.js',
'../../src/harmony-regexp.js',
'../../src/harmony-reflect.js'
],
......
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