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 #include "src/ast/modules.h" | 5 #include "src/ast/modules.h" |
6 #include "src/ast/ast-value-factory.h" | 6 #include "src/ast/ast-value-factory.h" |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
11 | 11 |
12 void ModuleDescriptor::AddImport( | 12 void ModuleDescriptor::AddImport( |
13 const AstRawString* import_name, const AstRawString* local_name, | 13 const AstRawString* import_name, const AstRawString* local_name, |
14 const AstRawString* module_request, Scanner::Location loc, Zone* zone) { | 14 const AstRawString* module_request, Scanner::Location loc, Zone* zone) { |
15 Entry* entry = new (zone) Entry(loc); | 15 Entry* entry = new (zone) Entry(loc); |
16 entry->local_name = local_name; | 16 entry->local_name = local_name; |
17 entry->import_name = import_name; | 17 entry->import_name = import_name; |
18 entry->module_request = AddModuleRequest(module_request); | 18 entry->module_request = AddModuleRequest(module_request); |
19 AddRegularImport(entry); | 19 AddRegularImport(entry); |
20 } | 20 } |
21 | 21 |
22 | 22 |
23 void ModuleDescriptor::AddStarImport( | 23 void ModuleDescriptor::AddStarImport( |
24 const AstRawString* local_name, const AstRawString* module_request, | 24 const AstRawString* local_name, const AstRawString* module_request, |
25 Scanner::Location loc, Zone* zone) { | 25 Scanner::Location loc, Zone* zone) { |
26 DCHECK_NOT_NULL(local_name); | |
27 Entry* entry = new (zone) Entry(loc); | 26 Entry* entry = new (zone) Entry(loc); |
28 entry->local_name = local_name; | 27 entry->local_name = local_name; |
29 entry->module_request = AddModuleRequest(module_request); | 28 entry->module_request = AddModuleRequest(module_request); |
30 AddSpecialImport(entry, zone); | 29 AddNamespaceImport(entry, zone); |
| 30 } |
| 31 |
| 32 void ModuleDescriptor::AddEmptyImport(const AstRawString* module_request) { |
| 33 AddModuleRequest(module_request); |
31 } | 34 } |
32 | 35 |
33 | 36 |
34 void ModuleDescriptor::AddEmptyImport( | |
35 const AstRawString* module_request, Scanner::Location loc, Zone* zone) { | |
36 Entry* entry = new (zone) Entry(loc); | |
37 entry->module_request = AddModuleRequest(module_request); | |
38 AddSpecialImport(entry, zone); | |
39 } | |
40 | |
41 | |
42 void ModuleDescriptor::AddExport( | 37 void ModuleDescriptor::AddExport( |
43 const AstRawString* local_name, const AstRawString* export_name, | 38 const AstRawString* local_name, const AstRawString* export_name, |
44 Scanner::Location loc, Zone* zone) { | 39 Scanner::Location loc, Zone* zone) { |
45 Entry* entry = new (zone) Entry(loc); | 40 Entry* entry = new (zone) Entry(loc); |
46 entry->export_name = export_name; | 41 entry->export_name = export_name; |
47 entry->local_name = local_name; | 42 entry->local_name = local_name; |
48 AddRegularExport(entry); | 43 AddRegularExport(entry); |
49 } | 44 } |
50 | 45 |
51 | 46 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 return false; | 257 return false; |
263 } | 258 } |
264 } | 259 } |
265 | 260 |
266 MakeIndirectExportsExplicit(zone); | 261 MakeIndirectExportsExplicit(zone); |
267 return true; | 262 return true; |
268 } | 263 } |
269 | 264 |
270 } // namespace internal | 265 } // namespace internal |
271 } // namespace v8 | 266 } // namespace v8 |
OLD | NEW |