ext/include/iv/ast_factory.h in iv-phonic-0.0.9 vs ext/include/iv/ast_factory.h in iv-phonic-0.1.0

- old
+ new

@@ -77,30 +77,29 @@ FunctionLiteral* NewFunctionLiteral(typename FunctionLiteral::DeclType type) { return new (static_cast<Factory*>(this)) FunctionLiteral(type, static_cast<Factory*>(this)); } - ArrayLiteral* NewArrayLiteral() { - return new (static_cast<Factory*>(this)) - ArrayLiteral(static_cast<Factory*>(this)); + ArrayLiteral* NewArrayLiteral(Expressions* items) { + return new (static_cast<Factory*>(this)) ArrayLiteral(items); } - ObjectLiteral* NewObjectLiteral() { - return new (static_cast<Factory*>(this)) - ObjectLiteral(static_cast<Factory*>(this)); + ObjectLiteral* + NewObjectLiteral(typename ObjectLiteral::Properties* properties) { + return new (static_cast<Factory*>(this)) ObjectLiteral(properties); } template<typename T> T** NewPtr() { - return new (static_cast<Factory*>(this)->New(sizeof(T*))) T*(NULL); + return new (static_cast<Factory*>(this)->New(sizeof(T*))) T*(NULL); // NOLINT } - Identifiers* NewLabels() { - void* place = static_cast<Factory*>(this)->New(sizeof(Identifiers)); - return new (place) - Identifiers( - typename Identifiers::allocator_type(static_cast<Factory*>(this))); + template<typename T> + typename SpaceVector<Factory, T>::type* NewVector() { + typedef typename SpaceVector<Factory, T>::type Vector; + return new (static_cast<Factory*>(this)->New(sizeof(Vector))) + Vector(typename Vector::allocator_type(static_cast<Factory*>(this))); } NullLiteral* NewNullLiteral() { return null_instance_; } @@ -135,17 +134,18 @@ FunctionDeclaration* NewFunctionDeclaration(FunctionLiteral* func) { return new (static_cast<Factory*>(this)) FunctionDeclaration(func); } - Block* NewBlock() { - return new (static_cast<Factory*>(this)) Block(static_cast<Factory*>(this)); + Block* NewBlock(Statements* body) { + return new (static_cast<Factory*>(this)) Block(body); } - VariableStatement* NewVariableStatement(Token::Type token) { + VariableStatement* NewVariableStatement(Token::Type token, + Declarations* decls) { return new (static_cast<Factory*>(this)) - VariableStatement(token, static_cast<Factory*>(this)); + VariableStatement(token, decls); } Declaration* NewDeclaration(Identifier* name, Expression* expr) { return new (static_cast<Factory*>(this)) Declaration(name, expr); } @@ -205,18 +205,17 @@ WithStatement* NewWithStatement( Expression* expr, Statement* stmt) { return new (static_cast<Factory*>(this)) WithStatement(expr, stmt); } - SwitchStatement* NewSwitchStatement(Expression* expr) { - return new (static_cast<Factory*>(this)) - SwitchStatement(expr, static_cast<Factory*>(this)); + SwitchStatement* NewSwitchStatement(Expression* expr, CaseClauses* clauses) { + return new (static_cast<Factory*>(this)) SwitchStatement(expr, clauses); } - CaseClause* NewCaseClause(bool is_default, Expression* expr) { - return new (static_cast<Factory*>(this)) - CaseClause(is_default, expr, static_cast<Factory*>(this)); + CaseClause* NewCaseClause(bool is_default, + Expression* expr, Statements* body) { + return new (static_cast<Factory*>(this)) CaseClause(is_default, expr, body); } ThrowStatement* NewThrowStatement(Expression* expr) { return new (static_cast<Factory*>(this)) ThrowStatement(expr); } @@ -262,17 +261,15 @@ PostfixExpression* NewPostfixExpression( Token::Type op, Expression* expr) { return new (static_cast<Factory*>(this)) PostfixExpression(op, expr); } - FunctionCall* NewFunctionCall(Expression* expr) { - return new (static_cast<Factory*>(this)) - FunctionCall(expr, static_cast<Factory*>(this)); + FunctionCall* NewFunctionCall(Expression* expr, Expressions* args) { + return new (static_cast<Factory*>(this)) FunctionCall(expr, args); } - ConstructorCall* NewConstructorCall(Expression* target) { - return new (static_cast<Factory*>(this)) - ConstructorCall(target, static_cast<Factory*>(this)); + ConstructorCall* NewConstructorCall(Expression* target, Expressions* args) { + return new (static_cast<Factory*>(this)) ConstructorCall(target, args); } IndexAccess* NewIndexAccess(Expression* expr, Expression* index) { return new (static_cast<Factory*>(this)) IndexAccess(expr, index);