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_H_ | 5 #ifndef V8_AST_H_ |
6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
(...skipping 2603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2614 public: | 2614 public: |
2615 typedef ObjectLiteralProperty Property; | 2615 typedef ObjectLiteralProperty Property; |
2616 | 2616 |
2617 DECLARE_NODE_TYPE(ClassLiteral) | 2617 DECLARE_NODE_TYPE(ClassLiteral) |
2618 | 2618 |
2619 Handle<String> name() const { return raw_name_->string(); } | 2619 Handle<String> name() const { return raw_name_->string(); } |
2620 const AstRawString* raw_name() const { return raw_name_; } | 2620 const AstRawString* raw_name() const { return raw_name_; } |
2621 Scope* scope() const { return scope_; } | 2621 Scope* scope() const { return scope_; } |
2622 VariableProxy* class_variable_proxy() const { return class_variable_proxy_; } | 2622 VariableProxy* class_variable_proxy() const { return class_variable_proxy_; } |
2623 Expression* extends() const { return extends_; } | 2623 Expression* extends() const { return extends_; } |
2624 Expression* constructor() const { return constructor_; } | 2624 FunctionLiteral* constructor() const { return constructor_; } |
2625 ZoneList<Property*>* properties() const { return properties_; } | 2625 ZoneList<Property*>* properties() const { return properties_; } |
2626 int start_position() const { return position(); } | 2626 int start_position() const { return position(); } |
2627 int end_position() const { return end_position_; } | 2627 int end_position() const { return end_position_; } |
2628 | 2628 |
2629 static int num_ids() { return parent_num_ids() + 3; } | 2629 static int num_ids() { return parent_num_ids() + 3; } |
2630 BailoutId EntryId() const { return BailoutId(local_id(0)); } | 2630 BailoutId EntryId() const { return BailoutId(local_id(0)); } |
2631 BailoutId DeclsId() const { return BailoutId(local_id(1)); } | 2631 BailoutId DeclsId() const { return BailoutId(local_id(1)); } |
2632 BailoutId ExitId() { return BailoutId(local_id(2)); } | 2632 BailoutId ExitId() { return BailoutId(local_id(2)); } |
2633 | 2633 |
2634 protected: | 2634 protected: |
2635 ClassLiteral(Zone* zone, const AstRawString* name, Scope* scope, | 2635 ClassLiteral(Zone* zone, const AstRawString* name, Scope* scope, |
2636 VariableProxy* class_variable_proxy, Expression* extends, | 2636 VariableProxy* class_variable_proxy, Expression* extends, |
2637 Expression* constructor, ZoneList<Property*>* properties, | 2637 FunctionLiteral* constructor, ZoneList<Property*>* properties, |
2638 int start_position, int end_position) | 2638 int start_position, int end_position) |
2639 : Expression(zone, start_position), | 2639 : Expression(zone, start_position), |
2640 raw_name_(name), | 2640 raw_name_(name), |
2641 scope_(scope), | 2641 scope_(scope), |
2642 class_variable_proxy_(class_variable_proxy), | 2642 class_variable_proxy_(class_variable_proxy), |
2643 extends_(extends), | 2643 extends_(extends), |
2644 constructor_(constructor), | 2644 constructor_(constructor), |
2645 properties_(properties), | 2645 properties_(properties), |
2646 end_position_(end_position) {} | 2646 end_position_(end_position) {} |
2647 static int parent_num_ids() { return Expression::num_ids(); } | 2647 static int parent_num_ids() { return Expression::num_ids(); } |
2648 | 2648 |
2649 private: | 2649 private: |
2650 int local_id(int n) const { return base_id() + parent_num_ids() + n; } | 2650 int local_id(int n) const { return base_id() + parent_num_ids() + n; } |
2651 | 2651 |
2652 const AstRawString* raw_name_; | 2652 const AstRawString* raw_name_; |
2653 Scope* scope_; | 2653 Scope* scope_; |
2654 VariableProxy* class_variable_proxy_; | 2654 VariableProxy* class_variable_proxy_; |
2655 Expression* extends_; | 2655 Expression* extends_; |
2656 Expression* constructor_; | 2656 FunctionLiteral* constructor_; |
2657 ZoneList<Property*>* properties_; | 2657 ZoneList<Property*>* properties_; |
2658 int end_position_; | 2658 int end_position_; |
2659 }; | 2659 }; |
2660 | 2660 |
2661 | 2661 |
2662 class NativeFunctionLiteral FINAL : public Expression { | 2662 class NativeFunctionLiteral FINAL : public Expression { |
2663 public: | 2663 public: |
2664 DECLARE_NODE_TYPE(NativeFunctionLiteral) | 2664 DECLARE_NODE_TYPE(NativeFunctionLiteral) |
2665 | 2665 |
2666 Handle<String> name() const { return name_->string(); } | 2666 Handle<String> name() const { return name_->string(); } |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3489 int position) { | 3489 int position) { |
3490 return new (zone_) FunctionLiteral( | 3490 return new (zone_) FunctionLiteral( |
3491 zone_, name, ast_value_factory, scope, body, materialized_literal_count, | 3491 zone_, name, ast_value_factory, scope, body, materialized_literal_count, |
3492 expected_property_count, handler_count, parameter_count, function_type, | 3492 expected_property_count, handler_count, parameter_count, function_type, |
3493 has_duplicate_parameters, is_function, is_parenthesized, kind, | 3493 has_duplicate_parameters, is_function, is_parenthesized, kind, |
3494 position); | 3494 position); |
3495 } | 3495 } |
3496 | 3496 |
3497 ClassLiteral* NewClassLiteral(const AstRawString* name, Scope* scope, | 3497 ClassLiteral* NewClassLiteral(const AstRawString* name, Scope* scope, |
3498 VariableProxy* proxy, Expression* extends, | 3498 VariableProxy* proxy, Expression* extends, |
3499 Expression* constructor, | 3499 FunctionLiteral* constructor, |
3500 ZoneList<ObjectLiteral::Property*>* properties, | 3500 ZoneList<ObjectLiteral::Property*>* properties, |
3501 int start_position, int end_position) { | 3501 int start_position, int end_position) { |
3502 return new (zone_) | 3502 return new (zone_) |
3503 ClassLiteral(zone_, name, scope, proxy, extends, constructor, | 3503 ClassLiteral(zone_, name, scope, proxy, extends, constructor, |
3504 properties, start_position, end_position); | 3504 properties, start_position, end_position); |
3505 } | 3505 } |
3506 | 3506 |
3507 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, | 3507 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, |
3508 v8::Extension* extension, | 3508 v8::Extension* extension, |
3509 int pos) { | 3509 int pos) { |
(...skipping 10 matching lines...) Expand all Loading... |
3520 | 3520 |
3521 private: | 3521 private: |
3522 Zone* zone_; | 3522 Zone* zone_; |
3523 AstValueFactory* ast_value_factory_; | 3523 AstValueFactory* ast_value_factory_; |
3524 }; | 3524 }; |
3525 | 3525 |
3526 | 3526 |
3527 } } // namespace v8::internal | 3527 } } // namespace v8::internal |
3528 | 3528 |
3529 #endif // V8_AST_H_ | 3529 #endif // V8_AST_H_ |
OLD | NEW |