Commit c883aed7 authored by arv's avatar arv Committed by Commit bot

Use FunctionLiteral for class constructor

Motivation: Code cleanup

BUG=None
LOG=N
R=adamk

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

Cr-Commit-Position: refs/heads/master@{#26210}
parent a96eb486
......@@ -2621,7 +2621,7 @@ class ClassLiteral FINAL : public Expression {
Scope* scope() const { return scope_; }
VariableProxy* class_variable_proxy() const { return class_variable_proxy_; }
Expression* extends() const { return extends_; }
Expression* constructor() const { return constructor_; }
FunctionLiteral* constructor() const { return constructor_; }
ZoneList<Property*>* properties() const { return properties_; }
int start_position() const { return position(); }
int end_position() const { return end_position_; }
......@@ -2634,7 +2634,7 @@ class ClassLiteral FINAL : public Expression {
protected:
ClassLiteral(Zone* zone, const AstRawString* name, Scope* scope,
VariableProxy* class_variable_proxy, Expression* extends,
Expression* constructor, ZoneList<Property*>* properties,
FunctionLiteral* constructor, ZoneList<Property*>* properties,
int start_position, int end_position)
: Expression(zone, start_position),
raw_name_(name),
......@@ -2653,7 +2653,7 @@ class ClassLiteral FINAL : public Expression {
Scope* scope_;
VariableProxy* class_variable_proxy_;
Expression* extends_;
Expression* constructor_;
FunctionLiteral* constructor_;
ZoneList<Property*>* properties_;
int end_position_;
};
......@@ -3496,7 +3496,7 @@ class AstNodeFactory FINAL BASE_EMBEDDED {
ClassLiteral* NewClassLiteral(const AstRawString* name, Scope* scope,
VariableProxy* proxy, Expression* extends,
Expression* constructor,
FunctionLiteral* constructor,
ZoneList<ObjectLiteral::Property*>* properties,
int start_position, int end_position) {
return new (zone_)
......
......@@ -4008,7 +4008,7 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
}
ZoneList<ObjectLiteral::Property*>* properties = NewPropertyList(4, zone());
Expression* constructor = NULL;
FunctionLiteral* constructor = NULL;
bool has_seen_constructor = false;
Expect(Token::LBRACE, CHECK_OK);
......@@ -4024,7 +4024,8 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
&has_seen_constructor, CHECK_OK);
if (has_seen_constructor && constructor == NULL) {
constructor = GetPropertyValue(property);
constructor = GetPropertyValue(property)->AsFunctionLiteral();
DCHECK_NOT_NULL(constructor);
} else {
properties->Add(property, zone());
}
......
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