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 { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 entry->location = import->second->location; | 205 entry->location = import->second->location; |
206 entry->local_name = nullptr; | 206 entry->local_name = nullptr; |
207 AddSpecialExport(entry, zone); | 207 AddSpecialExport(entry, zone); |
208 it = regular_exports_.erase(it); | 208 it = regular_exports_.erase(it); |
209 } else { | 209 } else { |
210 it++; | 210 it++; |
211 } | 211 } |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
| 215 ModuleDescriptor::CellIndexKind ModuleDescriptor::GetCellIndexKind( |
| 216 int cell_index) { |
| 217 if (cell_index > 0) return kExport; |
| 218 if (cell_index < 0) return kImport; |
| 219 return kInvalid; |
| 220 } |
| 221 |
215 void ModuleDescriptor::AssignCellIndices() { | 222 void ModuleDescriptor::AssignCellIndices() { |
216 int export_index = 1; | 223 int export_index = 1; |
217 for (auto it = regular_exports_.begin(); it != regular_exports_.end();) { | 224 for (auto it = regular_exports_.begin(); it != regular_exports_.end();) { |
218 auto current_key = it->first; | 225 auto current_key = it->first; |
219 // This local name may be exported under multiple export names. Assign the | 226 // This local name may be exported under multiple export names. Assign the |
220 // same index to each such entry. | 227 // same index to each such entry. |
221 do { | 228 do { |
222 Entry* entry = it->second; | 229 Entry* entry = it->second; |
223 DCHECK_NOT_NULL(entry->local_name); | 230 DCHECK_NOT_NULL(entry->local_name); |
224 DCHECK_NULL(entry->import_name); | 231 DCHECK_NULL(entry->import_name); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 } | 314 } |
308 } | 315 } |
309 | 316 |
310 MakeIndirectExportsExplicit(zone); | 317 MakeIndirectExportsExplicit(zone); |
311 AssignCellIndices(); | 318 AssignCellIndices(); |
312 return true; | 319 return true; |
313 } | 320 } |
314 | 321 |
315 } // namespace internal | 322 } // namespace internal |
316 } // namespace v8 | 323 } // namespace v8 |
OLD | NEW |