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

Method compile

modules/gdscript/gdscript_compiler.cpp:3313–3355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3311}
3312
3313Error GDScriptCompiler::compile(const GDScriptParser *p_parser, GDScript *p_script, bool p_keep_state) {
3314 err_line = -1;
3315 err_column = -1;
3316 error = "";
3317 parser = p_parser;
3318 main_script = p_script;
3319 const GDScriptParser::ClassNode *root = parser->get_tree();
3320
3321 source = p_script->get_path();
3322
3323 ScriptLambdaInfo old_lambda_info = _get_script_lambda_replacement_info(p_script);
3324
3325 // Create scripts for subclasses beforehand so they can be referenced
3326 make_scripts(p_script, root, p_keep_state);
3327
3328 main_script->_owner = nullptr;
3329 Error err = _prepare_compilation(main_script, parser->get_tree(), p_keep_state);
3330
3331 if (err) {
3332 return err;
3333 }
3334
3335 err = _compile_class(main_script, root, p_keep_state);
3336 if (err) {
3337 return err;
3338 }
3339
3340 ScriptLambdaInfo new_lambda_info = _get_script_lambda_replacement_info(p_script);
3341
3342 HashMap<GDScriptFunction *, GDScriptFunction *> func_ptr_replacements;
3343 _get_function_ptr_replacements(func_ptr_replacements, old_lambda_info, &new_lambda_info);
3344 main_script->_recurse_replace_function_ptrs(func_ptr_replacements);
3345
3346 if (has_static_data && !root->annotated_static_unload) {
3347 GDScriptCache::add_static_script(p_script);
3348 }
3349
3350 err = GDScriptCache::finish_compiling(main_script->path);
3351 if (err) {
3352 _set_error(R"(Failed to compile depended scripts.)", nullptr);
3353 }
3354 return err;
3355}
3356
3357String GDScriptCompiler::get_error() const {
3358 return error;

Callers 3

reloadMethod · 0.45
test_compilerFunction · 0.45
execute_test_codeMethod · 0.45

Calls 3

get_treeMethod · 0.45
get_pathMethod · 0.45

Tested by 2

test_compilerFunction · 0.36
execute_test_codeMethod · 0.36