OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 414 |
415 class Block: public BreakableStatement { | 415 class Block: public BreakableStatement { |
416 public: | 416 public: |
417 DECLARE_NODE_TYPE(Block) | 417 DECLARE_NODE_TYPE(Block) |
418 | 418 |
419 void AddStatement(Statement* statement) { statements_.Add(statement); } | 419 void AddStatement(Statement* statement) { statements_.Add(statement); } |
420 | 420 |
421 ZoneList<Statement*>* statements() { return &statements_; } | 421 ZoneList<Statement*>* statements() { return &statements_; } |
422 bool is_initializer_block() const { return is_initializer_block_; } | 422 bool is_initializer_block() const { return is_initializer_block_; } |
423 | 423 |
424 Scope* block_scope() const { return block_scope_; } | 424 Scope* scope() const { return scope_; } |
425 void set_block_scope(Scope* block_scope) { block_scope_ = block_scope; } | 425 void set_scope(Scope* scope) { scope_ = scope; } |
426 | 426 |
427 protected: | 427 protected: |
428 template<class> friend class AstNodeFactory; | 428 template<class> friend class AstNodeFactory; |
429 | 429 |
430 Block(Isolate* isolate, | 430 Block(Isolate* isolate, |
431 ZoneStringList* labels, | 431 ZoneStringList* labels, |
432 int capacity, | 432 int capacity, |
433 bool is_initializer_block) | 433 bool is_initializer_block) |
434 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY), | 434 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY), |
435 statements_(capacity), | 435 statements_(capacity), |
436 is_initializer_block_(is_initializer_block), | 436 is_initializer_block_(is_initializer_block), |
437 block_scope_(NULL) { | 437 scope_(NULL) { |
438 } | 438 } |
439 | 439 |
440 private: | 440 private: |
441 ZoneList<Statement*> statements_; | 441 ZoneList<Statement*> statements_; |
442 bool is_initializer_block_; | 442 bool is_initializer_block_; |
443 Scope* block_scope_; | 443 Scope* scope_; |
444 }; | 444 }; |
445 | 445 |
446 | 446 |
447 class Declaration: public AstNode { | 447 class Declaration: public AstNode { |
448 public: | 448 public: |
449 VariableProxy* proxy() const { return proxy_; } | 449 VariableProxy* proxy() const { return proxy_; } |
450 VariableMode mode() const { return mode_; } | 450 VariableMode mode() const { return mode_; } |
451 Scope* scope() const { return scope_; } | 451 Scope* scope() const { return scope_; } |
452 virtual InitializationFlag initialization() const = 0; | 452 virtual InitializationFlag initialization() const = 0; |
453 virtual bool IsInlineable() const; | 453 virtual bool IsInlineable() const; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 private: | 601 private: |
602 Interface* interface_; | 602 Interface* interface_; |
603 }; | 603 }; |
604 | 604 |
605 | 605 |
606 class ModuleLiteral: public Module { | 606 class ModuleLiteral: public Module { |
607 public: | 607 public: |
608 DECLARE_NODE_TYPE(ModuleLiteral) | 608 DECLARE_NODE_TYPE(ModuleLiteral) |
609 | 609 |
610 Block* body() const { return body_; } | 610 Block* body() const { return body_; } |
| 611 Handle<Context> context() const { return context_; } |
611 | 612 |
612 protected: | 613 protected: |
613 template<class> friend class AstNodeFactory; | 614 template<class> friend class AstNodeFactory; |
614 | 615 |
615 ModuleLiteral(Block* body, Interface* interface) | 616 ModuleLiteral(Block* body, Interface* interface) |
616 : Module(interface), | 617 : Module(interface), |
617 body_(body) { | 618 body_(body) { |
618 } | 619 } |
619 | 620 |
620 private: | 621 private: |
621 Block* body_; | 622 Block* body_; |
| 623 Handle<Context> context_; |
622 }; | 624 }; |
623 | 625 |
624 | 626 |
625 class ModuleVariable: public Module { | 627 class ModuleVariable: public Module { |
626 public: | 628 public: |
627 DECLARE_NODE_TYPE(ModuleVariable) | 629 DECLARE_NODE_TYPE(ModuleVariable) |
628 | 630 |
629 VariableProxy* proxy() const { return proxy_; } | 631 VariableProxy* proxy() const { return proxy_; } |
630 | 632 |
631 protected: | 633 protected: |
(...skipping 2344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2976 private: | 2978 private: |
2977 Isolate* isolate_; | 2979 Isolate* isolate_; |
2978 Zone* zone_; | 2980 Zone* zone_; |
2979 Visitor visitor_; | 2981 Visitor visitor_; |
2980 }; | 2982 }; |
2981 | 2983 |
2982 | 2984 |
2983 } } // namespace v8::internal | 2985 } } // namespace v8::internal |
2984 | 2986 |
2985 #endif // V8_AST_H_ | 2987 #endif // V8_AST_H_ |
OLD | NEW |