### Godot version

v4.0.beta.custom_build [1d14c054a]

### System information

Kubuntu 22.10

### Issue description

Regression in master (in beta 10 the following script works correctly).

### Steps to reproduce

```gdscript
@tool
extends EditorScript

func wait(time: float) -> void:
    await get_editor_interface().get_tree().create_timer(time).timeout

func _run() -> void:
    reference()
    # Error: Cannot get return value of call to "wait()" because it returns "void".
    await wait(1.0)
    print("Test")
    unreference()
```

### Minimal reproduction project

N/A
}
				Ref<Resource> res;
				if (class_node->identifier && class_node->identifier->name == identifier) {
					res = Ref<GDScript>(main_script);
				} else {
					String global_class_path = ScriptServer::get_global_class_path(identifier);
					if (ResourceLoader::get_resource_type(global_class_path) == "GDScript") {
						Error err = OK;
						res = GDScriptCache::get_full_script(global_class_path, err);
						if (err != OK) {
							_set_error("Can't load global class " + String(identifier), p_expression);
							r_error = ERR_COMPILATION_FAILED;
							return GDScriptCodeGenerator::Address();
						}
					} else {
						res = ResourceLoader::load(global_class_path);
						if (res.is_null()) {
							_set_error("Can't load global class " + String(identifier) + ", cyclic reference?", p_expression);
							r_error = ERR_COMPILATION_FAILED;
							return GDScriptCodeGenerator::Address();
						}
					}
				}
				return codegen.add_constant(res);
			}
#ifdef TOOLS_ENABLED
			if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(identifier)) {
				GDScriptCodeGenerator::Address global = codegen.add_temporary(); 
				gen->write_store_named_global(global, identifier);
				return global;