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