Index: src/ast.h |
diff --git a/src/ast.h b/src/ast.h |
index c5a924c43d914f10246f7b8513a0cb0417dfae01..f015fa7f90e3401efe6d900f1fc8a38d1f476101 100644 |
--- a/src/ast.h |
+++ b/src/ast.h |
@@ -40,12 +40,12 @@ namespace internal { |
// Nodes of the abstract syntax tree. Only concrete classes are |
// enumerated here. |
-#define DECLARATION_NODE_LIST(V) \ |
- V(VariableDeclaration) \ |
- V(FunctionDeclaration) \ |
- V(ModuleDeclaration) \ |
- V(ImportDeclaration) \ |
- V(ExportDeclaration) \ |
+#define DECLARATION_NODE_LIST(V) \ |
+ V(VariableDeclaration) \ |
+ V(FunctionDeclaration) \ |
+ V(ModuleDeclaration) \ |
+ V(ImportDeclaration) \ |
+ V(ExportDeclaration) |
#define MODULE_NODE_LIST(V) \ |
V(ModuleLiteral) \ |
@@ -73,28 +73,29 @@ namespace internal { |
V(TryFinallyStatement) \ |
V(DebuggerStatement) |
-#define EXPRESSION_NODE_LIST(V) \ |
- V(FunctionLiteral) \ |
- V(NativeFunctionLiteral) \ |
- V(Conditional) \ |
- V(VariableProxy) \ |
- V(Literal) \ |
- V(RegExpLiteral) \ |
- V(ObjectLiteral) \ |
- V(ArrayLiteral) \ |
- V(Assignment) \ |
- V(Yield) \ |
- V(Throw) \ |
- V(Property) \ |
- V(Call) \ |
- V(CallNew) \ |
- V(CallRuntime) \ |
- V(UnaryOperation) \ |
- V(CountOperation) \ |
- V(BinaryOperation) \ |
- V(CompareOperation) \ |
- V(ThisFunction) \ |
- V(SuperReference) \ |
+#define EXPRESSION_NODE_LIST(V) \ |
+ V(FunctionLiteral) \ |
+ V(ClassLiteral) \ |
+ V(NativeFunctionLiteral) \ |
+ V(Conditional) \ |
+ V(VariableProxy) \ |
+ V(Literal) \ |
+ V(RegExpLiteral) \ |
+ V(ObjectLiteral) \ |
+ V(ArrayLiteral) \ |
+ V(Assignment) \ |
+ V(Yield) \ |
+ V(Throw) \ |
+ V(Property) \ |
+ V(Call) \ |
+ V(CallNew) \ |
+ V(CallRuntime) \ |
+ V(UnaryOperation) \ |
+ V(CountOperation) \ |
+ V(BinaryOperation) \ |
+ V(CompareOperation) \ |
+ V(ThisFunction) \ |
+ V(SuperReference) \ |
V(CaseClause) |
#define AST_NODE_LIST(V) \ |
@@ -1459,7 +1460,8 @@ class ObjectLiteralProperty FINAL : public ZoneObject { |
}; |
ObjectLiteralProperty(Zone* zone, AstValueFactory* ast_value_factory, |
- Literal* key, Expression* value); |
+ Literal* key, Expression* value, |
+ bool is_static); |
rossberg
2014/09/15 12:32:48
Nit: formatting
arv (Not doing code reviews)
2014/09/15 15:12:32
Done.
|
Literal* key() { return key_; } |
Expression* value() { return value_; } |
@@ -1478,7 +1480,8 @@ class ObjectLiteralProperty FINAL : public ZoneObject { |
protected: |
template<class> friend class AstNodeFactory; |
- ObjectLiteralProperty(Zone* zone, bool is_getter, FunctionLiteral* value); |
+ ObjectLiteralProperty(Zone* zone, bool is_getter, FunctionLiteral* value, |
+ bool is_static); |
void set_key(Literal* key) { key_ = key; } |
private: |
@@ -1486,6 +1489,7 @@ class ObjectLiteralProperty FINAL : public ZoneObject { |
Expression* value_; |
Kind kind_; |
bool emit_store_; |
+ bool is_static_; |
arv (Not doing code reviews)
2014/09/12 21:36:34
What was the conclusion on C++ bit field members?
Sven Panne
2014/09/15 11:13:05
I would leave it as it is, to avoid premature opti
rossberg
2014/09/15 12:32:48
Opinions still differ, better to avoid them for th
arv (Not doing code reviews)
2014/09/15 15:12:32
See later comment.
|
Handle<Map> receiver_type_; |
}; |
@@ -2498,6 +2502,40 @@ class FunctionLiteral FINAL : public Expression { |
}; |
+class ClassLiteral FINAL : public Expression { |
+ public: |
+ typedef ObjectLiteralProperty Property; |
+ |
+ DECLARE_NODE_TYPE(ClassLiteral) |
+ |
+ Handle<String> name() const { return raw_name_->string(); } |
+ const AstRawString* raw_name() const { return raw_name_; } |
+ Expression* extends() const { return extends_; } |
+ FunctionLiteral* constructor() const { return constructor_; } |
+ ZoneList<Property*>* properties() const { return properties_; } |
+ |
+ protected: |
+ ClassLiteral(Zone* zone, const AstRawString* name, Expression* extends, |
+ FunctionLiteral* constructor, ZoneList<Property*>* properties, |
+ AstValueFactory* ast_value_factory, int position, IdGen* id_gen) |
+ : Expression(zone, position, id_gen), |
+ raw_name_(name), |
+ raw_inferred_name_(ast_value_factory->empty_string()), |
+ extends_(extends), |
+ constructor_(constructor), |
+ properties_(properties) {} |
+ |
+ private: |
+ const AstRawString* raw_name_; |
+ Handle<String> name_; |
+ const AstString* raw_inferred_name_; |
+ Handle<String> inferred_name_; |
+ Expression* extends_; |
+ FunctionLiteral* constructor_; |
+ ZoneList<Property*>* properties_; |
+}; |
+ |
+ |
class NativeFunctionLiteral FINAL : public Expression { |
public: |
DECLARE_NODE_TYPE(NativeFunctionLiteral) |
@@ -3289,16 +3327,17 @@ class AstNodeFactory FINAL BASE_EMBEDDED { |
} |
ObjectLiteral::Property* NewObjectLiteralProperty(Literal* key, |
- Expression* value) { |
- return new (zone_) |
- ObjectLiteral::Property(zone_, ast_value_factory_, key, value); |
+ Expression* value, |
+ bool is_static) { |
+ return new (zone_) ObjectLiteral::Property(zone_, ast_value_factory_, key, |
+ value, is_static); |
} |
ObjectLiteral::Property* NewObjectLiteralProperty(bool is_getter, |
FunctionLiteral* value, |
- int pos) { |
+ int pos, bool is_static) { |
ObjectLiteral::Property* prop = |
- new(zone_) ObjectLiteral::Property(zone_, is_getter, value); |
+ new (zone_) ObjectLiteral::Property(zone_, is_getter, value, is_static); |
prop->set_key(NewStringLiteral(value->raw_name(), pos)); |
return prop; // Not an AST node, will not be visited. |
} |
@@ -3454,6 +3493,17 @@ class AstNodeFactory FINAL BASE_EMBEDDED { |
return lit; |
} |
+ ClassLiteral* NewClassLiteral(const AstRawString* name, Expression* extends, |
+ FunctionLiteral* constructor, |
+ ZoneList<ObjectLiteral::Property*>* properties, |
+ AstValueFactory* ast_value_factory, |
+ int position) { |
+ ClassLiteral* lit = |
+ new (zone_) ClassLiteral(zone_, name, extends, constructor, properties, |
+ ast_value_factory, position, id_gen_); |
+ VISIT_AND_RETURN(ClassLiteral, lit) |
+ } |
+ |
NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, |
v8::Extension* extension, |
int pos) { |