1
0
Fork 0

GDScript: Fix error on operator `"member" in Class`

This commit is contained in:
rune-scape 2025-02-22 23:28:10 -08:00
parent b0655dc86f
commit 3f451c59c9
3 changed files with 15 additions and 0 deletions

View File

@ -3059,6 +3059,13 @@ void GDScriptAnalyzer::reduce_binary_op(GDScriptParser::BinaryOpNode *p_binary_o
}
#endif
bool lhs_is_stringy = left_type.kind == GDScriptParser::DataType::BUILTIN && (left_type.builtin_type == Variant::STRING || left_type.builtin_type == Variant::STRING_NAME);
bool rhs_is_meta_class = right_type.kind == GDScriptParser::DataType::CLASS && right_type.is_meta_type;
if (lhs_is_stringy && p_binary_op->variant_op == Variant::OP_IN && rhs_is_meta_class) {
// TODO: Some script members presence could be determined here.
return;
}
if (p_binary_op->left_operand->is_constant && p_binary_op->right_operand->is_constant) {
p_binary_op->is_constant = true;
if (p_binary_op->variant_op < Variant::OP_MAX) {

View File

@ -0,0 +1,6 @@
class MyClass:
static func my_static():
print("my_static")
func test():
print("my_static" in MyClass)