Преглед на файлове

DynamicCastToSignature release fix

Brian Fiete преди 4 месеца
родител
ревизия
c7da3e15f9
променени са 4 файла, в които са добавени 9 реда и са изтрити 9 реда
  1. 1 1
      BeefLibs/corlib/src/Object.bf
  2. 5 5
      IDEHelper/Compiler/BfDefBuilder.cpp
  3. 1 1
      IDEHelper/Compiler/BfDefBuilder.h
  4. 2 2
      IDEHelper/Compiler/BfModuleTypeUtils.cpp

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

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

+ 5 - 5
IDEHelper/Compiler/BfDefBuilder.cpp

@@ -1355,9 +1355,9 @@ BfMethodDef* BfDefBuilder::AddDtor(BfTypeDef* typeDef)
 	return methodDef;
 	return methodDef;
 }
 }
 
 
-void BfDefBuilder::AddDynamicCastMethods(BfTypeDef* typeDef)
+void BfDefBuilder::AddDynamicCastMethods(BfTypeDef* typeDef, bool needsDynamicCastMethods)
 {
 {
-	//
+	if (needsDynamicCastMethods)
 	{
 	{
 		auto methodDef = new BfMethodDef();
 		auto methodDef = new BfMethodDef();
 		methodDef->mIdx = (int)typeDef->mMethods.size();
 		methodDef->mIdx = (int)typeDef->mMethods.size();
@@ -1378,7 +1378,7 @@ void BfDefBuilder::AddDynamicCastMethods(BfTypeDef* typeDef)
 		methodDef->mIsNoReflect = true;
 		methodDef->mIsNoReflect = true;
 	}
 	}
 
 
-	//
+	if (needsDynamicCastMethods)
 	{
 	{
 		auto methodDef = new BfMethodDef();
 		auto methodDef = new BfMethodDef();
 		methodDef->mIdx = (int)typeDef->mMethods.size();
 		methodDef->mIdx = (int)typeDef->mMethods.size();
@@ -2392,10 +2392,10 @@ void BfDefBuilder::FinishTypeDef(bool wantsToString)
 		isAutocomplete = true;
 		isAutocomplete = true;
 
 
 	//TODO: Don't do this for the autocomplete pass
 	//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))
 		(!mCurTypeDef->mIsStatic) && (!isAutocomplete) && (!isAlias) && (!mCurTypeDef->mIsOpaque))
 	{
 	{
-		AddDynamicCastMethods(mCurTypeDef);
+		AddDynamicCastMethods(mCurTypeDef, needsDynamicCastMethod);
 	}
 	}
 
 
 	bool isPayloadEnum = false;
 	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 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* AddMethod(BfTypeDef* typeDef, BfMethodType methodType, BfProtection protection, bool isStatic, const StringImpl& name, bool addedAfterEmit = false);
 	static BfMethodDef* AddDtor(BfTypeDef* typeDef);
 	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);
 	static void AddParam(BfMethodDef* methodDef, BfTypeReference* typeRef, const StringImpl& paramName);
 	BfTypeDef* ComparePrevTypeDef(BfTypeDef* prevTypeDef, BfTypeDef* checkTypeDef);
 	BfTypeDef* ComparePrevTypeDef(BfTypeDef* prevTypeDef, BfTypeDef* checkTypeDef);
 	void FinishTypeDef(bool wantsToString);
 	void FinishTypeDef(bool wantsToString);

+ 2 - 2
IDEHelper/Compiler/BfModuleTypeUtils.cpp

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