| 1048 | } |
| 1049 | |
| 1050 | Result ScriptValidator::CheckGet(const GetAction* action, Type* out_type) { |
| 1051 | const Module* module = script_->GetModule(action->module_var); |
| 1052 | if (!module) { |
| 1053 | PrintError(&action->loc, "unknown module"); |
| 1054 | return Result::Error; |
| 1055 | } |
| 1056 | |
| 1057 | const Export* export_ = module->GetExport(action->name); |
| 1058 | if (!export_) { |
| 1059 | PrintError(&action->loc, "unknown global export \"%s\"", |
| 1060 | action->name.c_str()); |
| 1061 | return Result::Error; |
| 1062 | } |
| 1063 | |
| 1064 | const Global* global = module->GetGlobal(export_->var); |
| 1065 | if (!global) { |
| 1066 | // This error will have already been reported, just skip it. |
| 1067 | return Result::Error; |
| 1068 | } |
| 1069 | |
| 1070 | *out_type = global->type; |
| 1071 | return Result::Ok; |
| 1072 | } |
| 1073 | |
| 1074 | ScriptValidator::ActionResult ScriptValidator::CheckAction( |
| 1075 | const Action* action) { |