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_MODULES_H_ | 5 #ifndef V8_AST_MODULES_H_ |
6 #define V8_AST_MODULES_H_ | 6 #define V8_AST_MODULES_H_ |
7 | 7 |
8 #include "src/parsing/scanner.h" // Only for Scanner::Location. | 8 #include "src/parsing/scanner.h" // Only for Scanner::Location. |
9 #include "src/pending-compilation-error-handler.h" | 9 #include "src/pending-compilation-error-handler.h" |
10 #include "src/zone.h" | 10 #include "src/zone.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // export * from "foo.js"; | 60 // export * from "foo.js"; |
61 void AddStarExport( | 61 void AddStarExport( |
62 const AstRawString* module_request, const Scanner::Location loc, | 62 const AstRawString* module_request, const Scanner::Location loc, |
63 Zone* zone); | 63 Zone* zone); |
64 | 64 |
65 // Check if module is well-formed and report error if not. | 65 // Check if module is well-formed and report error if not. |
66 bool Validate(DeclarationScope* module_scope, | 66 bool Validate(DeclarationScope* module_scope, |
67 PendingCompilationErrorHandler* error_handler, | 67 PendingCompilationErrorHandler* error_handler, |
68 Zone* zone) const; | 68 Zone* zone) const; |
69 | 69 |
70 private: | |
71 struct ModuleEntry : public ZoneObject { | 70 struct ModuleEntry : public ZoneObject { |
72 const Scanner::Location location; | 71 const Scanner::Location location; |
73 const AstRawString* export_name; | 72 const AstRawString* export_name; |
74 const AstRawString* local_name; | 73 const AstRawString* local_name; |
75 const AstRawString* import_name; | 74 const AstRawString* import_name; |
76 const AstRawString* module_request; | 75 const AstRawString* module_request; |
77 | 76 |
78 explicit ModuleEntry(Scanner::Location loc) | 77 explicit ModuleEntry(Scanner::Location loc) |
79 : location(loc), | 78 : location(loc), |
80 export_name(nullptr), | 79 export_name(nullptr), |
81 local_name(nullptr), | 80 local_name(nullptr), |
82 import_name(nullptr), | 81 import_name(nullptr), |
83 module_request(nullptr) {} | 82 module_request(nullptr) {} |
84 }; | 83 }; |
85 | 84 |
| 85 const ZoneList<const ModuleEntry*>& exports() { return exports_; } |
| 86 const ZoneList<const ModuleEntry*>& imports() { return imports_; } |
| 87 |
| 88 private: |
86 ZoneList<const ModuleEntry*> exports_; | 89 ZoneList<const ModuleEntry*> exports_; |
87 ZoneList<const ModuleEntry*> imports_; | 90 ZoneList<const ModuleEntry*> imports_; |
88 }; | 91 }; |
89 | 92 |
90 } // namespace internal | 93 } // namespace internal |
91 } // namespace v8 | 94 } // namespace v8 |
92 | 95 |
93 #endif // V8_AST_MODULES_H_ | 96 #endif // V8_AST_MODULES_H_ |
OLD | NEW |