| Index: src/ast.h
|
| diff --git a/src/ast.h b/src/ast.h
|
| index 2e3b360f7896ad2084df4b6cd86747f86a2314e1..394e7f974a0742c2ea81e71377b693e38da2463f 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,7 @@ class ObjectLiteralProperty FINAL : public ZoneObject {
|
| };
|
|
|
| ObjectLiteralProperty(Zone* zone, AstValueFactory* ast_value_factory,
|
| - Literal* key, Expression* value);
|
| + Literal* key, Expression* value, bool is_static);
|
|
|
| Literal* key() { return key_; }
|
| Expression* value() { return value_; }
|
| @@ -1478,7 +1479,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 +1488,7 @@ class ObjectLiteralProperty FINAL : public ZoneObject {
|
| Expression* value_;
|
| Kind kind_;
|
| bool emit_store_;
|
| + bool is_static_;
|
| Handle<Map> receiver_type_;
|
| };
|
|
|
| @@ -2498,6 +2501,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)
|
| @@ -3300,16 +3337,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.
|
| }
|
| @@ -3465,6 +3503,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) {
|
|
|