| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #include "src/scopeinfo.h" | 9 #include "src/scopeinfo.h" |
| 10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 Handle<ModuleInfo> ModuleInfo::Create( | 551 Handle<ModuleInfo> ModuleInfo::Create( |
| 552 Isolate* isolate, Interface* interface, Scope* scope) { | 552 Isolate* isolate, Interface* interface, Scope* scope) { |
| 553 Handle<ModuleInfo> info = Allocate(isolate, interface->Length()); | 553 Handle<ModuleInfo> info = Allocate(isolate, interface->Length()); |
| 554 info->set_host_index(interface->Index()); | 554 info->set_host_index(interface->Index()); |
| 555 int i = 0; | 555 int i = 0; |
| 556 for (Interface::Iterator it = interface->iterator(); | 556 for (Interface::Iterator it = interface->iterator(); |
| 557 !it.done(); it.Advance(), ++i) { | 557 !it.done(); it.Advance(), ++i) { |
| 558 Variable* var = scope->LookupLocal(it.name()); | 558 Variable* var = scope->LookupLocal(it.name()); |
| 559 info->set_name(i, *(it.name()->string())); | 559 info->set_name(i, *(it.name()->string())); |
| 560 info->set_mode(i, var->mode()); | 560 info->set_mode(i, var->mode()); |
| 561 DCHECK((var->mode() == MODULE) == (it.interface()->IsModule())); | 561 DCHECK(var->index() >= 0); |
| 562 if (var->mode() == MODULE) { | 562 info->set_index(i, var->index()); |
| 563 DCHECK(it.interface()->IsFrozen()); | |
| 564 DCHECK(it.interface()->Index() >= 0); | |
| 565 info->set_index(i, it.interface()->Index()); | |
| 566 } else { | |
| 567 DCHECK(var->index() >= 0); | |
| 568 info->set_index(i, var->index()); | |
| 569 } | |
| 570 } | 563 } |
| 571 DCHECK(i == info->length()); | 564 DCHECK(i == info->length()); |
| 572 return info; | 565 return info; |
| 573 } | 566 } |
| 574 | 567 |
| 575 } } // namespace v8::internal | 568 } } // namespace v8::internal |
| OLD | NEW |