Commit 3d35ecf3 authored by rossberg@chromium.org's avatar rossberg@chromium.org

Slightly simplify declaration of node types.

R=svenpanne@chromium.org
BUG=

Review URL: https://chromiumcodereview.appspot.com/10886010

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12405 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a6e45ce7
...@@ -158,7 +158,8 @@ typedef ZoneList<Handle<Object> > ZoneObjectList; ...@@ -158,7 +158,8 @@ typedef ZoneList<Handle<Object> > ZoneObjectList;
#define DECLARE_NODE_TYPE(type) \ #define DECLARE_NODE_TYPE(type) \
virtual void Accept(AstVisitor* v); \ virtual void Accept(AstVisitor* v); \
virtual AstNode::Type node_type() const { return AstNode::k##type; } virtual AstNode::Type node_type() const { return AstNode::k##type; } \
template<class> friend class AstNodeFactory;
enum AstPropertiesFlag { enum AstPropertiesFlag {
...@@ -419,8 +420,6 @@ class Block: public BreakableStatement { ...@@ -419,8 +420,6 @@ class Block: public BreakableStatement {
void set_scope(Scope* scope) { scope_ = scope; } void set_scope(Scope* scope) { scope_ = scope; }
protected: protected:
template<class> friend class AstNodeFactory;
Block(Isolate* isolate, Block(Isolate* isolate,
ZoneStringList* labels, ZoneStringList* labels,
int capacity, int capacity,
...@@ -475,8 +474,6 @@ class VariableDeclaration: public Declaration { ...@@ -475,8 +474,6 @@ class VariableDeclaration: public Declaration {
} }
protected: protected:
template<class> friend class AstNodeFactory;
VariableDeclaration(VariableProxy* proxy, VariableDeclaration(VariableProxy* proxy,
VariableMode mode, VariableMode mode,
Scope* scope) Scope* scope)
...@@ -496,8 +493,6 @@ class FunctionDeclaration: public Declaration { ...@@ -496,8 +493,6 @@ class FunctionDeclaration: public Declaration {
virtual bool IsInlineable() const; virtual bool IsInlineable() const;
protected: protected:
template<class> friend class AstNodeFactory;
FunctionDeclaration(VariableProxy* proxy, FunctionDeclaration(VariableProxy* proxy,
VariableMode mode, VariableMode mode,
FunctionLiteral* fun, FunctionLiteral* fun,
...@@ -524,8 +519,6 @@ class ModuleDeclaration: public Declaration { ...@@ -524,8 +519,6 @@ class ModuleDeclaration: public Declaration {
} }
protected: protected:
template<class> friend class AstNodeFactory;
ModuleDeclaration(VariableProxy* proxy, ModuleDeclaration(VariableProxy* proxy,
Module* module, Module* module,
Scope* scope) Scope* scope)
...@@ -548,8 +541,6 @@ class ImportDeclaration: public Declaration { ...@@ -548,8 +541,6 @@ class ImportDeclaration: public Declaration {
} }
protected: protected:
template<class> friend class AstNodeFactory;
ImportDeclaration(VariableProxy* proxy, ImportDeclaration(VariableProxy* proxy,
Module* module, Module* module,
Scope* scope) Scope* scope)
...@@ -571,8 +562,6 @@ class ExportDeclaration: public Declaration { ...@@ -571,8 +562,6 @@ class ExportDeclaration: public Declaration {
} }
protected: protected:
template<class> friend class AstNodeFactory;
ExportDeclaration(VariableProxy* proxy, Scope* scope) ExportDeclaration(VariableProxy* proxy, Scope* scope)
: Declaration(proxy, LET, scope) {} : Declaration(proxy, LET, scope) {}
}; };
...@@ -602,8 +591,6 @@ class ModuleLiteral: public Module { ...@@ -602,8 +591,6 @@ class ModuleLiteral: public Module {
DECLARE_NODE_TYPE(ModuleLiteral) DECLARE_NODE_TYPE(ModuleLiteral)
protected: protected:
template<class> friend class AstNodeFactory;
ModuleLiteral(Block* body, Interface* interface) : Module(interface, body) {} ModuleLiteral(Block* body, Interface* interface) : Module(interface, body) {}
}; };
...@@ -615,8 +602,6 @@ class ModuleVariable: public Module { ...@@ -615,8 +602,6 @@ class ModuleVariable: public Module {
VariableProxy* proxy() const { return proxy_; } VariableProxy* proxy() const { return proxy_; }
protected: protected:
template<class> friend class AstNodeFactory;
inline explicit ModuleVariable(VariableProxy* proxy); inline explicit ModuleVariable(VariableProxy* proxy);
private: private:
...@@ -632,8 +617,6 @@ class ModulePath: public Module { ...@@ -632,8 +617,6 @@ class ModulePath: public Module {
Handle<String> name() const { return name_; } Handle<String> name() const { return name_; }
protected: protected:
template<class> friend class AstNodeFactory;
ModulePath(Module* module, Handle<String> name, Zone* zone) ModulePath(Module* module, Handle<String> name, Zone* zone)
: Module(zone), : Module(zone),
module_(module), module_(module),
...@@ -653,8 +636,6 @@ class ModuleUrl: public Module { ...@@ -653,8 +636,6 @@ class ModuleUrl: public Module {
Handle<String> url() const { return url_; } Handle<String> url() const { return url_; }
protected: protected:
template<class> friend class AstNodeFactory;
ModuleUrl(Handle<String> url, Zone* zone) ModuleUrl(Handle<String> url, Zone* zone)
: Module(zone), url_(url) { : Module(zone), url_(url) {
} }
...@@ -717,8 +698,6 @@ class DoWhileStatement: public IterationStatement { ...@@ -717,8 +698,6 @@ class DoWhileStatement: public IterationStatement {
BailoutId BackEdgeId() const { return back_edge_id_; } BailoutId BackEdgeId() const { return back_edge_id_; }
protected: protected:
template<class> friend class AstNodeFactory;
DoWhileStatement(Isolate* isolate, ZoneStringList* labels) DoWhileStatement(Isolate* isolate, ZoneStringList* labels)
: IterationStatement(isolate, labels), : IterationStatement(isolate, labels),
cond_(NULL), cond_(NULL),
...@@ -757,8 +736,6 @@ class WhileStatement: public IterationStatement { ...@@ -757,8 +736,6 @@ class WhileStatement: public IterationStatement {
BailoutId BodyId() const { return body_id_; } BailoutId BodyId() const { return body_id_; }
protected: protected:
template<class> friend class AstNodeFactory;
WhileStatement(Isolate* isolate, ZoneStringList* labels) WhileStatement(Isolate* isolate, ZoneStringList* labels)
: IterationStatement(isolate, labels), : IterationStatement(isolate, labels),
cond_(NULL), cond_(NULL),
...@@ -808,8 +785,6 @@ class ForStatement: public IterationStatement { ...@@ -808,8 +785,6 @@ class ForStatement: public IterationStatement {
void set_loop_variable(Variable* var) { loop_variable_ = var; } void set_loop_variable(Variable* var) { loop_variable_ = var; }
protected: protected:
template<class> friend class AstNodeFactory;
ForStatement(Isolate* isolate, ZoneStringList* labels) ForStatement(Isolate* isolate, ZoneStringList* labels)
: IterationStatement(isolate, labels), : IterationStatement(isolate, labels),
init_(NULL), init_(NULL),
...@@ -854,8 +829,6 @@ class ForInStatement: public IterationStatement { ...@@ -854,8 +829,6 @@ class ForInStatement: public IterationStatement {
TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); } TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); }
protected: protected:
template<class> friend class AstNodeFactory;
ForInStatement(Isolate* isolate, ZoneStringList* labels) ForInStatement(Isolate* isolate, ZoneStringList* labels)
: IterationStatement(isolate, labels), : IterationStatement(isolate, labels),
each_(NULL), each_(NULL),
...@@ -880,8 +853,6 @@ class ExpressionStatement: public Statement { ...@@ -880,8 +853,6 @@ class ExpressionStatement: public Statement {
Expression* expression() const { return expression_; } Expression* expression() const { return expression_; }
protected: protected:
template<class> friend class AstNodeFactory;
explicit ExpressionStatement(Expression* expression) explicit ExpressionStatement(Expression* expression)
: expression_(expression) { } : expression_(expression) { }
...@@ -897,8 +868,6 @@ class ContinueStatement: public Statement { ...@@ -897,8 +868,6 @@ class ContinueStatement: public Statement {
IterationStatement* target() const { return target_; } IterationStatement* target() const { return target_; }
protected: protected:
template<class> friend class AstNodeFactory;
explicit ContinueStatement(IterationStatement* target) explicit ContinueStatement(IterationStatement* target)
: target_(target) { } : target_(target) { }
...@@ -914,8 +883,6 @@ class BreakStatement: public Statement { ...@@ -914,8 +883,6 @@ class BreakStatement: public Statement {
BreakableStatement* target() const { return target_; } BreakableStatement* target() const { return target_; }
protected: protected:
template<class> friend class AstNodeFactory;
explicit BreakStatement(BreakableStatement* target) explicit BreakStatement(BreakableStatement* target)
: target_(target) { } : target_(target) { }
...@@ -931,8 +898,6 @@ class ReturnStatement: public Statement { ...@@ -931,8 +898,6 @@ class ReturnStatement: public Statement {
Expression* expression() const { return expression_; } Expression* expression() const { return expression_; }
protected: protected:
template<class> friend class AstNodeFactory;
explicit ReturnStatement(Expression* expression) explicit ReturnStatement(Expression* expression)
: expression_(expression) { } : expression_(expression) { }
...@@ -949,8 +914,6 @@ class WithStatement: public Statement { ...@@ -949,8 +914,6 @@ class WithStatement: public Statement {
Statement* statement() const { return statement_; } Statement* statement() const { return statement_; }
protected: protected:
template<class> friend class AstNodeFactory;
WithStatement(Expression* expression, Statement* statement) WithStatement(Expression* expression, Statement* statement)
: expression_(expression), : expression_(expression),
statement_(statement) { } statement_(statement) { }
...@@ -1020,8 +983,6 @@ class SwitchStatement: public BreakableStatement { ...@@ -1020,8 +983,6 @@ class SwitchStatement: public BreakableStatement {
ZoneList<CaseClause*>* cases() const { return cases_; } ZoneList<CaseClause*>* cases() const { return cases_; }
protected: protected:
template<class> friend class AstNodeFactory;
SwitchStatement(Isolate* isolate, ZoneStringList* labels) SwitchStatement(Isolate* isolate, ZoneStringList* labels)
: BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS), : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS),
tag_(NULL), tag_(NULL),
...@@ -1054,8 +1015,6 @@ class IfStatement: public Statement { ...@@ -1054,8 +1015,6 @@ class IfStatement: public Statement {
BailoutId ElseId() const { return else_id_; } BailoutId ElseId() const { return else_id_; }
protected: protected:
template<class> friend class AstNodeFactory;
IfStatement(Isolate* isolate, IfStatement(Isolate* isolate,
Expression* condition, Expression* condition,
Statement* then_statement, Statement* then_statement,
...@@ -1135,8 +1094,6 @@ class TryCatchStatement: public TryStatement { ...@@ -1135,8 +1094,6 @@ class TryCatchStatement: public TryStatement {
Block* catch_block() const { return catch_block_; } Block* catch_block() const { return catch_block_; }
protected: protected:
template<class> friend class AstNodeFactory;
TryCatchStatement(int index, TryCatchStatement(int index,
Block* try_block, Block* try_block,
Scope* scope, Scope* scope,
...@@ -1162,8 +1119,6 @@ class TryFinallyStatement: public TryStatement { ...@@ -1162,8 +1119,6 @@ class TryFinallyStatement: public TryStatement {
Block* finally_block() const { return finally_block_; } Block* finally_block() const { return finally_block_; }
protected: protected:
template<class> friend class AstNodeFactory;
TryFinallyStatement(int index, Block* try_block, Block* finally_block) TryFinallyStatement(int index, Block* try_block, Block* finally_block)
: TryStatement(index, try_block), : TryStatement(index, try_block),
finally_block_(finally_block) { } finally_block_(finally_block) { }
...@@ -1178,8 +1133,6 @@ class DebuggerStatement: public Statement { ...@@ -1178,8 +1133,6 @@ class DebuggerStatement: public Statement {
DECLARE_NODE_TYPE(DebuggerStatement) DECLARE_NODE_TYPE(DebuggerStatement)
protected: protected:
template<class> friend class AstNodeFactory;
DebuggerStatement() {} DebuggerStatement() {}
}; };
...@@ -1189,8 +1142,6 @@ class EmptyStatement: public Statement { ...@@ -1189,8 +1142,6 @@ class EmptyStatement: public Statement {
DECLARE_NODE_TYPE(EmptyStatement) DECLARE_NODE_TYPE(EmptyStatement)
protected: protected:
template<class> friend class AstNodeFactory;
EmptyStatement() {} EmptyStatement() {}
}; };
...@@ -1244,8 +1195,6 @@ class Literal: public Expression { ...@@ -1244,8 +1195,6 @@ class Literal: public Expression {
TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); } TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); }
protected: protected:
template<class> friend class AstNodeFactory;
Literal(Isolate* isolate, Handle<Object> handle) Literal(Isolate* isolate, Handle<Object> handle)
: Expression(isolate), : Expression(isolate),
handle_(handle) { } handle_(handle) { }
...@@ -1363,8 +1312,6 @@ class ObjectLiteral: public MaterializedLiteral { ...@@ -1363,8 +1312,6 @@ class ObjectLiteral: public MaterializedLiteral {
}; };
protected: protected:
template<class> friend class AstNodeFactory;
ObjectLiteral(Isolate* isolate, ObjectLiteral(Isolate* isolate,
Handle<FixedArray> constant_properties, Handle<FixedArray> constant_properties,
ZoneList<Property*>* properties, ZoneList<Property*>* properties,
...@@ -1396,8 +1343,6 @@ class RegExpLiteral: public MaterializedLiteral { ...@@ -1396,8 +1343,6 @@ class RegExpLiteral: public MaterializedLiteral {
Handle<String> flags() const { return flags_; } Handle<String> flags() const { return flags_; }
protected: protected:
template<class> friend class AstNodeFactory;
RegExpLiteral(Isolate* isolate, RegExpLiteral(Isolate* isolate,
Handle<String> pattern, Handle<String> pattern,
Handle<String> flags, Handle<String> flags,
...@@ -1426,8 +1371,6 @@ class ArrayLiteral: public MaterializedLiteral { ...@@ -1426,8 +1371,6 @@ class ArrayLiteral: public MaterializedLiteral {
} }
protected: protected:
template<class> friend class AstNodeFactory;
ArrayLiteral(Isolate* isolate, ArrayLiteral(Isolate* isolate,
Handle<FixedArray> constant_elements, Handle<FixedArray> constant_elements,
ZoneList<Expression*>* values, ZoneList<Expression*>* values,
...@@ -1478,8 +1421,6 @@ class VariableProxy: public Expression { ...@@ -1478,8 +1421,6 @@ class VariableProxy: public Expression {
void BindTo(Variable* var); void BindTo(Variable* var);
protected: protected:
template<class> friend class AstNodeFactory;
VariableProxy(Isolate* isolate, Variable* var); VariableProxy(Isolate* isolate, Variable* var);
VariableProxy(Isolate* isolate, VariableProxy(Isolate* isolate,
...@@ -1525,8 +1466,6 @@ class Property: public Expression { ...@@ -1525,8 +1466,6 @@ class Property: public Expression {
TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } TypeFeedbackId PropertyFeedbackId() { return reuse(id()); }
protected: protected:
template<class> friend class AstNodeFactory;
Property(Isolate* isolate, Property(Isolate* isolate,
Expression* obj, Expression* obj,
Expression* key, Expression* key,
...@@ -1593,8 +1532,6 @@ class Call: public Expression { ...@@ -1593,8 +1532,6 @@ class Call: public Expression {
#endif #endif
protected: protected:
template<class> friend class AstNodeFactory;
Call(Isolate* isolate, Call(Isolate* isolate,
Expression* expression, Expression* expression,
ZoneList<Expression*>* arguments, ZoneList<Expression*>* arguments,
...@@ -1640,8 +1577,6 @@ class CallNew: public Expression { ...@@ -1640,8 +1577,6 @@ class CallNew: public Expression {
BailoutId ReturnId() const { return return_id_; } BailoutId ReturnId() const { return return_id_; }
protected: protected:
template<class> friend class AstNodeFactory;
CallNew(Isolate* isolate, CallNew(Isolate* isolate,
Expression* expression, Expression* expression,
ZoneList<Expression*>* arguments, ZoneList<Expression*>* arguments,
...@@ -1681,8 +1616,6 @@ class CallRuntime: public Expression { ...@@ -1681,8 +1616,6 @@ class CallRuntime: public Expression {
TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); }
protected: protected:
template<class> friend class AstNodeFactory;
CallRuntime(Isolate* isolate, CallRuntime(Isolate* isolate,
Handle<String> name, Handle<String> name,
const Runtime::Function* function, const Runtime::Function* function,
...@@ -1715,8 +1648,6 @@ class UnaryOperation: public Expression { ...@@ -1715,8 +1648,6 @@ class UnaryOperation: public Expression {
TypeFeedbackId UnaryOperationFeedbackId() const { return reuse(id()); } TypeFeedbackId UnaryOperationFeedbackId() const { return reuse(id()); }
protected: protected:
template<class> friend class AstNodeFactory;
UnaryOperation(Isolate* isolate, UnaryOperation(Isolate* isolate,
Token::Value op, Token::Value op,
Expression* expression, Expression* expression,
...@@ -1758,8 +1689,6 @@ class BinaryOperation: public Expression { ...@@ -1758,8 +1689,6 @@ class BinaryOperation: public Expression {
TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); }
protected: protected:
template<class> friend class AstNodeFactory;
BinaryOperation(Isolate* isolate, BinaryOperation(Isolate* isolate,
Token::Value op, Token::Value op,
Expression* left, Expression* left,
...@@ -1812,8 +1741,6 @@ class CountOperation: public Expression { ...@@ -1812,8 +1741,6 @@ class CountOperation: public Expression {
TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); }
protected: protected:
template<class> friend class AstNodeFactory;
CountOperation(Isolate* isolate, CountOperation(Isolate* isolate,
Token::Value op, Token::Value op,
bool is_prefix, bool is_prefix,
...@@ -1860,8 +1787,6 @@ class CompareOperation: public Expression { ...@@ -1860,8 +1787,6 @@ class CompareOperation: public Expression {
bool IsLiteralCompareNull(Expression** expr); bool IsLiteralCompareNull(Expression** expr);
protected: protected:
template<class> friend class AstNodeFactory;
CompareOperation(Isolate* isolate, CompareOperation(Isolate* isolate,
Token::Value op, Token::Value op,
Expression* left, Expression* left,
...@@ -1902,8 +1827,6 @@ class Conditional: public Expression { ...@@ -1902,8 +1827,6 @@ class Conditional: public Expression {
BailoutId ElseId() const { return else_id_; } BailoutId ElseId() const { return else_id_; }
protected: protected:
template<class> friend class AstNodeFactory;
Conditional(Isolate* isolate, Conditional(Isolate* isolate,
Expression* condition, Expression* condition,
Expression* then_expression, Expression* then_expression,
...@@ -1965,8 +1888,6 @@ class Assignment: public Expression { ...@@ -1965,8 +1888,6 @@ class Assignment: public Expression {
virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; }
protected: protected:
template<class> friend class AstNodeFactory;
Assignment(Isolate* isolate, Assignment(Isolate* isolate,
Token::Value op, Token::Value op,
Expression* target, Expression* target,
...@@ -2006,8 +1927,6 @@ class Throw: public Expression { ...@@ -2006,8 +1927,6 @@ class Throw: public Expression {
virtual int position() const { return pos_; } virtual int position() const { return pos_; }
protected: protected:
template<class> friend class AstNodeFactory;
Throw(Isolate* isolate, Expression* exception, int pos) Throw(Isolate* isolate, Expression* exception, int pos)
: Expression(isolate), exception_(exception), pos_(pos) {} : Expression(isolate), exception_(exception), pos_(pos) {}
...@@ -2107,8 +2026,6 @@ class FunctionLiteral: public Expression { ...@@ -2107,8 +2026,6 @@ class FunctionLiteral: public Expression {
} }
protected: protected:
template<class> friend class AstNodeFactory;
FunctionLiteral(Isolate* isolate, FunctionLiteral(Isolate* isolate,
Handle<String> name, Handle<String> name,
Scope* scope, Scope* scope,
...@@ -2179,8 +2096,6 @@ class SharedFunctionInfoLiteral: public Expression { ...@@ -2179,8 +2096,6 @@ class SharedFunctionInfoLiteral: public Expression {
} }
protected: protected:
template<class> friend class AstNodeFactory;
SharedFunctionInfoLiteral( SharedFunctionInfoLiteral(
Isolate* isolate, Isolate* isolate,
Handle<SharedFunctionInfo> shared_function_info) Handle<SharedFunctionInfo> shared_function_info)
...@@ -2197,8 +2112,6 @@ class ThisFunction: public Expression { ...@@ -2197,8 +2112,6 @@ class ThisFunction: public Expression {
DECLARE_NODE_TYPE(ThisFunction) DECLARE_NODE_TYPE(ThisFunction)
protected: protected:
template<class> friend class AstNodeFactory;
explicit ThisFunction(Isolate* isolate): Expression(isolate) {} explicit ThisFunction(Isolate* isolate): Expression(isolate) {}
}; };
......
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