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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
602 | 602 |
603 private: | 603 private: |
604 Module* module_; | 604 Module* module_; |
605 }; | 605 }; |
606 | 606 |
607 | 607 |
608 class ImportDeclaration FINAL : public Declaration { | 608 class ImportDeclaration FINAL : public Declaration { |
609 public: | 609 public: |
610 DECLARE_NODE_TYPE(ImportDeclaration) | 610 DECLARE_NODE_TYPE(ImportDeclaration) |
611 | 611 |
612 Module* module() const { return module_; } | 612 const AstRawString* import_name() const { return import_name_; } |
613 const AstRawString* module_specifier() const { return module_specifier_; } | |
rossberg
2015/02/25 13:55:49
Hm, is it necessary that the specifier is duplicat
arv (Not doing code reviews)
2015/02/25 16:07:25
At the moment the actual import statement is not r
adamk
2015/02/25 21:43:12
I'm open to other suggestions, but I don't think i
rossberg
2015/02/26 07:52:07
But is this an adequate desugaring? Wouldn't those
| |
614 void set_module_specifier(const AstRawString* module_specifier) { | |
615 DCHECK(module_specifier_ == NULL); | |
616 module_specifier_ = module_specifier; | |
617 } | |
613 InitializationFlag initialization() const OVERRIDE { | 618 InitializationFlag initialization() const OVERRIDE { |
614 return kCreatedInitialized; | 619 return kNeedsInitialization; |
615 } | 620 } |
616 | 621 |
617 protected: | 622 protected: |
618 ImportDeclaration(Zone* zone, | 623 ImportDeclaration(Zone* zone, VariableProxy* proxy, |
619 VariableProxy* proxy, | 624 const AstRawString* import_name, |
620 Module* module, | 625 const AstRawString* module_specifier, Scope* scope, int pos) |
621 Scope* scope, | 626 : Declaration(zone, proxy, IMPORT, scope, pos), |
622 int pos) | 627 import_name_(import_name), |
623 : Declaration(zone, proxy, LET, scope, pos), | 628 module_specifier_(module_specifier) {} |
624 module_(module) { | |
625 } | |
626 | 629 |
627 private: | 630 private: |
628 Module* module_; | 631 const AstRawString* import_name_; |
632 const AstRawString* module_specifier_; | |
629 }; | 633 }; |
630 | 634 |
631 | 635 |
632 class ExportDeclaration FINAL : public Declaration { | 636 class ExportDeclaration FINAL : public Declaration { |
633 public: | 637 public: |
634 DECLARE_NODE_TYPE(ExportDeclaration) | 638 DECLARE_NODE_TYPE(ExportDeclaration) |
635 | 639 |
636 InitializationFlag initialization() const OVERRIDE { | 640 InitializationFlag initialization() const OVERRIDE { |
637 return kCreatedInitialized; | 641 return kCreatedInitialized; |
638 } | 642 } |
(...skipping 2509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3148 } | 3152 } |
3149 | 3153 |
3150 ModuleDeclaration* NewModuleDeclaration(VariableProxy* proxy, | 3154 ModuleDeclaration* NewModuleDeclaration(VariableProxy* proxy, |
3151 Module* module, | 3155 Module* module, |
3152 Scope* scope, | 3156 Scope* scope, |
3153 int pos) { | 3157 int pos) { |
3154 return new (zone_) ModuleDeclaration(zone_, proxy, module, scope, pos); | 3158 return new (zone_) ModuleDeclaration(zone_, proxy, module, scope, pos); |
3155 } | 3159 } |
3156 | 3160 |
3157 ImportDeclaration* NewImportDeclaration(VariableProxy* proxy, | 3161 ImportDeclaration* NewImportDeclaration(VariableProxy* proxy, |
3158 Module* module, | 3162 const AstRawString* import_name, |
3159 Scope* scope, | 3163 const AstRawString* module_specifier, |
3160 int pos) { | 3164 Scope* scope, int pos) { |
3161 return new (zone_) ImportDeclaration(zone_, proxy, module, scope, pos); | 3165 return new (zone_) ImportDeclaration(zone_, proxy, import_name, |
3166 module_specifier, scope, pos); | |
3162 } | 3167 } |
3163 | 3168 |
3164 ExportDeclaration* NewExportDeclaration(VariableProxy* proxy, | 3169 ExportDeclaration* NewExportDeclaration(VariableProxy* proxy, |
3165 Scope* scope, | 3170 Scope* scope, |
3166 int pos) { | 3171 int pos) { |
3167 return new (zone_) ExportDeclaration(zone_, proxy, scope, pos); | 3172 return new (zone_) ExportDeclaration(zone_, proxy, scope, pos); |
3168 } | 3173 } |
3169 | 3174 |
3170 ModuleLiteral* NewModuleLiteral(Block* body, ModuleDescriptor* descriptor, | 3175 ModuleLiteral* NewModuleLiteral(Block* body, ModuleDescriptor* descriptor, |
3171 int pos) { | 3176 int pos) { |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3490 | 3495 |
3491 private: | 3496 private: |
3492 Zone* zone_; | 3497 Zone* zone_; |
3493 AstValueFactory* ast_value_factory_; | 3498 AstValueFactory* ast_value_factory_; |
3494 }; | 3499 }; |
3495 | 3500 |
3496 | 3501 |
3497 } } // namespace v8::internal | 3502 } } // namespace v8::internal |
3498 | 3503 |
3499 #endif // V8_AST_H_ | 3504 #endif // V8_AST_H_ |
OLD | NEW |