2
0
Эх сурвалжийг харах

Fix yield check in GDScriptFunction

Fixes #31455
Bojidar Marinov 6 жил өмнө
parent
commit
112aa6e367

+ 2 - 2
modules/gdscript/gdscript_function.cpp

@@ -431,6 +431,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
 		profile.frame_call_count++;
 		profile.frame_call_count++;
 	}
 	}
 	bool exit_ok = false;
 	bool exit_ok = false;
+	bool yielded = false;
 #endif
 #endif
 
 
 #ifdef DEBUG_ENABLED
 #ifdef DEBUG_ENABLED
@@ -1323,6 +1324,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
 
 
 #ifdef DEBUG_ENABLED
 #ifdef DEBUG_ENABLED
 				exit_ok = true;
 				exit_ok = true;
+				yielded = true;
 #endif
 #endif
 				OPCODE_BREAK;
 				OPCODE_BREAK;
 			}
 			}
@@ -1589,8 +1591,6 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
 		GDScriptLanguage::get_singleton()->script_frame_time += time_taken - function_call_time;
 		GDScriptLanguage::get_singleton()->script_frame_time += time_taken - function_call_time;
 	}
 	}
 
 
-	bool yielded = retvalue.is_ref() && Object::cast_to<GDScriptFunctionState>(retvalue);
-
 	// Check if this is the last time the function is resuming from yield
 	// Check if this is the last time the function is resuming from yield
 	// Will be true if never yielded as well
 	// Will be true if never yielded as well
 	// When it's the last resume it will postpone the exit from stack,
 	// When it's the last resume it will postpone the exit from stack,