Commit 5f0ef667 authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[class] Remove flags for class fields

Bug: v8:5367, v8:5368
Change-Id: I86f25f9f658e21a05604f3014e6ebf74f1a8a1f7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1590164Reviewed-by: 's avatarMathias Bynens <mathias@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61139}
parent 9b78d20b
......@@ -4185,11 +4185,7 @@ void Genesis::InitializeCallSiteBuiltins() {
void Genesis::InitializeGlobal_##id() {}
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_namespace_exports)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_public_fields)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_private_fields)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_private_methods)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_static_fields)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_class_fields)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_dynamic_import)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_import_meta)
EMPTY_INITIALIZE_GLOBAL_FOR_FEATURE(harmony_numeric_separator)
......
......@@ -204,17 +204,10 @@ DEFINE_IMPLICATION(es_staging, harmony)
// Enabling import.meta requires to also enable import()
DEFINE_IMPLICATION(harmony_import_meta, harmony_dynamic_import)
DEFINE_IMPLICATION(harmony_class_fields, harmony_public_fields)
DEFINE_IMPLICATION(harmony_class_fields, harmony_static_fields)
DEFINE_IMPLICATION(harmony_class_fields, harmony_private_fields)
DEFINE_IMPLICATION(harmony_private_methods, harmony_private_fields)
// Update bootstrapper.cc whenever adding a new feature flag.
// Features that are still work in progress (behind individual flags).
#define HARMONY_INPROGRESS_BASE(V) \
V(harmony_class_fields, "harmony fields in class literals") \
V(harmony_private_methods, "harmony private methods in class literals") \
V(harmony_regexp_sequence, "RegExp Unicode sequence properties") \
V(harmony_weak_refs, "harmony weak references")
......@@ -248,11 +241,8 @@ DEFINE_IMPLICATION(harmony_private_methods, harmony_private_fields)
V(harmony_import_meta, "harmony import.meta property") \
V(harmony_dynamic_import, "harmony dynamic import") \
V(harmony_global, "harmony global") \
V(harmony_public_fields, "harmony public instance fields in class literals") \
V(harmony_static_fields, "harmony static fields in class literals") \
V(harmony_object_from_entries, "harmony Object.fromEntries()") \
V(harmony_await_optimization, "harmony await taking 1 tick") \
V(harmony_private_fields, "harmony private fields in class literals") \
V(harmony_hashbang, "harmony hashbang syntax") \
V(harmony_numeric_separator, "harmony numeric separator between digits") \
V(harmony_promise_all_settled, "harmony Promise.allSettled")
......
......@@ -60,12 +60,9 @@ ParseInfo::ParseInfo(Isolate* isolate, AccountingAllocator* zone_allocator)
set_might_always_opt(FLAG_always_opt || FLAG_prepare_always_opt);
set_allow_lazy_compile(FLAG_lazy);
set_allow_natives_syntax(FLAG_allow_natives_syntax);
set_allow_harmony_public_fields(FLAG_harmony_public_fields);
set_allow_harmony_static_fields(FLAG_harmony_static_fields);
set_allow_harmony_dynamic_import(FLAG_harmony_dynamic_import);
set_allow_harmony_import_meta(FLAG_harmony_import_meta);
set_allow_harmony_numeric_separator(FLAG_harmony_numeric_separator);
set_allow_harmony_private_fields(FLAG_harmony_private_fields);
set_allow_harmony_private_methods(FLAG_harmony_private_methods);
}
......
......@@ -101,18 +101,12 @@ class V8_EXPORT_PRIVATE ParseInfo {
FLAG_ACCESSOR(kAllowLazyCompile, allow_lazy_compile, set_allow_lazy_compile)
FLAG_ACCESSOR(kAllowNativeSyntax, allow_native_syntax,
set_allow_native_syntax)
FLAG_ACCESSOR(kAllowHarmonyPublicFields, allow_harmony_public_fields,
set_allow_harmony_public_fields)
FLAG_ACCESSOR(kAllowHarmonyStaticFields, allow_harmony_static_fields,
set_allow_harmony_static_fields)
FLAG_ACCESSOR(kAllowHarmonyDynamicImport, allow_harmony_dynamic_import,
set_allow_harmony_dynamic_import)
FLAG_ACCESSOR(kAllowHarmonyImportMeta, allow_harmony_import_meta,
set_allow_harmony_import_meta)
FLAG_ACCESSOR(kAllowHarmonyNumericSeparator, allow_harmony_numeric_separator,
set_allow_harmony_numeric_separator)
FLAG_ACCESSOR(kAllowHarmonyPrivateFields, allow_harmony_private_fields,
set_allow_harmony_private_fields)
FLAG_ACCESSOR(kAllowHarmonyPrivateMethods, allow_harmony_private_methods,
set_allow_harmony_private_methods)
FLAG_ACCESSOR(kIsOneshotIIFE, is_oneshot_iife, set_is_oneshot_iife)
......
......@@ -263,11 +263,8 @@ class ParserBase {
script_id_(script_id),
default_eager_compile_hint_(FunctionLiteral::kShouldLazyCompile),
allow_natives_(false),
allow_harmony_public_fields_(false),
allow_harmony_static_fields_(false),
allow_harmony_dynamic_import_(false),
allow_harmony_import_meta_(false),
allow_harmony_private_fields_(false),
allow_harmony_private_methods_(false),
allow_eval_cache_(true) {
pointer_buffer_.reserve(32);
......@@ -279,8 +276,6 @@ class ParserBase {
void set_allow_##name(bool allow) { allow_##name##_ = allow; }
ALLOW_ACCESSORS(natives)
ALLOW_ACCESSORS(harmony_public_fields)
ALLOW_ACCESSORS(harmony_static_fields)
ALLOW_ACCESSORS(harmony_dynamic_import)
ALLOW_ACCESSORS(harmony_import_meta)
ALLOW_ACCESSORS(harmony_private_methods)
......@@ -296,13 +291,6 @@ class ParserBase {
scanner()->set_allow_harmony_numeric_separator(allow);
}
bool allow_harmony_private_fields() const {
return scanner()->allow_harmony_private_fields();
}
void set_allow_harmony_private_fields(bool allow) {
scanner()->set_allow_harmony_private_fields(allow);
}
uintptr_t stack_limit() const { return stack_limit_; }
void set_stack_limit(uintptr_t stack_limit) { stack_limit_ = stack_limit; }
......@@ -1442,11 +1430,8 @@ class ParserBase {
bool accept_IN_ = true;
bool allow_natives_;
bool allow_harmony_public_fields_;
bool allow_harmony_static_fields_;
bool allow_harmony_dynamic_import_;
bool allow_harmony_import_meta_;
bool allow_harmony_private_fields_;
bool allow_harmony_private_methods_;
bool allow_eval_cache_;
};
......@@ -1566,7 +1551,7 @@ ParserBase<Impl>::ParsePropertyOrPrivatePropertyName() {
if (V8_LIKELY(Token::IsPropertyName(next))) {
name = impl()->GetSymbol();
key = factory()->NewStringLiteral(name, pos);
} else if (allow_harmony_private_fields() && next == Token::PRIVATE_NAME) {
} else if (next == Token::PRIVATE_NAME) {
// In the case of a top level function, we completely skip
// analysing it's scope, meaning, we don't have a chance to
// resolve private names and find that they are not enclosed in a
......@@ -2128,9 +2113,6 @@ ParserBase<Impl>::ParseClassPropertyDefinition(ClassInfo* class_info,
DCHECK_EQ(prop_info->position, PropertyPosition::kClassLiteral);
Token::Value name_token = peek();
DCHECK_IMPLIES(name_token == Token::PRIVATE_NAME,
allow_harmony_private_fields());
int property_beg_pos = scanner()->peek_location().beg_pos;
int name_token_position = property_beg_pos;
ExpressionT name_expression;
......@@ -2166,44 +2148,34 @@ ParserBase<Impl>::ParseClassPropertyDefinition(ClassInfo* class_info,
case ParsePropertyKind::kAssign:
case ParsePropertyKind::kClassField:
case ParsePropertyKind::kShorthandOrClassField:
case ParsePropertyKind::kNotSet: // This case is a name followed by a name
// or other property. Here we have to
// assume that's an uninitialized field
// followed by a linebreak followed by a
// property, with ASI adding the
// semicolon. If not, there will be a
// syntax error after parsing the first
// name as an uninitialized field.
if (allow_harmony_public_fields() || allow_harmony_private_fields()) {
prop_info->kind = ParsePropertyKind::kClassField;
DCHECK_IMPLIES(prop_info->is_computed_name, !prop_info->is_private);
if (prop_info->is_static && !allow_harmony_static_fields()) {
ReportUnexpectedToken(Next());
return impl()->NullLiteralProperty();
}
case ParsePropertyKind::kNotSet: { // This case is a name followed by a
// name or other property. Here we have
// to assume that's an uninitialized
// field followed by a linebreak
// followed by a property, with ASI
// adding the semicolon. If not, there
// will be a syntax error after parsing
// the first name as an uninitialized
// field.
prop_info->kind = ParsePropertyKind::kClassField;
DCHECK_IMPLIES(prop_info->is_computed_name, !prop_info->is_private);
if (!prop_info->is_computed_name) {
CheckClassFieldName(prop_info->name, prop_info->is_static);
}
ExpressionT initializer = ParseMemberInitializer(
class_info, property_beg_pos, prop_info->is_static);
ExpectSemicolon();
ClassLiteralPropertyT result = factory()->NewClassLiteralProperty(
name_expression, initializer, ClassLiteralProperty::FIELD,
prop_info->is_static, prop_info->is_computed_name,
prop_info->is_private);
impl()->SetFunctionNameFromPropertyName(result, prop_info->name);
if (!prop_info->is_computed_name) {
CheckClassFieldName(prop_info->name, prop_info->is_static);
}
return result;
ExpressionT initializer = ParseMemberInitializer(
class_info, property_beg_pos, prop_info->is_static);
ExpectSemicolon();
} else {
ReportUnexpectedToken(Next());
return impl()->NullLiteralProperty();
}
ClassLiteralPropertyT result = factory()->NewClassLiteralProperty(
name_expression, initializer, ClassLiteralProperty::FIELD,
prop_info->is_static, prop_info->is_computed_name,
prop_info->is_private);
impl()->SetFunctionNameFromPropertyName(result, prop_info->name);
return result;
}
case ParsePropertyKind::kMethod: {
// MethodDefinition
// PropertyName '(' StrictFormalParameters ')' '{' FunctionBody '}'
......
......@@ -422,12 +422,9 @@ Parser::Parser(ParseInfo* info)
allow_lazy_ = info->allow_lazy_compile() && info->allow_lazy_parsing() &&
info->extension() == nullptr && can_compile_lazily;
set_allow_natives(info->allow_natives_syntax());
set_allow_harmony_public_fields(info->allow_harmony_public_fields());
set_allow_harmony_static_fields(info->allow_harmony_static_fields());
set_allow_harmony_dynamic_import(info->allow_harmony_dynamic_import());
set_allow_harmony_import_meta(info->allow_harmony_import_meta());
set_allow_harmony_numeric_separator(info->allow_harmony_numeric_separator());
set_allow_harmony_private_fields(info->allow_harmony_private_fields());
set_allow_harmony_private_methods(info->allow_harmony_private_methods());
for (int feature = 0; feature < v8::Isolate::kUseCounterFeatureCount;
++feature) {
......@@ -2808,8 +2805,6 @@ void Parser::DeclareClassField(ClassScope* scope,
const AstRawString* property_name,
bool is_static, bool is_computed_name,
bool is_private, ClassInfo* class_info) {
DCHECK(allow_harmony_public_fields() || allow_harmony_private_fields());
if (is_static) {
class_info->static_fields->Add(property, zone());
} else {
......
......@@ -233,11 +233,8 @@ class V8_EXPORT_PRIVATE Parser : public NON_EXPORTED_BASE(ParserBase<Parser>) {
parsing_module_, parsing_on_main_thread_);
#define SET_ALLOW(name) reusable_preparser_->set_allow_##name(allow_##name());
SET_ALLOW(natives);
SET_ALLOW(harmony_public_fields);
SET_ALLOW(harmony_static_fields);
SET_ALLOW(harmony_dynamic_import);
SET_ALLOW(harmony_import_meta);
SET_ALLOW(harmony_private_fields);
SET_ALLOW(harmony_private_methods);
SET_ALLOW(eval_cache);
#undef SET_ALLOW
......
......@@ -556,12 +556,6 @@ Token::Value Scanner::ScanString() {
}
Token::Value Scanner::ScanPrivateName() {
if (!allow_harmony_private_fields()) {
ReportScannerError(source_pos(),
MessageTemplate::kInvalidOrUnexpectedToken);
return Token::ILLEGAL;
}
next().literal_chars.Start();
DCHECK_EQ(c0_, '#');
DCHECK(!IsIdentifierStart(kEndOfInput));
......
......@@ -405,12 +405,6 @@ class V8_EXPORT_PRIVATE Scanner {
bool FoundHtmlComment() const { return found_html_comment_; }
bool allow_harmony_private_fields() const {
return allow_harmony_private_fields_;
}
void set_allow_harmony_private_fields(bool allow) {
allow_harmony_private_fields_ = allow;
}
bool allow_harmony_numeric_separator() const {
return allow_harmony_numeric_separator_;
}
......@@ -812,7 +806,6 @@ class V8_EXPORT_PRIVATE Scanner {
bool found_html_comment_;
// Harmony flags to allow ESNext features.
bool allow_harmony_private_fields_;
bool allow_harmony_numeric_separator_;
const bool is_module_;
......
......@@ -4,7 +4,6 @@
---
wrap: yes
private fields: yes
---
snippet: "
......
......@@ -4,7 +4,6 @@
---
wrap: yes
public fields: yes
---
snippet: "
......
......@@ -4,8 +4,6 @@
---
wrap: yes
public fields: yes
static fields: yes
---
snippet: "
......
......@@ -43,10 +43,7 @@ class ProgramOptions final {
print_callee_(false),
oneshot_opt_(false),
async_iteration_(false),
public_fields_(false),
private_fields_(false),
private_methods_(false),
static_fields_(false),
verbose_(false) {}
bool Validate() const;
......@@ -67,10 +64,7 @@ class ProgramOptions final {
bool print_callee() const { return print_callee_; }
bool oneshot_opt() const { return oneshot_opt_; }
bool async_iteration() const { return async_iteration_; }
bool public_fields() const { return public_fields_; }
bool private_fields() const { return private_fields_; }
bool private_methods() const { return private_methods_; }
bool static_fields() const { return static_fields_; }
bool verbose() const { return verbose_; }
bool suppress_runtime_errors() const { return rebaseline_ && !verbose_; }
std::vector<std::string> input_filenames() const { return input_filenames_; }
......@@ -89,10 +83,7 @@ class ProgramOptions final {
bool print_callee_;
bool oneshot_opt_;
bool async_iteration_;
bool public_fields_;
bool private_fields_;
bool private_methods_;
bool static_fields_;
bool verbose_;
std::vector<std::string> input_filenames_;
std::string output_filename_;
......@@ -195,14 +186,8 @@ ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) {
options.oneshot_opt_ = false;
} else if (strcmp(argv[i], "--async-iteration") == 0) {
options.async_iteration_ = true;
} else if (strcmp(argv[i], "--public-fields") == 0) {
options.public_fields_ = true;
} else if (strcmp(argv[i], "--private-fields") == 0) {
options.private_fields_ = true;
} else if (strcmp(argv[i], "--private-methods") == 0) {
options.private_methods_ = true;
} else if (strcmp(argv[i], "--static-fields") == 0) {
options.static_fields_ = true;
} else if (strcmp(argv[i], "--verbose") == 0) {
options.verbose_ = true;
} else if (strncmp(argv[i], "--output=", 9) == 0) {
......@@ -312,14 +297,8 @@ void ProgramOptions::UpdateFromHeader(std::istream& stream) {
oneshot_opt_ = ParseBoolean(line.c_str() + strlen(kOneshotOpt));
} else if (line.compare(0, 17, "async iteration: ") == 0) {
async_iteration_ = ParseBoolean(line.c_str() + 17);
} else if (line.compare(0, 15, "public fields: ") == 0) {
public_fields_ = ParseBoolean(line.c_str() + 15);
} else if (line.compare(0, 16, "private fields: ") == 0) {
private_fields_ = ParseBoolean(line.c_str() + 16);
} else if (line.compare(0, 16, "private methods: ") == 0) {
private_methods_ = ParseBoolean(line.c_str() + 16);
} else if (line.compare(0, 15, "static fields: ") == 0) {
static_fields_ = ParseBoolean(line.c_str() + 15);
} else if (line == "---") {
break;
} else if (line.empty()) {
......@@ -344,10 +323,7 @@ void ProgramOptions::PrintHeader(std::ostream& stream) const { // NOLINT
if (print_callee_) stream << "\nprint callee: yes";
if (oneshot_opt_) stream << "\noneshot opt: yes";
if (async_iteration_) stream << "\nasync iteration: yes";
if (public_fields_) stream << "\npublic fields: yes";
if (private_fields_) stream << "\nprivate fields: yes";
if (private_methods_) stream << "\nprivate methods: yes";
if (static_fields_) stream << "\nstatic fields: yes";
stream << "\n\n";
}
......@@ -456,10 +432,7 @@ void GenerateExpectationsFile(std::ostream& stream, // NOLINT
printer.set_test_function_name(options.test_function_name());
}
if (options.public_fields()) i::FLAG_harmony_public_fields = true;
if (options.private_fields()) i::FLAG_harmony_private_fields = true;
if (options.private_methods()) i::FLAG_harmony_private_methods = true;
if (options.static_fields()) i::FLAG_harmony_static_fields = true;
stream << "#\n# Autogenerated by generate-bytecode-expectations.\n#\n\n";
options.PrintHeader(stream);
......@@ -467,10 +440,7 @@ void GenerateExpectationsFile(std::ostream& stream, // NOLINT
printer.PrintExpectation(stream, snippet);
}
i::FLAG_harmony_public_fields = false;
i::FLAG_harmony_private_fields = false;
i::FLAG_harmony_private_methods = false;
i::FLAG_harmony_static_fields = false;
}
bool WriteExpectationsFile(const std::vector<std::string>& snippet_list,
......@@ -519,10 +489,7 @@ void PrintUsage(const char* exec_path) {
" --test-function-name=foo "
"Specify the name of the test function.\n"
" --top-level Process top level code, not the top-level function.\n"
" --public-fields Enable harmony_public_fields flag.\n"
" --private-fields Enable harmony_private_fields flag.\n"
" --private-methods Enable harmony_private_methods flag.\n"
" --static-fields Enable harmony_static_fields flag.\n"
" --output=file.name\n"
" Specify the output file. If not specified, output goes to "
"stdout.\n"
......
......@@ -2650,8 +2650,6 @@ TEST(ClassAndSuperClass) {
}
TEST(PublicClassFields) {
bool old_flag = i::FLAG_harmony_public_fields;
i::FLAG_harmony_public_fields = true;
InitializedIgnitionHandleScope scope;
BytecodeExpectationsPrinter printer(CcTest::isolate());
......@@ -2700,12 +2698,9 @@ TEST(PublicClassFields) {
CHECK(CompareTexts(BuildActual(printer, snippets),
LoadGolden("PublicClassFields.golden")));
i::FLAG_harmony_public_fields = old_flag;
}
TEST(PrivateClassFields) {
bool old_flag = i::FLAG_harmony_private_fields;
i::FLAG_harmony_private_fields = true;
InitializedIgnitionHandleScope scope;
BytecodeExpectationsPrinter printer(CcTest::isolate());
......@@ -2760,14 +2755,9 @@ TEST(PrivateClassFields) {
CHECK(CompareTexts(BuildActual(printer, snippets),
LoadGolden("PrivateClassFields.golden")));
i::FLAG_harmony_private_fields = old_flag;
}
TEST(StaticClassFields) {
bool old_flag = i::FLAG_harmony_public_fields;
bool old_static_flag = i::FLAG_harmony_static_fields;
i::FLAG_harmony_public_fields = true;
i::FLAG_harmony_static_fields = true;
InitializedIgnitionHandleScope scope;
BytecodeExpectationsPrinter printer(CcTest::isolate());
......@@ -2826,8 +2816,6 @@ TEST(StaticClassFields) {
CHECK(CompareTexts(BuildActual(printer, snippets),
LoadGolden("StaticClassFields.golden")));
i::FLAG_harmony_public_fields = old_flag;
i::FLAG_harmony_static_fields = old_static_flag;
}
TEST(Generators) {
......
......@@ -110,9 +110,6 @@ TEST(PreParserScopeAnalysis) {
Inner(const char* p, const char* s, SkipTests skip, Bailout bailout)
: params(p), source(s), skip(skip), bailout(bailout) {}
Inner(const char* s, std::function<void()> p, std::function<void()> e)
: source(s), prologue(p), epilogue(e) {}
const char* params = "";
const char* source;
SkipTests skip = DONT_SKIP;
......@@ -659,33 +656,11 @@ TEST(PreParserScopeAnalysis) {
{"class MyClass extends MyBase { static m() { var var1; function foo() { "
"var1 = 11; } } }"},
{"class X { ['bar'] = 1; }; new X;",
[] { i::FLAG_harmony_public_fields = true; },
[] { i::FLAG_harmony_public_fields = false; }},
{"class X { static ['foo'] = 2; }; new X;",
[] {
i::FLAG_harmony_public_fields = true;
i::FLAG_harmony_static_fields = true;
},
[] {
i::FLAG_harmony_public_fields = false;
i::FLAG_harmony_static_fields = false;
}},
{"class X { ['bar'] = 1; static ['foo'] = 2; }; new X;",
[] {
i::FLAG_harmony_public_fields = true;
i::FLAG_harmony_static_fields = true;
},
[] {
i::FLAG_harmony_public_fields = false;
i::FLAG_harmony_static_fields = false;
}},
{"class X { #x = 1 }; new X;",
[] { i::FLAG_harmony_private_fields = true; },
[] { i::FLAG_harmony_private_fields = false; }},
{"function t() { return class { #x = 1 }; } new t();",
[] { i::FLAG_harmony_private_fields = true; },
[] { i::FLAG_harmony_private_fields = false; }},
{"class X { ['bar'] = 1; }; new X;"},
{"class X { static ['foo'] = 2; }; new X;"},
{"class X { ['bar'] = 1; static ['foo'] = 2; }; new X;"},
{"class X { #x = 1 }; new X;"},
{"function t() { return class { #x = 1 }; } new t();"},
};
for (unsigned i = 0; i < arraysize(outers); ++i) {
......@@ -705,8 +680,6 @@ TEST(PreParserScopeAnalysis) {
int source_len = Utf8LengthHelper(inner.source);
int len = code_len + params_len + source_len;
if (inner.prologue != nullptr) inner.prologue();
i::ScopedVector<char> program(len + 1);
i::SNPrintF(program, code, inner.params, inner.source);
......@@ -770,8 +743,6 @@ TEST(PreParserScopeAnalysis) {
i::ScopeTestHelper::CompareScopes(
scope_without_skipped_functions, scope_with_skipped_functions,
inner.precise_maybe_assigned == PreciseMaybeAssigned::YES);
if (inner.epilogue != nullptr) inner.epilogue();
}
}
}
......
......@@ -4546,8 +4546,6 @@ TEST(GetPrivateFields) {
v8::internal::Isolate* isolate = CcTest::i_isolate();
v8::HandleScope scope(v8_isolate);
v8::Local<v8::Context> context = env.local();
v8::internal::FLAG_harmony_class_fields = true;
v8::internal::FLAG_harmony_private_fields = true;
v8::Local<v8::String> source = v8_str(
"var X = class {\n"
" #foo = 1;\n"
......
This diff is collapsed.
// Copyright 2015 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.
//
// Flags: --harmony-public-fields
class X {
constructor = function() {};
......
*%(basename)s:8: SyntaxError: Classes may not have a field named 'constructor'
*%(basename)s:6: SyntaxError: Classes may not have a field named 'constructor'
constructor = function() {};
^^^^^^^^^^^
SyntaxError: Classes may not have a field named 'constructor'
\ No newline at end of file
// Copyright 2015 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.
//
// Flags: --harmony-public-fields --harmony-static-fields
class X {
static constructor = function() {};
......
*%(basename)s:8: SyntaxError: Classes may not have a field named 'constructor'
*%(basename)s:6: SyntaxError: Classes may not have a field named 'constructor'
static constructor = function() {};
^^^^^^^^^^^
SyntaxError: Classes may not have a field named 'constructor'
\ No newline at end of file
// Copyright 2015 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.
//
// Flags: --harmony-public-fields --harmony-static-fields
class X {
static prototype = function() {};
......
*%(basename)s:8: SyntaxError: Classes may not have a static property named 'prototype'
*%(basename)s:6: SyntaxError: Classes may not have a static property named 'prototype'
static prototype = function() {};
^^^^^^^^^
SyntaxError: Classes may not have a static property named 'prototype'
\ No newline at end of file
// Copyright 2018 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.
//
// Flags: --harmony-public-fields
class X {
[foo()] = 1;
......
*%(basename)s:8: ReferenceError: foo is not defined
*%(basename)s:6: ReferenceError: foo is not defined
[foo()] = 1;
^
ReferenceError: foo is not defined
at *%(basename)s:8:4
\ No newline at end of file
at *%(basename)s:6:4
\ No newline at end of file
// Copyright 2019 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.
//
// Flags: --harmony-private-fields
class Y {
makeClass() {
......
*%(basename)s:12: SyntaxError: Undefined private field #b: must be declared in an enclosing class
*%(basename)s:10: SyntaxError: Undefined private field #b: must be declared in an enclosing class
getB() { return this.#b; }
^
SyntaxError: Undefined private field #b: must be declared in an enclosing class
......@@ -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-private-fields
var o = {};
class C {
#a = 0;
......
*%(basename)s:11: TypeError: Read of private field #a from an object which did not contain the field
*%(basename)s:9: TypeError: Read of private field #a from an object which did not contain the field
[o.#a](){}
^
TypeError: Read of private field #a from an object which did not contain the field
at *%(basename)s:11:8
at *%(basename)s:9:8
// Copyright 2018 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.
//
// Flags: --harmony-private-fields
class X {
#x;
......
*%(basename)s:10: TypeError: Write of private field #x to an object which did not contain the field
*%(basename)s:8: TypeError: Write of private field #x to an object which did not contain the field
({}).#x = 1;
^
TypeError: Write of private field #x to an object which did not contain the field
at new X (*%(basename)s:10:13)
at *%(basename)s:14:1
\ No newline at end of file
at new X (*%(basename)s:8:13)
at *%(basename)s:12:1
\ No newline at end of file
// Copyright 2018 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.
//
// Flags: --harmony-private-fields
class X {
constructor() {
......
*%(basename)s:9: SyntaxError: Undefined private field #x: must be declared in an enclosing class
*%(basename)s:7: SyntaxError: Undefined private field #x: must be declared in an enclosing class
this.#x = 1;
^
SyntaxError: Undefined private field #x: must be declared in an enclosing class
\ No newline at end of file
......@@ -3,7 +3,6 @@
// found in the LICENSE file.
//
// MODULE
// Flags: --harmony-private-fields
class X {
constructor() {
......
*%(basename)s:10: SyntaxError: Undefined private field #x: must be declared in an enclosing class
*%(basename)s:9: SyntaxError: Undefined private field #x: must be declared in an enclosing class
this.#x = 1;
^
SyntaxError: Undefined private field #x: must be declared in an enclosing class
\ No newline at end of file
// Copyright 2018 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.
//
// Flags: --harmony-private-fields
class X {
#x;
......
*%(basename)s:9: TypeError: Read of private field #x from an object which did not contain the field
*%(basename)s:7: TypeError: Read of private field #x from an object which did not contain the field
eq(o) { return this.#x === o.#x; }
^
TypeError: Read of private field #x from an object which did not contain the field
at X.eq (*%(basename)s:9:32)
at *%(basename)s:12:9
\ No newline at end of file
at X.eq (*%(basename)s:7:32)
at *%(basename)s:10:9
\ No newline at end of file
// Copyright 2018 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.
//
// Flags: --harmony-private-fields
class X {
#x;
......
*%(basename)s:9: TypeError: Write of private field #x to an object which did not contain the field
*%(basename)s:7: TypeError: Write of private field #x to an object which did not contain the field
setX(o, val) { o.#x = val; }
^
TypeError: Write of private field #x to an object which did not contain the field
at X.setX (*%(basename)s:9:23)
at *%(basename)s:12:9
\ No newline at end of file
at X.setX (*%(basename)s:7:23)
at *%(basename)s:10:9
\ No newline at end of file
// Copyright 2019 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.
//
// Flags: --harmony-private-fields
class A {
fn() {
......
*%(basename)s:10: SyntaxError: Undefined private field #b: must be declared in an enclosing class
*%(basename)s:8: SyntaxError: Undefined private field #b: must be declared in an enclosing class
getA() { return this.#b; }
^
SyntaxError: Undefined private field #b: must be declared in an enclosing class
......@@ -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-public-fields --harmony-static-fields
//
// TODO(gsathya): Remove 'Function' from stack trace.
class X {
......
*%(basename)s:10: ReferenceError: foo is not defined
*%(basename)s:8: ReferenceError: foo is not defined
static x = foo();
^
ReferenceError: foo is not defined
at Function.<static_fields_initializer> (*%(basename)s:10:14)
at Function.<static_fields_initializer> (*%(basename)s:8:14)
at *%(basename)s:1:1
\ No newline at end of file
// Copyright 2018 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.
//
// Flags: --harmony-public-fields
class X {
x = foo();
......
*%(basename)s:8: ReferenceError: foo is not defined
*%(basename)s:6: ReferenceError: foo is not defined
x = foo();
^
ReferenceError: foo is not defined
at X.<instance_members_initializer> (*%(basename)s:8:7)
at new X (*%(basename)s:7:1)
at *%(basename)s:11:1
\ No newline at end of file
at X.<instance_members_initializer> (*%(basename)s:6:7)
at new X (*%(basename)s:5:1)
at *%(basename)s:9:1
\ No newline at end of file
......@@ -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-class-fields
class Foo {
#x = 1;
destructureX() {
......
*%(basename)s:10: SyntaxError: Unexpected identifier
*%(basename)s:8: SyntaxError: Unexpected identifier
const { #x: x } = this;
^^
SyntaxError: Unexpected identifier
......@@ -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-private-fields
{
class X {
#x = 1;
......
......@@ -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-private-fields --allow-natives-syntax
// Flags: --allow-natives-syntax
load('test/mjsunit/test-async.js');
......
......@@ -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-private-fields --allow-natives-syntax
// Flags: --allow-natives-syntax
"use strict";
......
......@@ -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-private-fields --allow-natives-syntax
// Flags: --allow-natives-syntax
"use strict";
......
......@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-public-fields
"use strict";
{
......
......@@ -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-public-fields --harmony-static-fields
"use strict";
{
......
......@@ -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-class-fields
assertThrows(() => eval(`
class Foo {
#x = 1;
......
......@@ -44,10 +44,6 @@ from testrunner.outproc import test262
# TODO(littledan): move the flag mapping into the status file
FEATURE_FLAGS = {
'class-fields-public': '--harmony-public-fields',
'class-static-fields-public': '--harmony-class-fields',
'class-fields-private': '--harmony-private-fields',
'class-static-fields-private': '--harmony-private-fields',
'numeric-separator-literal': '--harmony-numeric-separator',
'Intl.DateTimeFormat-datetimestyle': '--harmony-intl-datetime-style',
'Intl.Locale': '--harmony-locale',
......
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