GDScript: Allow "new()" to be called in non-static functions
This commit is contained in:
parent
b7dc08fcf6
commit
e6b44b93c3
@ -736,7 +736,7 @@ int GDScriptCompiler::_parse_expression(CodeGen &codegen, const GDScriptParser::
|
|||||||
} else {
|
} else {
|
||||||
if (callee->type == GDScriptParser::Node::IDENTIFIER) {
|
if (callee->type == GDScriptParser::Node::IDENTIFIER) {
|
||||||
// Self function call.
|
// Self function call.
|
||||||
if (codegen.function_node && codegen.function_node->is_static) {
|
if ((codegen.function_node && codegen.function_node->is_static) || call->function_name == "new") {
|
||||||
ret = (GDScriptFunction::ADDR_TYPE_CLASS << GDScriptFunction::ADDR_BITS);
|
ret = (GDScriptFunction::ADDR_TYPE_CLASS << GDScriptFunction::ADDR_BITS);
|
||||||
} else {
|
} else {
|
||||||
ret = (GDScriptFunction::ADDR_TYPE_SELF << GDScriptFunction::ADDR_BITS);
|
ret = (GDScriptFunction::ADDR_TYPE_SELF << GDScriptFunction::ADDR_BITS);
|
||||||
|
Loading…
Reference in New Issue
Block a user