| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 | 73 |
| 74 void ModuleDescriptor::AddStarExport( | 74 void ModuleDescriptor::AddStarExport( |
| 75 const AstRawString* module_request, Scanner::Location loc, Zone* zone) { | 75 const AstRawString* module_request, Scanner::Location loc, Zone* zone) { |
| 76 DCHECK_NOT_NULL(module_request); | 76 DCHECK_NOT_NULL(module_request); |
| 77 ModuleEntry* entry = new (zone) ModuleEntry(loc); | 77 ModuleEntry* entry = new (zone) ModuleEntry(loc); |
| 78 entry->module_request = module_request; | 78 entry->module_request = module_request; |
| 79 exports_.Add(entry, zone); | 79 exports_.Add(entry, zone); |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool ModuleDescriptor::Validate(DeclarationScope* module_scope, | 82 |
| 83 PendingCompilationErrorHandler* error_handler, | 83 bool ModuleDescriptor::Validate( |
| 84 Zone* zone) const { | 84 Scope* module_scope, PendingCompilationErrorHandler* error_handler, |
| 85 Zone* zone) const { |
| 85 DCHECK(module_scope->is_module_scope()); | 86 DCHECK(module_scope->is_module_scope()); |
| 86 DCHECK_EQ(this, module_scope->module()); | 87 DCHECK_EQ(this, module_scope->module()); |
| 87 DCHECK_NOT_NULL(error_handler); | 88 DCHECK_NOT_NULL(error_handler); |
| 88 | 89 |
| 89 // Report error iff there are duplicate exports. | 90 // Report error iff there are duplicate exports. |
| 90 { | 91 { |
| 91 ZoneAllocationPolicy allocator(zone); | 92 ZoneAllocationPolicy allocator(zone); |
| 92 ZoneHashMap* export_names = new (zone->New(sizeof(ZoneHashMap))) | 93 ZoneHashMap* export_names = new (zone->New(sizeof(ZoneHashMap))) |
| 93 ZoneHashMap(ZoneHashMap::PointersMatch, | 94 ZoneHashMap(ZoneHashMap::PointersMatch, |
| 94 ZoneHashMap::kDefaultHashMapCapacity, allocator); | 95 ZoneHashMap::kDefaultHashMapCapacity, allocator); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 116 entry->location.beg_pos, entry->location.end_pos, | 117 entry->location.beg_pos, entry->location.end_pos, |
| 117 MessageTemplate::kModuleExportUndefined, entry->local_name); | 118 MessageTemplate::kModuleExportUndefined, entry->local_name); |
| 118 return false; | 119 return false; |
| 119 } | 120 } |
| 120 } | 121 } |
| 121 | 122 |
| 122 return true; | 123 return true; |
| 123 } | 124 } |
| 124 } // namespace internal | 125 } // namespace internal |
| 125 } // namespace v8 | 126 } // namespace v8 |
| OLD | NEW |