Reviewers: adamk,
Message:
PTAL
Description:
Use FunctionLiteral for class constructor
Motivation: Code cleanup
BUG=None
LOG=N
R=adamk
Please review this at https://codereview.chromium.org/866533003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+7, -6 lines):
M src/ast.h
M src/parser.cc
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index
74d6461cec1cdec8a0157f0ab422d233218e036d..dd4941673f7bf164c1285778ef46a20fba007bf1
100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -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_)
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index
6d1570b82fb238f39d053668d666f9f933a937ca..ec9832111aa9306ccf124ebc62237cd091fbcf1a
100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -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());
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.