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

Method _compile_class

modules/gdscript/gdscript_compiler.cpp:3002–3130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3000}
3001
3002Error GDScriptCompiler::_compile_class(GDScript *p_script, const GDScriptParser::ClassNode *p_class, bool p_keep_state) {
3003 // Compile member functions, getters, and setters.
3004 for (int i = 0; i < p_class->members.size(); i++) {
3005 const GDScriptParser::ClassNode::Member &member = p_class->members[i];
3006 if (member.type == member.FUNCTION) {
3007 const GDScriptParser::FunctionNode *function = member.function;
3008 Error err = OK;
3009 _parse_function(err, p_script, p_class, function);
3010 if (err) {
3011 return err;
3012 }
3013 } else if (member.type == member.VARIABLE) {
3014 const GDScriptParser::VariableNode *variable = member.variable;
3015 if (variable->property == GDScriptParser::VariableNode::PROP_INLINE) {
3016 if (variable->setter != nullptr) {
3017 Error err = _parse_setter_getter(p_script, p_class, variable, true);
3018 if (err) {
3019 return err;
3020 }
3021 }
3022 if (variable->getter != nullptr) {
3023 Error err = _parse_setter_getter(p_script, p_class, variable, false);
3024 if (err) {
3025 return err;
3026 }
3027 }
3028 }
3029 }
3030 }
3031
3032 {
3033 // Create `@implicit_new()` special function in any case.
3034 Error err = OK;
3035 _parse_function(err, p_script, p_class, nullptr);
3036 if (err) {
3037 return err;
3038 }
3039 }
3040
3041 if (p_class->onready_used) {
3042 // Create `@implicit_ready()` special function.
3043 Error err = OK;
3044 _parse_function(err, p_script, p_class, nullptr, true);
3045 if (err) {
3046 return err;
3047 }
3048 }
3049
3050 if (p_class->has_static_data) {
3051 Error err = OK;
3052 GDScriptFunction *func = _make_static_initializer(err, p_script, p_class);
3053 p_script->static_initializer = func;
3054 if (err) {
3055 return err;
3056 }
3057 }
3058
3059#ifdef DEBUG_ENABLED

Callers

nothing calls this directly

Calls 14

get_script_instanceMethod · 0.80
set_script_instanceMethod · 0.80
reload_membersMethod · 0.80
_static_default_initMethod · 0.80
sizeMethod · 0.65
frontMethod · 0.45
nextMethod · 0.45
getMethod · 0.45
is_placeholderMethod · 0.45
is_toolMethod · 0.45
eraseMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected