OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_AST_AST_H_ | 5 #ifndef V8_AST_AST_H_ |
6 #define V8_AST_AST_H_ | 6 #define V8_AST_AST_H_ |
7 | 7 |
8 #include "src/ast/ast-value-factory.h" | 8 #include "src/ast/ast-value-factory.h" |
9 #include "src/ast/modules.h" | 9 #include "src/ast/modules.h" |
10 #include "src/ast/variables.h" | 10 #include "src/ast/variables.h" |
(...skipping 3216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3227 DebuggerStatement* NewDebuggerStatement(int pos) { | 3227 DebuggerStatement* NewDebuggerStatement(int pos) { |
3228 return new (local_zone_) DebuggerStatement(local_zone_, pos); | 3228 return new (local_zone_) DebuggerStatement(local_zone_, pos); |
3229 } | 3229 } |
3230 | 3230 |
3231 EmptyStatement* NewEmptyStatement(int pos) { | 3231 EmptyStatement* NewEmptyStatement(int pos) { |
3232 return new (local_zone_) EmptyStatement(local_zone_, pos); | 3232 return new (local_zone_) EmptyStatement(local_zone_, pos); |
3233 } | 3233 } |
3234 | 3234 |
3235 SloppyBlockFunctionStatement* NewSloppyBlockFunctionStatement( | 3235 SloppyBlockFunctionStatement* NewSloppyBlockFunctionStatement( |
3236 Statement* statement, Scope* scope) { | 3236 Statement* statement, Scope* scope) { |
3237 return new (parser_zone_) | 3237 return new (local_zone_) |
3238 SloppyBlockFunctionStatement(parser_zone_, statement, scope); | 3238 SloppyBlockFunctionStatement(local_zone_, statement, scope); |
3239 } | 3239 } |
3240 | 3240 |
3241 CaseClause* NewCaseClause( | 3241 CaseClause* NewCaseClause( |
3242 Expression* label, ZoneList<Statement*>* statements, int pos) { | 3242 Expression* label, ZoneList<Statement*>* statements, int pos) { |
3243 return new (local_zone_) CaseClause(local_zone_, label, statements, pos); | 3243 return new (local_zone_) CaseClause(local_zone_, label, statements, pos); |
3244 } | 3244 } |
3245 | 3245 |
3246 Literal* NewStringLiteral(const AstRawString* string, int pos) { | 3246 Literal* NewStringLiteral(const AstRawString* string, int pos) { |
3247 return new (local_zone_) | 3247 return new (local_zone_) |
3248 Literal(local_zone_, ast_value_factory_->NewString(string), pos); | 3248 Literal(local_zone_, ast_value_factory_->NewString(string), pos); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3463 function_type, has_duplicate_parameters, eager_compile_hint, kind, | 3463 function_type, has_duplicate_parameters, eager_compile_hint, kind, |
3464 position, true); | 3464 position, true); |
3465 } | 3465 } |
3466 | 3466 |
3467 // Creates a FunctionLiteral representing a top-level script, the | 3467 // Creates a FunctionLiteral representing a top-level script, the |
3468 // result of an eval (top-level or otherwise), or the result of calling | 3468 // result of an eval (top-level or otherwise), or the result of calling |
3469 // the Function constructor. | 3469 // the Function constructor. |
3470 FunctionLiteral* NewScriptOrEvalFunctionLiteral( | 3470 FunctionLiteral* NewScriptOrEvalFunctionLiteral( |
3471 Scope* scope, ZoneList<Statement*>* body, int materialized_literal_count, | 3471 Scope* scope, ZoneList<Statement*>* body, int materialized_literal_count, |
3472 int expected_property_count) { | 3472 int expected_property_count) { |
3473 return new (parser_zone_) FunctionLiteral( | 3473 return new (local_zone_) FunctionLiteral( |
3474 parser_zone_, ast_value_factory_->empty_string(), ast_value_factory_, | 3474 local_zone_, ast_value_factory_->empty_string(), ast_value_factory_, |
3475 scope, body, materialized_literal_count, expected_property_count, 0, | 3475 scope, body, materialized_literal_count, expected_property_count, 0, |
3476 FunctionLiteral::kAnonymousExpression, | 3476 FunctionLiteral::kAnonymousExpression, |
3477 FunctionLiteral::kNoDuplicateParameters, | 3477 FunctionLiteral::kNoDuplicateParameters, |
3478 FunctionLiteral::kShouldLazyCompile, FunctionKind::kNormalFunction, 0, | 3478 FunctionLiteral::kShouldLazyCompile, FunctionKind::kNormalFunction, 0, |
3479 false); | 3479 false); |
3480 } | 3480 } |
3481 | 3481 |
3482 ClassLiteral* NewClassLiteral(Scope* scope, VariableProxy* proxy, | 3482 ClassLiteral* NewClassLiteral(Scope* scope, VariableProxy* proxy, |
3483 Expression* extends, | 3483 Expression* extends, |
3484 FunctionLiteral* constructor, | 3484 FunctionLiteral* constructor, |
3485 ZoneList<ObjectLiteral::Property*>* properties, | 3485 ZoneList<ObjectLiteral::Property*>* properties, |
3486 int start_position, int end_position) { | 3486 int start_position, int end_position) { |
3487 return new (parser_zone_) | 3487 return new (local_zone_) |
3488 ClassLiteral(parser_zone_, scope, proxy, extends, constructor, | 3488 ClassLiteral(local_zone_, scope, proxy, extends, constructor, |
3489 properties, start_position, end_position); | 3489 properties, start_position, end_position); |
3490 } | 3490 } |
3491 | 3491 |
3492 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, | 3492 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, |
3493 v8::Extension* extension, | 3493 v8::Extension* extension, |
3494 int pos) { | 3494 int pos) { |
3495 return new (parser_zone_) | 3495 return new (local_zone_) |
3496 NativeFunctionLiteral(parser_zone_, name, extension, pos); | 3496 NativeFunctionLiteral(local_zone_, name, extension, pos); |
3497 } | 3497 } |
3498 | 3498 |
3499 DoExpression* NewDoExpression(Block* block, Variable* result_var, int pos) { | 3499 DoExpression* NewDoExpression(Block* block, Variable* result_var, int pos) { |
3500 VariableProxy* result = NewVariableProxy(result_var, pos); | 3500 VariableProxy* result = NewVariableProxy(result_var, pos); |
3501 return new (local_zone_) DoExpression(local_zone_, block, result, pos); | 3501 return new (local_zone_) DoExpression(local_zone_, block, result, pos); |
3502 } | 3502 } |
3503 | 3503 |
3504 ThisFunction* NewThisFunction(int pos) { | 3504 ThisFunction* NewThisFunction(int pos) { |
3505 return new (local_zone_) ThisFunction(local_zone_, pos); | 3505 return new (local_zone_) ThisFunction(local_zone_, pos); |
3506 } | 3506 } |
3507 | 3507 |
3508 SuperPropertyReference* NewSuperPropertyReference(VariableProxy* this_var, | 3508 SuperPropertyReference* NewSuperPropertyReference(VariableProxy* this_var, |
3509 Expression* home_object, | 3509 Expression* home_object, |
3510 int pos) { | 3510 int pos) { |
3511 return new (parser_zone_) | 3511 return new (local_zone_) |
3512 SuperPropertyReference(parser_zone_, this_var, home_object, pos); | 3512 SuperPropertyReference(local_zone_, this_var, home_object, pos); |
3513 } | 3513 } |
3514 | 3514 |
3515 SuperCallReference* NewSuperCallReference(VariableProxy* this_var, | 3515 SuperCallReference* NewSuperCallReference(VariableProxy* this_var, |
3516 VariableProxy* new_target_var, | 3516 VariableProxy* new_target_var, |
3517 VariableProxy* this_function_var, | 3517 VariableProxy* this_function_var, |
3518 int pos) { | 3518 int pos) { |
3519 return new (parser_zone_) SuperCallReference( | 3519 return new (local_zone_) SuperCallReference( |
3520 parser_zone_, this_var, new_target_var, this_function_var, pos); | 3520 local_zone_, this_var, new_target_var, this_function_var, pos); |
3521 } | 3521 } |
3522 | 3522 |
3523 EmptyParentheses* NewEmptyParentheses(int pos) { | 3523 EmptyParentheses* NewEmptyParentheses(int pos) { |
3524 return new (local_zone_) EmptyParentheses(local_zone_, pos); | 3524 return new (local_zone_) EmptyParentheses(local_zone_, pos); |
3525 } | 3525 } |
3526 | 3526 |
3527 Zone* zone() const { return local_zone_; } | 3527 Zone* zone() const { return local_zone_; } |
3528 | 3528 |
3529 // Handles use of temporary zones when parsing inner function bodies. | 3529 // Handles use of temporary zones when parsing inner function bodies. |
3530 class BodyScope { | 3530 class BodyScope { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3593 : NULL; \ | 3593 : NULL; \ |
3594 } | 3594 } |
3595 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3595 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3596 #undef DECLARE_NODE_FUNCTIONS | 3596 #undef DECLARE_NODE_FUNCTIONS |
3597 | 3597 |
3598 | 3598 |
3599 } // namespace internal | 3599 } // namespace internal |
3600 } // namespace v8 | 3600 } // namespace v8 |
3601 | 3601 |
3602 #endif // V8_AST_AST_H_ | 3602 #endif // V8_AST_AST_H_ |
OLD | NEW |