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 2492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2503 | 2503 |
2504 class ClassLiteral FINAL : public Expression { | 2504 class ClassLiteral FINAL : public Expression { |
2505 public: | 2505 public: |
2506 typedef ObjectLiteralProperty Property; | 2506 typedef ObjectLiteralProperty Property; |
2507 | 2507 |
2508 DECLARE_NODE_TYPE(ClassLiteral) | 2508 DECLARE_NODE_TYPE(ClassLiteral) |
2509 | 2509 |
2510 Handle<String> name() const { return raw_name_->string(); } | 2510 Handle<String> name() const { return raw_name_->string(); } |
2511 const AstRawString* raw_name() const { return raw_name_; } | 2511 const AstRawString* raw_name() const { return raw_name_; } |
2512 Expression* extends() const { return extends_; } | 2512 Expression* extends() const { return extends_; } |
2513 FunctionLiteral* constructor() const { return constructor_; } | 2513 Expression* constructor() const { return constructor_; } |
2514 ZoneList<Property*>* properties() const { return properties_; } | 2514 ZoneList<Property*>* properties() const { return properties_; } |
2515 | 2515 |
2516 protected: | 2516 protected: |
2517 ClassLiteral(Zone* zone, const AstRawString* name, Expression* extends, | 2517 ClassLiteral(Zone* zone, const AstRawString* name, Expression* extends, |
2518 FunctionLiteral* constructor, ZoneList<Property*>* properties, | 2518 Expression* constructor, ZoneList<Property*>* properties, |
2519 AstValueFactory* ast_value_factory, int position, IdGen* id_gen) | 2519 int position, IdGen* id_gen) |
2520 : Expression(zone, position, id_gen), | 2520 : Expression(zone, position, id_gen), |
2521 raw_name_(name), | 2521 raw_name_(name), |
2522 raw_inferred_name_(ast_value_factory->empty_string()), | |
2523 extends_(extends), | 2522 extends_(extends), |
2524 constructor_(constructor), | 2523 constructor_(constructor), |
2525 properties_(properties) {} | 2524 properties_(properties) {} |
2526 | 2525 |
2527 private: | 2526 private: |
2528 const AstRawString* raw_name_; | 2527 const AstRawString* raw_name_; |
2529 Handle<String> name_; | |
arv (Not doing code reviews)
2014/09/17 19:24:16
These are not used. We can add them back if we eve
| |
2530 const AstString* raw_inferred_name_; | |
2531 Handle<String> inferred_name_; | |
2532 Expression* extends_; | 2528 Expression* extends_; |
2533 FunctionLiteral* constructor_; | 2529 Expression* constructor_; |
2534 ZoneList<Property*>* properties_; | 2530 ZoneList<Property*>* properties_; |
2535 }; | 2531 }; |
2536 | 2532 |
2537 | 2533 |
2538 class NativeFunctionLiteral FINAL : public Expression { | 2534 class NativeFunctionLiteral FINAL : public Expression { |
2539 public: | 2535 public: |
2540 DECLARE_NODE_TYPE(NativeFunctionLiteral) | 2536 DECLARE_NODE_TYPE(NativeFunctionLiteral) |
2541 | 2537 |
2542 Handle<String> name() const { return name_->string(); } | 2538 Handle<String> name() const { return name_->string(); } |
2543 v8::Extension* extension() const { return extension_; } | 2539 v8::Extension* extension() const { return extension_; } |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3497 has_duplicate_parameters, is_function, is_parenthesized, kind, position, | 3493 has_duplicate_parameters, is_function, is_parenthesized, kind, position, |
3498 id_gen_); | 3494 id_gen_); |
3499 // Top-level literal doesn't count for the AST's properties. | 3495 // Top-level literal doesn't count for the AST's properties. |
3500 if (is_function == FunctionLiteral::kIsFunction) { | 3496 if (is_function == FunctionLiteral::kIsFunction) { |
3501 visitor_.VisitFunctionLiteral(lit); | 3497 visitor_.VisitFunctionLiteral(lit); |
3502 } | 3498 } |
3503 return lit; | 3499 return lit; |
3504 } | 3500 } |
3505 | 3501 |
3506 ClassLiteral* NewClassLiteral(const AstRawString* name, Expression* extends, | 3502 ClassLiteral* NewClassLiteral(const AstRawString* name, Expression* extends, |
3507 FunctionLiteral* constructor, | 3503 Expression* constructor, |
3508 ZoneList<ObjectLiteral::Property*>* properties, | 3504 ZoneList<ObjectLiteral::Property*>* properties, |
3509 AstValueFactory* ast_value_factory, | |
3510 int position) { | 3505 int position) { |
3511 ClassLiteral* lit = | 3506 ClassLiteral* lit = new (zone_) ClassLiteral( |
3512 new (zone_) ClassLiteral(zone_, name, extends, constructor, properties, | 3507 zone_, name, extends, constructor, properties, position, id_gen_); |
3513 ast_value_factory, position, id_gen_); | |
3514 VISIT_AND_RETURN(ClassLiteral, lit) | 3508 VISIT_AND_RETURN(ClassLiteral, lit) |
3515 } | 3509 } |
3516 | 3510 |
3517 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, | 3511 NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name, |
3518 v8::Extension* extension, | 3512 v8::Extension* extension, |
3519 int pos) { | 3513 int pos) { |
3520 NativeFunctionLiteral* lit = | 3514 NativeFunctionLiteral* lit = |
3521 new (zone_) NativeFunctionLiteral(zone_, name, extension, pos, id_gen_); | 3515 new (zone_) NativeFunctionLiteral(zone_, name, extension, pos, id_gen_); |
3522 VISIT_AND_RETURN(NativeFunctionLiteral, lit) | 3516 VISIT_AND_RETURN(NativeFunctionLiteral, lit) |
3523 } | 3517 } |
(...skipping 15 matching lines...) Expand all Loading... | |
3539 Zone* zone_; | 3533 Zone* zone_; |
3540 Visitor visitor_; | 3534 Visitor visitor_; |
3541 AstValueFactory* ast_value_factory_; | 3535 AstValueFactory* ast_value_factory_; |
3542 AstNode::IdGen* id_gen_; | 3536 AstNode::IdGen* id_gen_; |
3543 }; | 3537 }; |
3544 | 3538 |
3545 | 3539 |
3546 } } // namespace v8::internal | 3540 } } // namespace v8::internal |
3547 | 3541 |
3548 #endif // V8_AST_H_ | 3542 #endif // V8_AST_H_ |
OLD | NEW |