Merge pull request #49114 from vnen/gdscript-fix-self-function-type-check

GDScript: Fix function signature check for self calls
This commit is contained in:
Rémi Verschelde 2021-05-26 20:59:17 +02:00 committed by GitHub
commit 364ea7f280
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View file

@ -2068,9 +2068,11 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool is_awa
if (p_call->is_super) {
base_type = parser->current_class->base_type;
base_type.is_meta_type = false;
is_self = true;
} else if (callee_type == GDScriptParser::Node::IDENTIFIER) {
base_type = parser->current_class->get_datatype();
base_type.is_meta_type = false;
is_self = true;
} else if (callee_type == GDScriptParser::Node::SUBSCRIPT) {
GDScriptParser::SubscriptNode *subscript = static_cast<GDScriptParser::SubscriptNode *>(p_call->callee);

View file

@ -0,0 +1,9 @@
extends Node
func test():
set_name("TestNodeName")
if get_name() == &"TestNodeName":
print("Name is equal")
else:
print("Name is not equal")
print(get_name() is StringName)

View file

@ -0,0 +1,3 @@
GDTEST_OK
Name is equal
True