MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / make_scripts

Method make_scripts

modules/gdscript/gdscript_compiler.cpp:3146–3185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3144}
3145
3146void GDScriptCompiler::make_scripts(GDScript *p_script, const GDScriptParser::ClassNode *p_class, bool p_keep_state) {
3147 p_script->fully_qualified_name = p_class->fqcn;
3148 p_script->local_name = p_class->identifier ? p_class->identifier->name : StringName();
3149 p_script->global_name = p_class->get_global_name();
3150 p_script->simplified_icon_path = p_class->simplified_icon_path;
3151
3152 HashMap<StringName, Ref<GDScript>> old_subclasses;
3153
3154 if (p_keep_state) {
3155 old_subclasses = p_script->subclasses;
3156 }
3157
3158 p_script->subclasses.clear();
3159
3160 for (int i = 0; i < p_class->members.size(); i++) {
3161 if (p_class->members[i].type != GDScriptParser::ClassNode::Member::CLASS) {
3162 continue;
3163 }
3164 const GDScriptParser::ClassNode *inner_class = p_class->members[i].m_class;
3165 StringName name = inner_class->identifier->name;
3166
3167 Ref<GDScript> subclass;
3168
3169 if (old_subclasses.has(name)) {
3170 subclass = old_subclasses[name];
3171 } else {
3172 subclass = GDScriptLanguage::get_singleton()->get_orphan_subclass(inner_class->fqcn);
3173 }
3174
3175 if (subclass.is_null()) {
3176 subclass.instantiate();
3177 }
3178
3179 subclass->_owner = p_script;
3180 subclass->path = p_script->path;
3181 p_script->subclasses.insert(name, subclass);
3182
3183 make_scripts(subclass.ptr(), inner_class, p_keep_state);
3184 }
3185}
3186
3187GDScriptCompiler::FunctionLambdaInfo GDScriptCompiler::_get_function_replacement_info(GDScriptFunction *p_func, int p_index, int p_depth, GDScriptFunction *p_parent_func) {
3188 FunctionLambdaInfo info;

Callers

nothing calls this directly

Calls 10

get_orphan_subclassMethod · 0.80
sizeMethod · 0.65
StringNameClass · 0.50
get_global_nameMethod · 0.45
clearMethod · 0.45
hasMethod · 0.45
is_nullMethod · 0.45
instantiateMethod · 0.45
insertMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected