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-containers.h" | 10 #include "src/zone-containers.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 special_imports_.Add(entry, zone); | 144 special_imports_.Add(entry, zone); |
145 } | 145 } |
146 | 146 |
147 private: | 147 private: |
148 // TODO(neis): Use STL datastructure instead of ZoneList? | 148 // TODO(neis): Use STL datastructure instead of ZoneList? |
149 ZoneList<const Entry*> special_exports_; | 149 ZoneList<const Entry*> special_exports_; |
150 ZoneList<const Entry*> special_imports_; | 150 ZoneList<const Entry*> special_imports_; |
151 ZoneMultimap<const AstRawString*, Entry*> regular_exports_; | 151 ZoneMultimap<const AstRawString*, Entry*> regular_exports_; |
152 ZoneMap<const AstRawString*, const Entry*> regular_imports_; | 152 ZoneMap<const AstRawString*, const Entry*> regular_imports_; |
153 | 153 |
154 // If there are multiple export entries with the same export name, return one | 154 // If there are multiple export entries with the same export name, return the |
155 // of them. Otherwise return nullptr. | 155 // last of them (in source order). Otherwise return nullptr. |
156 const Entry* FindDuplicateExport(Zone* zone) const; | 156 const Entry* FindDuplicateExport(Zone* zone) const; |
157 | 157 |
158 // Find any implicitly indirect exports and make them explicit. | 158 // Find any implicitly indirect exports and make them explicit. |
159 // | 159 // |
160 // An explicitly indirect export is an export entry arising from an export | 160 // An explicitly indirect export is an export entry arising from an export |
161 // statement of the following form: | 161 // statement of the following form: |
162 // export {a as c} from "X"; | 162 // export {a as c} from "X"; |
163 // An implicitly indirect export corresponds to | 163 // An implicitly indirect export corresponds to |
164 // export {b as c}; | 164 // export {b as c}; |
165 // in the presence of an import statement of the form | 165 // in the presence of an import statement of the form |
166 // import {a as b} from "X"; | 166 // import {a as b} from "X"; |
167 // This function finds such implicitly indirect export entries and rewrites | 167 // This function finds such implicitly indirect export entries and rewrites |
168 // them by filling in the import name and module request, as well as nulling | 168 // them by filling in the import name and module request, as well as nulling |
169 // out the local name. Effectively, it turns | 169 // out the local name. Effectively, it turns |
170 // import {a as b} from "X"; export {b as c}; | 170 // import {a as b} from "X"; export {b as c}; |
171 // into: | 171 // into: |
172 // import {a as b} from "X"; export {a as c} from "X"; | 172 // import {a as b} from "X"; export {a as c} from "X"; |
173 // (The import entry is never deleted.) | 173 // (The import entry is never deleted.) |
174 void MakeIndirectExportsExplicit(Zone* zone); | 174 void MakeIndirectExportsExplicit(Zone* zone); |
175 }; | 175 }; |
176 | 176 |
177 } // namespace internal | 177 } // namespace internal |
178 } // namespace v8 | 178 } // namespace v8 |
179 | 179 |
180 #endif // V8_AST_MODULES_H_ | 180 #endif // V8_AST_MODULES_H_ |
OLD | NEW |