| 585 | } |
| 586 | |
| 587 | const Module* Script::GetModule(const Var& var) const { |
| 588 | Index index = module_bindings.FindIndex(var); |
| 589 | if (index >= commands.size()) { |
| 590 | return nullptr; |
| 591 | } |
| 592 | auto* command = commands[index].get(); |
| 593 | if (isa<ModuleCommand>(command)) { |
| 594 | return &cast<ModuleCommand>(command)->module; |
| 595 | } else if (isa<ScriptModuleCommand>(command)) { |
| 596 | return &cast<ScriptModuleCommand>(command)->module; |
| 597 | } |
| 598 | return nullptr; |
| 599 | } |
| 600 | |
| 601 | void MakeTypeBindingReverseMapping( |
| 602 | size_t num_types, |