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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 Handle<ModuleInfo> ModuleInfo::Create( | 555 Handle<ModuleInfo> ModuleInfo::Create( |
556 Isolate* isolate, Interface* interface, Scope* scope) { | 556 Isolate* isolate, Interface* interface, Scope* scope) { |
557 Handle<ModuleInfo> info = Allocate(isolate, interface->Length()); | 557 Handle<ModuleInfo> info = Allocate(isolate, interface->Length()); |
558 info->set_host_index(interface->Index()); | 558 info->set_host_index(interface->Index()); |
559 int i = 0; | 559 int i = 0; |
560 for (Interface::Iterator it = interface->iterator(); | 560 for (Interface::Iterator it = interface->iterator(); |
561 !it.done(); it.Advance(), ++i) { | 561 !it.done(); it.Advance(), ++i) { |
562 Variable* var = scope->LookupLocal(it.name()); | 562 Variable* var = scope->LookupLocal(it.name()); |
563 info->set_name(i, *(it.name()->string())); | 563 info->set_name(i, *(it.name()->string())); |
564 info->set_mode(i, var->mode()); | 564 info->set_mode(i, var->mode()); |
565 DCHECK((var->mode() == MODULE) == (it.interface()->IsModule())); | 565 DCHECK(var->index() >= 0); |
566 if (var->mode() == MODULE) { | 566 info->set_index(i, var->index()); |
567 DCHECK(it.interface()->IsFrozen()); | |
568 DCHECK(it.interface()->Index() >= 0); | |
569 info->set_index(i, it.interface()->Index()); | |
570 } else { | |
571 DCHECK(var->index() >= 0); | |
572 info->set_index(i, var->index()); | |
573 } | |
574 } | 567 } |
575 DCHECK(i == info->length()); | 568 DCHECK(i == info->length()); |
576 return info; | 569 return info; |
577 } | 570 } |
578 | 571 |
579 } } // namespace v8::internal | 572 } } // namespace v8::internal |
OLD | NEW |