diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 79d7cc58..02e52db2 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -5740,7 +5740,7 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary& usedStrin BfType* reflectParamDataType = ResolveTypeDef(mCompiler->mReflectParamDataDef); BfType* reflectParamDataPtrType = CreatePointerType(reflectParamDataType); - SizedArray methodTypes; + SizedArray methodTypes; for (int methodIdx = 0; methodIdx < (int)typeDef->mMethods.size(); methodIdx++) { if (!needsTypeData) @@ -5837,6 +5837,7 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary& usedStrin MethodFlags_FastCall = 0x2000, MethodFlags_ThisCall = 0x3000, MethodFlags_Mutating = 0x4000, + MethodFlags_Constructor = 0x8000, }; MethodFlags methodFlags = (MethodFlags)0; @@ -5853,6 +5854,8 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary& usedStrin methodFlags = (MethodFlags)(methodFlags | MethodFlags_FastCall); if (methodDef->mIsMutating) methodFlags = (MethodFlags)(methodFlags | MethodFlags_Mutating); + if (methodDef->mMethodType == BfMethodType_Ctor) + methodFlags = (MethodFlags)(methodFlags | MethodFlags_Constructor); auto callingConvention = GetIRCallingConvention(defaultMethod); if (callingConvention == BfIRCallingConv_ThisCall) @@ -5948,7 +5951,7 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary& usedStrin GetConstValue(vDataVal, intType), GetConstValue(-1, intType), }; - auto methodData = mBfIRBuilder->CreateConstStruct(mBfIRBuilder->MapTypeInst(reflectMethodDataType->ToTypeInstance(), BfIRPopulateType_Full), methodDataVals); + auto methodData = mBfIRBuilder->CreateConstStruct(mBfIRBuilder->MapTypeInst(reflectMethodDataType->ToTypeInstance(), BfIRPopulateType_Full), methodDataVals); methodTypes.push_back(methodData); } @@ -5964,7 +5967,7 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary& usedStrin methodDataConst, "methods." + typeDataName); methodDataPtr = mBfIRBuilder->CreateBitCast(methodDataArray, methodDataPtrType); } - + ///// int underlyingType = 0; @@ -6011,14 +6014,12 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary& usedStrin GetConstValue(0, byteType), // mInterfaceCount GetConstValue((int)methodTypes.size(), shortType), // mMethodDataCount GetConstValue(0, shortType), // mPropertyDataCount - GetConstValue((int)fieldTypes.size(), shortType), // mFieldDataCount - GetConstValue(0, shortType), // mConstructorDataCount + GetConstValue((int)fieldTypes.size(), shortType), // mFieldDataCount voidPtrNull, // mInterfaceDataPtr methodDataPtr, // mMethodDataPtr voidPtrNull, // mPropertyDataPtr - fieldDataPtr, // mFieldDataPtr - voidPtrNull, // mConstructorDataPtr + fieldDataPtr, // mFieldDataPtr customAttrDataPtr, // mCustomAttrDataPtr }; @@ -10146,6 +10147,12 @@ void BfModule::ProcessTypeInstCustomAttributes(bool& isPacked, bool& isUnion, bo if ((constant != NULL) && (constant->mBool)) mCurTypeInstance->mHasBeenInstantiated = true; } + else if (propertyDef->mName == "IncludeAllMethods") + { + auto constant = mCurTypeInstance->mConstHolder->GetConstant(setProp.mParam.mValue); + if ((constant != NULL) && (constant->mBool)) + mCurTypeInstance->mIncludeAllMethods = true; + } } } } diff --git a/IDEHelper/Compiler/BfResolvedTypeUtils.h b/IDEHelper/Compiler/BfResolvedTypeUtils.h index adb2c6bf..d14f5e62 100644 --- a/IDEHelper/Compiler/BfResolvedTypeUtils.h +++ b/IDEHelper/Compiler/BfResolvedTypeUtils.h @@ -484,7 +484,7 @@ public: virtual bool IsFloat() { return false; } virtual bool IsPointer() { return false; } virtual bool IsIntPtrable() { return false; } - virtual bool IsRef() { return false; } + virtual bool IsRef() { return false; } virtual bool IsGenericParam() { return false; } virtual bool IsClosure() { return false; } virtual bool IsMethodRef() { return false; } @@ -1000,7 +1000,7 @@ public: virtual BfConstraintDef* GetConstraintDef() = 0; virtual BfGenericParamDef* GetGenericParamDef() = 0; virtual BfExternalConstraintDef* GetExternConstraintDef() = 0; - virtual String GetName() = 0; + virtual String GetName() = 0; }; class BfGenericTypeParamInstance : public BfGenericParamInstance @@ -1607,6 +1607,7 @@ public: int16 mInheritDepth; int16 mSlotNum; bool mHasBeenInstantiated; + bool mIncludeAllMethods; bool mIsReified; bool mIsTypedPrimitive; bool mIsCRepr; @@ -1670,6 +1671,7 @@ public: mResolvingConstField = false; mHasPackingHoles = false; mHasBeenInstantiated = false; + mIncludeAllMethods = false; mWantsGCMarking = false; mHasParameterizedBase = false; mMergedFieldDataCount = 0; @@ -1985,7 +1987,7 @@ public: void Finish(); virtual bool IsOnDemand() override { return true; } - virtual bool IsTuple() override { return true; } + virtual bool IsTuple() override { return true; } virtual bool IsUnspecializedType() override { return mHasUnspecializedMembers; } virtual bool IsUnspecializedTypeVariation() override { return mHasUnspecializedMembers; } @@ -2094,7 +2096,7 @@ public: virtual bool IsIncomplete() override { CheckElement(); return mDefineState < BfTypeDefineState_Defined; } virtual bool IsReified() override { return mElementType->IsReified(); } - virtual bool IsRef() override { return true; } + virtual bool IsRef() override { return true; } virtual bool IsDependentOnUnderlyingType() override { return true; } virtual BfType* GetUnderlyingType() override { return mElementType; } virtual bool IsUnspecializedType() override { return mElementType->IsUnspecializedType(); }