You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-19 14:31:59 +00:00
GDScript: Allow "self" to be used in class level
This commit is contained in:
@@ -1941,8 +1941,8 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_literal(ExpressionNode *p_
|
|||||||
}
|
}
|
||||||
|
|
||||||
GDScriptParser::ExpressionNode *GDScriptParser::parse_self(ExpressionNode *p_previous_operand, bool p_can_assign) {
|
GDScriptParser::ExpressionNode *GDScriptParser::parse_self(ExpressionNode *p_previous_operand, bool p_can_assign) {
|
||||||
if (!current_function || current_function->is_static) {
|
if (current_function && current_function->is_static) {
|
||||||
push_error(R"(Cannot use "self" outside a non-static function.)");
|
push_error(R"(Cannot use "self" inside a static function.)");
|
||||||
}
|
}
|
||||||
SelfNode *self = alloc_node<SelfNode>();
|
SelfNode *self = alloc_node<SelfNode>();
|
||||||
self->current_class = current_class;
|
self->current_class = current_class;
|
||||||
|
|||||||
Reference in New Issue
Block a user