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 2622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2633 | 2633 |
2634 | 2634 |
2635 class ClassLiteral FINAL : public Expression { | 2635 class ClassLiteral FINAL : public Expression { |
2636 public: | 2636 public: |
2637 typedef ObjectLiteralProperty Property; | 2637 typedef ObjectLiteralProperty Property; |
2638 | 2638 |
2639 DECLARE_NODE_TYPE(ClassLiteral) | 2639 DECLARE_NODE_TYPE(ClassLiteral) |
2640 | 2640 |
2641 Handle<String> name() const { return raw_name_->string(); } | 2641 Handle<String> name() const { return raw_name_->string(); } |
2642 const AstRawString* raw_name() const { return raw_name_; } | 2642 const AstRawString* raw_name() const { return raw_name_; } |
| 2643 Scope* scope() const { return scope_; } |
| 2644 VariableProxy* class_variable_proxy() const { return class_variable_proxy_; } |
2643 Expression* extends() const { return extends_; } | 2645 Expression* extends() const { return extends_; } |
2644 Expression* constructor() const { return constructor_; } | 2646 Expression* constructor() const { return constructor_; } |
2645 ZoneList<Property*>* properties() const { return properties_; } | 2647 ZoneList<Property*>* properties() const { return properties_; } |
2646 int start_position() const { return position(); } | 2648 int start_position() const { return position(); } |
2647 int end_position() const { return end_position_; } | 2649 int end_position() const { return end_position_; } |
2648 | 2650 |
2649 protected: | 2651 protected: |
2650 ClassLiteral(Zone* zone, const AstRawString* name, Expression* extends, | 2652 ClassLiteral(Zone* zone, const AstRawString* name, Scope* scope, |
| 2653 VariableProxy* class_variable_proxy, Expression* extends, |
2651 Expression* constructor, ZoneList<Property*>* properties, | 2654 Expression* constructor, ZoneList<Property*>* properties, |
2652 int start_position, int end_position) | 2655 int start_position, int end_position) |
2653 : Expression(zone, start_position), | 2656 : Expression(zone, start_position), |
2654 raw_name_(name), | 2657 raw_name_(name), |
| 2658 scope_(scope), |
| 2659 class_variable_proxy_(class_variable_proxy), |
2655 extends_(extends), | 2660 extends_(extends), |
2656 constructor_(constructor), | 2661 constructor_(constructor), |
2657 properties_(properties), | 2662 properties_(properties), |
2658 end_position_(end_position) {} | 2663 end_position_(end_position) {} |
2659 | 2664 |
2660 private: | 2665 private: |
2661 const AstRawString* raw_name_; | 2666 const AstRawString* raw_name_; |
| 2667 Scope* scope_; |
| 2668 VariableProxy* class_variable_proxy_; |
2662 Expression* extends_; | 2669 Expression* extends_; |
2663 Expression* constructor_; | 2670 Expression* constructor_; |
2664 ZoneList<Property*>* properties_; | 2671 ZoneList<Property*>* properties_; |
2665 int end_position_; | 2672 int end_position_; |
2666 }; | 2673 }; |
2667 | 2674 |
2668 | 2675 |
2669 class NativeFunctionLiteral FINAL : public Expression { | 2676 class NativeFunctionLiteral FINAL : public Expression { |
2670 public: | 2677 public: |
2671 DECLARE_NODE_TYPE(NativeFunctionLiteral) | 2678 DECLARE_NODE_TYPE(NativeFunctionLiteral) |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3617 expected_property_count, handler_count, parameter_count, function_type, | 3624 expected_property_count, handler_count, parameter_count, function_type, |
3618 has_duplicate_parameters, is_function, is_parenthesized, kind, | 3625 has_duplicate_parameters, is_function, is_parenthesized, kind, |
3619 position); | 3626 position); |
3620 // Top-level literal doesn't count for the AST's properties. | 3627 // Top-level literal doesn't count for the AST's properties. |
3621 if (is_function == FunctionLiteral::kIsFunction) { | 3628 if (is_function == FunctionLiteral::kIsFunction) { |
3622 visitor_.VisitFunctionLiteral(lit); | 3629 visitor_.VisitFunctionLiteral(lit); |
3623 } | 3630 } |
3624 return lit; | 3631 return lit; |
3625 } | 3632 } |
3626 | 3633 |
3627 ClassLiteral* NewClassLiteral(const AstRawString* name, Expression* extends, | 3634 ClassLiteral* NewClassLiteral(const AstRawString* name, Scope* scope, |
| 3635 VariableProxy* proxy, Expression* extends, |
3628 Expression* constructor, | 3636 Expression* constructor, |
3629 ZoneList<ObjectLiteral::Property*>* properties, | 3637 ZoneList<ObjectLiteral::Property*>* properties, |
3630 int start_position, int end_position) { | 3638 int start_position, int end_position) { |
3631 ClassLiteral* lit = | 3639 ClassLiteral* lit = new (zone_) |
3632 new (zone_) ClassLiteral(zone_, name, extends, constructor, properties, | 3640 ClassLiteral(zone_, name, scope, proxy, extends, constructor, |
3633 start_position, end_position); | 3641 properties, start_position, end_position); |
3634 VISIT_AND_RETURN(ClassLiteral, lit) | 3642 VISIT_AND_RETURN(ClassLiteral, lit) |
3635 } | 3643 } |
3636 | 3644 |
3637 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, | 3645 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, |
3638 v8::Extension* extension, | 3646 v8::Extension* extension, |
3639 int pos) { | 3647 int pos) { |
3640 NativeFunctionLiteral* lit = | 3648 NativeFunctionLiteral* lit = |
3641 new (zone_) NativeFunctionLiteral(zone_, name, extension, pos); | 3649 new (zone_) NativeFunctionLiteral(zone_, name, extension, pos); |
3642 VISIT_AND_RETURN(NativeFunctionLiteral, lit) | 3650 VISIT_AND_RETURN(NativeFunctionLiteral, lit) |
3643 } | 3651 } |
(...skipping 13 matching lines...) Expand all Loading... |
3657 private: | 3665 private: |
3658 Zone* zone_; | 3666 Zone* zone_; |
3659 Visitor visitor_; | 3667 Visitor visitor_; |
3660 AstValueFactory* ast_value_factory_; | 3668 AstValueFactory* ast_value_factory_; |
3661 }; | 3669 }; |
3662 | 3670 |
3663 | 3671 |
3664 } } // namespace v8::internal | 3672 } } // namespace v8::internal |
3665 | 3673 |
3666 #endif // V8_AST_H_ | 3674 #endif // V8_AST_H_ |
OLD | NEW |