Răsfoiți Sursa

Fixed GCMarkMembers 'this' argument casting

Brian Fiete 5 ani în urmă
părinte
comite
371f649fba
1 a modificat fișierele cu 5 adăugiri și 2 ștergeri
  1. 5 2
      IDEHelper/Compiler/BfModule.cpp

+ 5 - 2
IDEHelper/Compiler/BfModule.cpp

@@ -14984,8 +14984,11 @@ void BfModule::EmitGCMarkValue(BfTypedValue markVal, BfModuleMethodInstance mark
 		if (markMemberMethodInstance)
 		{
 			SizedArray<BfIRValue, 1> args;
-            //(1, markVal.mValue);
-			//exprEvaluator.PushArg(markVal, args);
+            
+			auto methodOwner = markMemberMethodInstance.mMethodInstance->GetOwner();
+			if (markVal.mType != methodOwner)
+				markVal = Cast(NULL, markVal, methodOwner);
+
 			exprEvaluator.PushThis(NULL, markVal, markMemberMethodInstance.mMethodInstance, args);
 			exprEvaluator.CreateCall(markMemberMethodInstance.mMethodInstance, markMemberMethodInstance.mFunc, false, args);
 		}