Commit ec0a495c authored by Florian Sattler's avatar Florian Sattler Committed by Commit Bot

[parser] Cleaned up ParseClassPropertyDefiniton call syntax

Removed redundant parameters and Converted stack of bools to bitfield

Bug: v8:8015
Change-Id: Ieaf144994b6d5c40bdb264ae57c0d7520d4a9148
Reviewed-on: https://chromium-review.googlesource.com/1185196Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Commit-Queue: Florian Sattler <sattlerf@google.com>
Cr-Commit-Position: refs/heads/master@{#55331}
parent 328ec544
...@@ -598,13 +598,12 @@ class ParserBase { ...@@ -598,13 +598,12 @@ class ParserBase {
typename Types::ClassPropertyList instance_fields; typename Types::ClassPropertyList instance_fields;
FunctionLiteralT constructor; FunctionLiteralT constructor;
// TODO(gsathya): Use a bitfield store all the booleans. bool has_seen_constructor : 1;
bool has_seen_constructor; bool has_name_static_property : 1;
bool has_name_static_property; bool has_static_computed_names : 1;
bool has_static_computed_names; bool has_static_class_fields : 1;
bool has_static_class_fields; bool has_instance_class_fields : 1;
bool has_instance_class_fields; bool is_anonymous : 1;
bool is_anonymous;
DeclarationScope* static_fields_scope; DeclarationScope* static_fields_scope;
DeclarationScope* instance_fields_scope; DeclarationScope* instance_fields_scope;
int computed_field_count; int computed_field_count;
...@@ -1138,8 +1137,7 @@ class ParserBase { ...@@ -1138,8 +1137,7 @@ class ParserBase {
ClassLiteralPropertyT ParseClassPropertyDefinition( ClassLiteralPropertyT ParseClassPropertyDefinition(
ClassLiteralChecker* checker, ClassInfo* class_info, ClassLiteralChecker* checker, ClassInfo* class_info,
IdentifierT* property_name, bool has_extends, bool* is_computed_name, IdentifierT* property_name, bool has_extends, bool* is_computed_name,
bool* has_seen_constructor, ClassLiteralProperty::Kind* property_kind, ClassLiteralProperty::Kind* property_kind, bool* is_static, bool* ok);
bool* is_static, bool* has_name_static_property, bool* ok);
ExpressionT ParseClassFieldInitializer(ClassInfo* class_info, bool is_static, ExpressionT ParseClassFieldInitializer(ClassInfo* class_info, bool is_static,
bool* ok); bool* ok);
ObjectLiteralPropertyT ParseObjectPropertyDefinition( ObjectLiteralPropertyT ParseObjectPropertyDefinition(
...@@ -2316,11 +2314,9 @@ template <typename Impl> ...@@ -2316,11 +2314,9 @@ template <typename Impl>
typename ParserBase<Impl>::ClassLiteralPropertyT typename ParserBase<Impl>::ClassLiteralPropertyT
ParserBase<Impl>::ParseClassPropertyDefinition( ParserBase<Impl>::ParseClassPropertyDefinition(
ClassLiteralChecker* checker, ClassInfo* class_info, IdentifierT* name, ClassLiteralChecker* checker, ClassInfo* class_info, IdentifierT* name,
bool has_extends, bool* is_computed_name, bool* has_seen_constructor, bool has_extends, bool* is_computed_name,
ClassLiteralProperty::Kind* property_kind, bool* is_static, ClassLiteralProperty::Kind* property_kind, bool* is_static, bool* ok) {
bool* has_name_static_property, bool* ok) { DCHECK_NOT_NULL(class_info);
DCHECK_NOT_NULL(has_seen_constructor);
DCHECK_NOT_NULL(has_name_static_property);
bool is_get = false; bool is_get = false;
bool is_set = false; bool is_set = false;
bool is_generator = false; bool is_generator = false;
...@@ -2369,8 +2365,9 @@ ParserBase<Impl>::ParseClassPropertyDefinition( ...@@ -2369,8 +2365,9 @@ ParserBase<Impl>::ParseClassPropertyDefinition(
CHECK_OK_CUSTOM(NullLiteralProperty)); CHECK_OK_CUSTOM(NullLiteralProperty));
} }
if (!*has_name_static_property && *is_static && impl()->IsName(*name)) { if (!class_info->has_name_static_property && *is_static &&
*has_name_static_property = true; impl()->IsName(*name)) {
class_info->has_name_static_property = true;
} }
switch (kind) { switch (kind) {
...@@ -2432,7 +2429,7 @@ ParserBase<Impl>::ParseClassPropertyDefinition( ...@@ -2432,7 +2429,7 @@ ParserBase<Impl>::ParseClassPropertyDefinition(
FunctionKind kind = MethodKindFor(is_generator, is_async); FunctionKind kind = MethodKindFor(is_generator, is_async);
if (!*is_static && impl()->IsConstructor(*name)) { if (!*is_static && impl()->IsConstructor(*name)) {
*has_seen_constructor = true; class_info->has_seen_constructor = true;
kind = has_extends ? FunctionKind::kDerivedConstructor kind = has_extends ? FunctionKind::kDerivedConstructor
: FunctionKind::kBaseConstructor; : FunctionKind::kBaseConstructor;
} }
...@@ -4564,8 +4561,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral( ...@@ -4564,8 +4561,7 @@ typename ParserBase<Impl>::ExpressionT ParserBase<Impl>::ParseClassLiteral(
bool is_constructor = !class_info.has_seen_constructor; bool is_constructor = !class_info.has_seen_constructor;
ClassLiteralPropertyT property = ParseClassPropertyDefinition( ClassLiteralPropertyT property = ParseClassPropertyDefinition(
&checker, &class_info, &property_name, has_extends, &is_computed_name, &checker, &class_info, &property_name, has_extends, &is_computed_name,
&class_info.has_seen_constructor, &property_kind, &is_static, &property_kind, &is_static, CHECK_OK);
&class_info.has_name_static_property, CHECK_OK);
if (!class_info.has_static_computed_names && is_static && if (!class_info.has_static_computed_names && is_static &&
is_computed_name) { is_computed_name) {
class_info.has_static_computed_names = true; class_info.has_static_computed_names = true;
......
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