Răsfoiți Sursa

DynamicCastToSignature release fix

Brian Fiete 4 luni în urmă
părinte
comite
c7da3e15f9

+ 1 - 1
BeefLibs/corlib/src/Object.bf

@@ -130,13 +130,13 @@ namespace System
 		{
 		    return null;
 		}
+#endif
 
 		[NoShow]
 		public virtual Object DynamicCastToSignature(int32 sig)
 		{
 		    return null;
 		}
-#endif
 
         int IHashable.GetHashCode()
         {

+ 5 - 5
IDEHelper/Compiler/BfDefBuilder.cpp

@@ -1355,9 +1355,9 @@ BfMethodDef* BfDefBuilder::AddDtor(BfTypeDef* typeDef)
 	return methodDef;
 }
 
-void BfDefBuilder::AddDynamicCastMethods(BfTypeDef* typeDef)
+void BfDefBuilder::AddDynamicCastMethods(BfTypeDef* typeDef, bool needsDynamicCastMethods)
 {
-	//
+	if (needsDynamicCastMethods)
 	{
 		auto methodDef = new BfMethodDef();
 		methodDef->mIdx = (int)typeDef->mMethods.size();
@@ -1378,7 +1378,7 @@ void BfDefBuilder::AddDynamicCastMethods(BfTypeDef* typeDef)
 		methodDef->mIsNoReflect = true;
 	}
 
-	//
+	if (needsDynamicCastMethods)
 	{
 		auto methodDef = new BfMethodDef();
 		methodDef->mIdx = (int)typeDef->mMethods.size();
@@ -2392,10 +2392,10 @@ void BfDefBuilder::FinishTypeDef(bool wantsToString)
 		isAutocomplete = true;
 
 	//TODO: Don't do this for the autocomplete pass
-	if ((needsDynamicCastMethod) && (mCurTypeDef->mTypeCode != BfTypeCode_Interface) && (mCurTypeDef->mTypeCode != BfTypeCode_Extension) &&
+	if ((mCurTypeDef->mTypeCode != BfTypeCode_Interface) && (mCurTypeDef->mTypeCode != BfTypeCode_Extension) &&
 		(!mCurTypeDef->mIsStatic) && (!isAutocomplete) && (!isAlias) && (!mCurTypeDef->mIsOpaque))
 	{
-		AddDynamicCastMethods(mCurTypeDef);
+		AddDynamicCastMethods(mCurTypeDef, needsDynamicCastMethod);
 	}
 
 	bool isPayloadEnum = false;

+ 1 - 1
IDEHelper/Compiler/BfDefBuilder.h

@@ -52,7 +52,7 @@ public:
 	static BfFieldDef* AddField(BfTypeDef* typeDef, BfTypeReference* typeRef, const StringImpl& name);
 	static BfMethodDef* AddMethod(BfTypeDef* typeDef, BfMethodType methodType, BfProtection protection, bool isStatic, const StringImpl& name, bool addedAfterEmit = false);
 	static BfMethodDef* AddDtor(BfTypeDef* typeDef);
-	static void AddDynamicCastMethods(BfTypeDef* typeDef);
+	static void AddDynamicCastMethods(BfTypeDef* typeDef, bool needsDynamicCastMethods);
 	static void AddParam(BfMethodDef* methodDef, BfTypeReference* typeRef, const StringImpl& paramName);
 	BfTypeDef* ComparePrevTypeDef(BfTypeDef* prevTypeDef, BfTypeDef* checkTypeDef);
 	void FinishTypeDef(bool wantsToString);

+ 2 - 2
IDEHelper/Compiler/BfModuleTypeUtils.cpp

@@ -9520,7 +9520,7 @@ BfType* BfModule::ResolveGenericType(BfType* unspecializedType, BfTypeVector* ty
 		if (typeDef->mIsDelegate)
 		{
 			BfDefBuilder::AddMethod(typeDef, BfMethodType_Ctor, BfProtection_Public, false, "");
-			BfDefBuilder::AddDynamicCastMethods(typeDef);
+			BfDefBuilder::AddDynamicCastMethods(typeDef, true);
 		}
 
 		delegateType->mContext = mContext;
@@ -12907,7 +12907,7 @@ BfType* BfModule::ResolveTypeRef_Ref(BfTypeReference* typeRef, BfPopulateType po
 		if (typeDef->mIsDelegate)
 		{
 			BfDefBuilder::AddMethod(typeDef, BfMethodType_Ctor, BfProtection_Public, false, "");
-			BfDefBuilder::AddDynamicCastMethods(typeDef);
+			BfDefBuilder::AddDynamicCastMethods(typeDef, true);
 		}
 
 		delegateType->mContext = mContext;