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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 | 413 |
414 class Block: public BreakableStatement { | 414 class Block: public BreakableStatement { |
415 public: | 415 public: |
416 DECLARE_NODE_TYPE(Block) | 416 DECLARE_NODE_TYPE(Block) |
417 | 417 |
418 void AddStatement(Statement* statement) { statements_.Add(statement); } | 418 void AddStatement(Statement* statement) { statements_.Add(statement); } |
419 | 419 |
420 ZoneList<Statement*>* statements() { return &statements_; } | 420 ZoneList<Statement*>* statements() { return &statements_; } |
421 bool is_initializer_block() const { return is_initializer_block_; } | 421 bool is_initializer_block() const { return is_initializer_block_; } |
422 | 422 |
423 Scope* block_scope() const { return block_scope_; } | 423 Scope* scope() const { return scope_; } |
424 void set_block_scope(Scope* block_scope) { block_scope_ = block_scope; } | 424 void set_scope(Scope* scope) { scope_ = scope; } |
425 | 425 |
426 protected: | 426 protected: |
427 template<class> friend class AstNodeFactory; | 427 template<class> friend class AstNodeFactory; |
428 | 428 |
429 Block(Isolate* isolate, | 429 Block(Isolate* isolate, |
430 ZoneStringList* labels, | 430 ZoneStringList* labels, |
431 int capacity, | 431 int capacity, |
432 bool is_initializer_block) | 432 bool is_initializer_block) |
433 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY), | 433 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY), |
434 statements_(capacity), | 434 statements_(capacity), |
435 is_initializer_block_(is_initializer_block), | 435 is_initializer_block_(is_initializer_block), |
436 block_scope_(NULL) { | 436 scope_(NULL) { |
437 } | 437 } |
438 | 438 |
439 private: | 439 private: |
440 ZoneList<Statement*> statements_; | 440 ZoneList<Statement*> statements_; |
441 bool is_initializer_block_; | 441 bool is_initializer_block_; |
442 Scope* block_scope_; | 442 Scope* scope_; |
443 }; | 443 }; |
444 | 444 |
445 | 445 |
446 class Declaration: public AstNode { | 446 class Declaration: public AstNode { |
447 public: | 447 public: |
448 VariableProxy* proxy() const { return proxy_; } | 448 VariableProxy* proxy() const { return proxy_; } |
449 VariableMode mode() const { return mode_; } | 449 VariableMode mode() const { return mode_; } |
450 Scope* scope() const { return scope_; } | 450 Scope* scope() const { return scope_; } |
451 virtual InitializationFlag initialization() const = 0; | 451 virtual InitializationFlag initialization() const = 0; |
452 virtual bool IsInlineable() const; | 452 virtual bool IsInlineable() const; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 private: | 600 private: |
601 Interface* interface_; | 601 Interface* interface_; |
602 }; | 602 }; |
603 | 603 |
604 | 604 |
605 class ModuleLiteral: public Module { | 605 class ModuleLiteral: public Module { |
606 public: | 606 public: |
607 DECLARE_NODE_TYPE(ModuleLiteral) | 607 DECLARE_NODE_TYPE(ModuleLiteral) |
608 | 608 |
609 Block* body() const { return body_; } | 609 Block* body() const { return body_; } |
| 610 Handle<Context> context() const { return context_; } |
610 | 611 |
611 protected: | 612 protected: |
612 template<class> friend class AstNodeFactory; | 613 template<class> friend class AstNodeFactory; |
613 | 614 |
614 ModuleLiteral(Block* body, Interface* interface) | 615 ModuleLiteral(Block* body, Interface* interface) |
615 : Module(interface), | 616 : Module(interface), |
616 body_(body) { | 617 body_(body) { |
617 } | 618 } |
618 | 619 |
619 private: | 620 private: |
620 Block* body_; | 621 Block* body_; |
| 622 Handle<Context> context_; |
621 }; | 623 }; |
622 | 624 |
623 | 625 |
624 class ModuleVariable: public Module { | 626 class ModuleVariable: public Module { |
625 public: | 627 public: |
626 DECLARE_NODE_TYPE(ModuleVariable) | 628 DECLARE_NODE_TYPE(ModuleVariable) |
627 | 629 |
628 VariableProxy* proxy() const { return proxy_; } | 630 VariableProxy* proxy() const { return proxy_; } |
629 | 631 |
630 protected: | 632 protected: |
(...skipping 2335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2966 private: | 2968 private: |
2967 Isolate* isolate_; | 2969 Isolate* isolate_; |
2968 Zone* zone_; | 2970 Zone* zone_; |
2969 Visitor visitor_; | 2971 Visitor visitor_; |
2970 }; | 2972 }; |
2971 | 2973 |
2972 | 2974 |
2973 } } // namespace v8::internal | 2975 } } // namespace v8::internal |
2974 | 2976 |
2975 #endif // V8_AST_H_ | 2977 #endif // V8_AST_H_ |
OLD | NEW |