mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Added Obsolete support for moved collections
This commit is contained in:
parent
dbd9b32e3f
commit
842a6a8898
16 changed files with 232 additions and 109 deletions
|
@ -116,3 +116,9 @@ namespace System.Collections
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace System.Collections.Generic
|
||||||
|
{
|
||||||
|
[Obsolete("The System.Collections.Generic types have been moved into System.Collections", false)]
|
||||||
|
typealias BinaryHeap<T> = System.Collections.BinaryHeap<T>;
|
||||||
|
}
|
||||||
|
|
|
@ -940,3 +940,9 @@ namespace System.Collections
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace System.Collections.Generic
|
||||||
|
{
|
||||||
|
[Obsolete("The System.Collections.Generic types have been moved into System.Collections", false)]
|
||||||
|
typealias Dictionary<TKey, TValue> = System.Collections.Dictionary<TKey, TValue>;
|
||||||
|
}
|
||||||
|
|
|
@ -1164,3 +1164,9 @@ namespace System.Collections
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace System.Collections.Generic
|
||||||
|
{
|
||||||
|
[Obsolete("The System.Collections.Generic types have been moved into System.Collections", false)]
|
||||||
|
typealias HashSet<T> = System.Collections.HashSet<T>;
|
||||||
|
}
|
||||||
|
|
|
@ -37,3 +37,9 @@ namespace System.Collections
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace System.Collections.Generic
|
||||||
|
{
|
||||||
|
[Obsolete("The System.Collections.Generic types have been moved into System.Collections", false)]
|
||||||
|
typealias KeyValuePair<TKey, TValue> = System.Collections.KeyValuePair<TKey, TValue>;
|
||||||
|
}
|
||||||
|
|
|
@ -798,3 +798,9 @@ namespace System.Collections
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace System.Collections.Generic
|
||||||
|
{
|
||||||
|
[Obsolete("The System.Collections.Generic types have been moved into System.Collections", false)]
|
||||||
|
typealias List<T> = System.Collections.List<T>;
|
||||||
|
}
|
||||||
|
|
|
@ -460,3 +460,9 @@ namespace System.Collections
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace System.Collections.Generic
|
||||||
|
{
|
||||||
|
[Obsolete("The System.Collections.Generic types have been moved into System.Collections", false)]
|
||||||
|
typealias Queue<T> = System.Collections.Queue<T>;
|
||||||
|
}
|
||||||
|
|
|
@ -299,3 +299,9 @@ namespace System.Collections
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace System.Collections.Generic
|
||||||
|
{
|
||||||
|
[Obsolete("The System.Collections.Generic types have been moved into System.Collections", false)]
|
||||||
|
typealias Sorter<T, T2> = System.Collections.Sorter<T, T2>;
|
||||||
|
}
|
||||||
|
|
|
@ -27,11 +27,12 @@ namespace System
|
||||||
MemberAccess = 0x20000,
|
MemberAccess = 0x20000,
|
||||||
Alloc = 0x40000,
|
Alloc = 0x40000,
|
||||||
Delete = 0x80000,
|
Delete = 0x80000,
|
||||||
|
Alias = 0x100000,
|
||||||
|
|
||||||
All = Assembly | Module | Class | Struct | Enum | Constructor |
|
All = Assembly | Module | Class | Struct | Enum | Constructor |
|
||||||
Method | Property | Field | StaticField | Interface | Parameter |
|
Method | Property | Field | StaticField | Interface | Parameter |
|
||||||
Delegate | Function | ReturnValue | GenericParameter | Invocation | MemberAccess |
|
Delegate | Function | ReturnValue | GenericParameter | Invocation | MemberAccess |
|
||||||
Alloc | Delete,
|
Alloc | Delete | Alias,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ReflectKind
|
public enum ReflectKind
|
||||||
|
@ -350,7 +351,7 @@ namespace System
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(.Method | .Constructor)]
|
[AttributeUsage(.Method | .Constructor | .Class | .Struct | .Alias)]
|
||||||
public struct ObsoleteAttribute : Attribute
|
public struct ObsoleteAttribute : Attribute
|
||||||
{
|
{
|
||||||
public this(bool isError)
|
public this(bool isError)
|
||||||
|
@ -370,7 +371,7 @@ namespace System
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(.Method | .Constructor)]
|
[AttributeUsage(.Method | .Constructor | .Class | .Struct | .Alias)]
|
||||||
public struct ErrorAttribute : Attribute
|
public struct ErrorAttribute : Attribute
|
||||||
{
|
{
|
||||||
public this(String error)
|
public this(String error)
|
||||||
|
@ -379,7 +380,7 @@ namespace System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(.Method | .Constructor)]
|
[AttributeUsage(.Method | .Constructor | .Class | .Struct | .Alias)]
|
||||||
public struct WarnAttribute : Attribute
|
public struct WarnAttribute : Attribute
|
||||||
{
|
{
|
||||||
public this(String error)
|
public this(String error)
|
||||||
|
|
|
@ -654,3 +654,9 @@ namespace System.Collections
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace System.Collections.Generic
|
||||||
|
{
|
||||||
|
[Obsolete("The System.Collections.Generic containers have been moved into System.Collections", false)]
|
||||||
|
typealias List<T> = System.Collections.List<T>;
|
||||||
|
}
|
||||||
|
|
|
@ -4623,6 +4623,16 @@ void BfCompiler::MarkStringPool(BfModule* module)
|
||||||
MarkStringPool(specModulePair.mValue);
|
MarkStringPool(specModulePair.mValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BfCompiler::MarkStringPool(BfIRConstHolder* constHolder, BfIRValue irValue)
|
||||||
|
{
|
||||||
|
auto constant = constHolder->GetConstant(irValue);
|
||||||
|
if ((constant != NULL) && (constant->mTypeCode == BfTypeCode_StringId))
|
||||||
|
{
|
||||||
|
BfStringPoolEntry& stringPoolEntry = mContext->mStringObjectIdMap[constant->mInt32];
|
||||||
|
stringPoolEntry.mLastUsedRevision = mRevision;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BfCompiler::ClearUnusedStringPoolEntries()
|
void BfCompiler::ClearUnusedStringPoolEntries()
|
||||||
{
|
{
|
||||||
BF_ASSERT(!IsHotCompile());
|
BF_ASSERT(!IsHotCompile());
|
||||||
|
@ -4632,6 +4642,24 @@ void BfCompiler::ClearUnusedStringPoolEntries()
|
||||||
MarkStringPool(module);
|
MarkStringPool(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto type : mContext->mResolvedTypes)
|
||||||
|
{
|
||||||
|
auto typeInstance = type->ToTypeInstance();
|
||||||
|
if (typeInstance == NULL)
|
||||||
|
continue;
|
||||||
|
if (typeInstance->mCustomAttributes == NULL)
|
||||||
|
continue;
|
||||||
|
for (auto& attribute : typeInstance->mCustomAttributes->mAttributes)
|
||||||
|
{
|
||||||
|
for (auto arg : attribute.mCtorArgs)
|
||||||
|
MarkStringPool(typeInstance->mConstHolder, arg);
|
||||||
|
for (auto setValue : attribute.mSetProperties)
|
||||||
|
MarkStringPool(typeInstance->mConstHolder, setValue.mParam.mValue);
|
||||||
|
for (auto setValue : attribute.mSetField)
|
||||||
|
MarkStringPool(typeInstance->mConstHolder, setValue.mParam.mValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (auto itr = mContext->mStringObjectIdMap.begin(); itr != mContext->mStringObjectIdMap.end(); )
|
for (auto itr = mContext->mStringObjectIdMap.begin(); itr != mContext->mStringObjectIdMap.end(); )
|
||||||
{
|
{
|
||||||
int strId = itr->mKey;
|
int strId = itr->mKey;
|
||||||
|
|
|
@ -437,6 +437,7 @@ public:
|
||||||
BfTypeDef* GetArrayTypeDef(int dimensions);
|
BfTypeDef* GetArrayTypeDef(int dimensions);
|
||||||
void GenerateAutocompleteInfo();
|
void GenerateAutocompleteInfo();
|
||||||
void MarkStringPool(BfModule* module);
|
void MarkStringPool(BfModule* module);
|
||||||
|
void MarkStringPool(BfIRConstHolder* constHolder, BfIRValue irValue);
|
||||||
void ClearUnusedStringPoolEntries();
|
void ClearUnusedStringPoolEntries();
|
||||||
void ClearBuildCache();
|
void ClearBuildCache();
|
||||||
int GetDynCastVDataCount();
|
int GetDynCastVDataCount();
|
||||||
|
|
|
@ -4135,76 +4135,7 @@ void BfExprEvaluator::PerformCallChecks(BfMethodInstance* methodInstance, BfAstN
|
||||||
{
|
{
|
||||||
BfCustomAttributes* customAttributes = methodInstance->GetCustomAttributes();
|
BfCustomAttributes* customAttributes = methodInstance->GetCustomAttributes();
|
||||||
if (customAttributes != NULL)
|
if (customAttributes != NULL)
|
||||||
{
|
mModule->CheckErrorAttributes(methodInstance->GetOwner(), methodInstance, customAttributes, targetSrc);
|
||||||
auto _AddMethodDeclarationMoreInfo = [&]()
|
|
||||||
{
|
|
||||||
if (methodInstance->mMethodDef->mMethodDeclaration != NULL)
|
|
||||||
mModule->mCompiler->mPassInstance->MoreInfo(
|
|
||||||
StrFormat("See method declaration '%s'", mModule->MethodToString(methodInstance).c_str()),
|
|
||||||
methodInstance->mMethodDef->GetRefNode());
|
|
||||||
};
|
|
||||||
|
|
||||||
BfIRConstHolder* constHolder = methodInstance->GetOwner()->mConstHolder;
|
|
||||||
auto customAttribute = customAttributes->Get(mModule->mCompiler->mObsoleteAttributeTypeDef);
|
|
||||||
if ((customAttribute != NULL) && (!customAttribute->mCtorArgs.IsEmpty()))
|
|
||||||
{
|
|
||||||
String err;
|
|
||||||
err = StrFormat("'%s' is obsolete", mModule->MethodToString(methodInstance).c_str());
|
|
||||||
|
|
||||||
bool isError = false;
|
|
||||||
|
|
||||||
auto constant = constHolder->GetConstant(customAttribute->mCtorArgs[0]);
|
|
||||||
if (constant->mTypeCode == BfTypeCode_Boolean)
|
|
||||||
{
|
|
||||||
isError = constant->mBool;
|
|
||||||
}
|
|
||||||
else if (customAttribute->mCtorArgs.size() >= 2)
|
|
||||||
{
|
|
||||||
String* str = mModule->GetStringPoolString(customAttribute->mCtorArgs[0], constHolder);
|
|
||||||
if (str != NULL)
|
|
||||||
{
|
|
||||||
err += ":\n '";
|
|
||||||
err += *str;
|
|
||||||
err += "'";
|
|
||||||
}
|
|
||||||
|
|
||||||
constant = constHolder->GetConstant(customAttribute->mCtorArgs[1]);
|
|
||||||
isError = constant->mBool;
|
|
||||||
}
|
|
||||||
|
|
||||||
BfError* error = NULL;
|
|
||||||
if (isError)
|
|
||||||
error = mModule->Fail(err, targetSrc);
|
|
||||||
else
|
|
||||||
error = mModule->Warn(0, err, targetSrc);
|
|
||||||
if (error != NULL)
|
|
||||||
_AddMethodDeclarationMoreInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
customAttribute = customAttributes->Get(mModule->mCompiler->mErrorAttributeTypeDef);
|
|
||||||
if ((customAttribute != NULL) && (!customAttribute->mCtorArgs.IsEmpty()))
|
|
||||||
{
|
|
||||||
String err = StrFormat("Method error: '", mModule->MethodToString(methodInstance).c_str());
|
|
||||||
String* str = mModule->GetStringPoolString(customAttribute->mCtorArgs[0], constHolder);
|
|
||||||
if (str != NULL)
|
|
||||||
err += *str;
|
|
||||||
err += "'";
|
|
||||||
if (mModule->Fail(err, targetSrc) != NULL)
|
|
||||||
_AddMethodDeclarationMoreInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
customAttribute = customAttributes->Get(mModule->mCompiler->mWarnAttributeTypeDef);
|
|
||||||
if ((customAttribute != NULL) && (!customAttribute->mCtorArgs.IsEmpty()))
|
|
||||||
{
|
|
||||||
String err = StrFormat("Method warning: '", mModule->MethodToString(methodInstance).c_str());
|
|
||||||
String* str = mModule->GetStringPoolString(customAttribute->mCtorArgs[0], constHolder);
|
|
||||||
if (str != NULL)
|
|
||||||
err += *str;
|
|
||||||
err += "'";
|
|
||||||
if (mModule->Warn(0, err, targetSrc) != NULL)
|
|
||||||
_AddMethodDeclarationMoreInfo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BfTypedValue BfExprEvaluator::CreateCall(BfMethodInstance* methodInstance, BfIRValue func, bool bypassVirtual, SizedArrayImpl<BfIRValue>& irArgs, BfTypedValue* sret, bool isTailCall)
|
BfTypedValue BfExprEvaluator::CreateCall(BfMethodInstance* methodInstance, BfIRValue func, bool bypassVirtual, SizedArrayImpl<BfIRValue>& irArgs, BfTypedValue* sret, bool isTailCall)
|
||||||
|
|
|
@ -2747,6 +2747,98 @@ BfError* BfModule::Warn(int warningNum, const StringImpl& warning, BfAstNode* re
|
||||||
return bfError;
|
return bfError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BfModule::CheckErrorAttributes(BfTypeInstance* typeInstance, BfMethodInstance* methodInstance, BfCustomAttributes* customAttributes, BfAstNode* targetSrc)
|
||||||
|
{
|
||||||
|
auto _AddDeclarationMoreInfo = [&]()
|
||||||
|
{
|
||||||
|
if (methodInstance != NULL)
|
||||||
|
{
|
||||||
|
if (methodInstance->mMethodDef->mMethodDeclaration != NULL)
|
||||||
|
mCompiler->mPassInstance->MoreInfo(
|
||||||
|
StrFormat("See method declaration '%s'", MethodToString(methodInstance).c_str()),
|
||||||
|
methodInstance->mMethodDef->GetRefNode());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mCompiler->mPassInstance->MoreInfo(
|
||||||
|
StrFormat("See type declaration '%s'", TypeToString(typeInstance, BfTypeNameFlag_UseUnspecializedGenericParamNames).c_str()),
|
||||||
|
typeInstance->mTypeDef->GetRefNode());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
BfIRConstHolder* constHolder = typeInstance->mConstHolder;
|
||||||
|
auto customAttribute = customAttributes->Get(mCompiler->mObsoleteAttributeTypeDef);
|
||||||
|
if ((customAttribute != NULL) && (!customAttribute->mCtorArgs.IsEmpty()))
|
||||||
|
{
|
||||||
|
String err;
|
||||||
|
if (methodInstance != NULL)
|
||||||
|
err = StrFormat("'%s' is obsolete", MethodToString(methodInstance).c_str());
|
||||||
|
else
|
||||||
|
err = StrFormat("'%s' is obsolete", TypeToString(typeInstance, BfTypeNameFlag_UseUnspecializedGenericParamNames).c_str());
|
||||||
|
|
||||||
|
bool isError = false;
|
||||||
|
|
||||||
|
auto constant = constHolder->GetConstant(customAttribute->mCtorArgs[0]);
|
||||||
|
if (constant->mTypeCode == BfTypeCode_Boolean)
|
||||||
|
{
|
||||||
|
isError = constant->mBool;
|
||||||
|
}
|
||||||
|
else if (customAttribute->mCtorArgs.size() >= 2)
|
||||||
|
{
|
||||||
|
String* str = GetStringPoolString(customAttribute->mCtorArgs[0], constHolder);
|
||||||
|
if (str != NULL)
|
||||||
|
{
|
||||||
|
err += ":\n '";
|
||||||
|
err += *str;
|
||||||
|
err += "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
constant = constHolder->GetConstant(customAttribute->mCtorArgs[1]);
|
||||||
|
isError = constant->mBool;
|
||||||
|
}
|
||||||
|
|
||||||
|
BfError* error = NULL;
|
||||||
|
if (isError)
|
||||||
|
error = Fail(err, targetSrc);
|
||||||
|
else
|
||||||
|
error = Warn(0, err, targetSrc);
|
||||||
|
if (error != NULL)
|
||||||
|
_AddDeclarationMoreInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
customAttribute = customAttributes->Get(mCompiler->mErrorAttributeTypeDef);
|
||||||
|
if ((customAttribute != NULL) && (!customAttribute->mCtorArgs.IsEmpty()))
|
||||||
|
{
|
||||||
|
String err;
|
||||||
|
if (methodInstance != NULL)
|
||||||
|
StrFormat("Method error: '", MethodToString(methodInstance).c_str());
|
||||||
|
else
|
||||||
|
StrFormat("Type error: '", TypeToString(typeInstance, BfTypeNameFlag_UseUnspecializedGenericParamNames).c_str());
|
||||||
|
String* str = GetStringPoolString(customAttribute->mCtorArgs[0], constHolder);
|
||||||
|
if (str != NULL)
|
||||||
|
err += *str;
|
||||||
|
err += "'";
|
||||||
|
if (Fail(err, targetSrc) != NULL)
|
||||||
|
_AddDeclarationMoreInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
customAttribute = customAttributes->Get(mCompiler->mWarnAttributeTypeDef);
|
||||||
|
if ((customAttribute != NULL) && (!customAttribute->mCtorArgs.IsEmpty()))
|
||||||
|
{
|
||||||
|
String err;
|
||||||
|
if (methodInstance != NULL)
|
||||||
|
StrFormat("Method warning: '", MethodToString(methodInstance).c_str());
|
||||||
|
else
|
||||||
|
StrFormat("Type warning: '", TypeToString(typeInstance, BfTypeNameFlag_UseUnspecializedGenericParamNames).c_str());
|
||||||
|
String* str = GetStringPoolString(customAttribute->mCtorArgs[0], constHolder);
|
||||||
|
if (str != NULL)
|
||||||
|
err += *str;
|
||||||
|
err += "'";
|
||||||
|
if (Warn(0, err, targetSrc) != NULL)
|
||||||
|
_AddDeclarationMoreInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BfModule::CheckRangeError(BfType* type, BfAstNode* refNode)
|
void BfModule::CheckRangeError(BfType* type, BfAstNode* refNode)
|
||||||
{
|
{
|
||||||
if (mBfIRBuilder->mOpFailed)
|
if (mBfIRBuilder->mOpFailed)
|
||||||
|
@ -9351,6 +9443,7 @@ static String GetAttributesTargetListString(BfAttributeTargets attrTarget)
|
||||||
AddAttributeTargetName(flagsLeft, BfAttributeTargets_Invocation, resultStr, "invocations");
|
AddAttributeTargetName(flagsLeft, BfAttributeTargets_Invocation, resultStr, "invocations");
|
||||||
AddAttributeTargetName(flagsLeft, BfAttributeTargets_MemberAccess, resultStr, "member access");
|
AddAttributeTargetName(flagsLeft, BfAttributeTargets_MemberAccess, resultStr, "member access");
|
||||||
AddAttributeTargetName(flagsLeft, BfAttributeTargets_Alloc, resultStr, "allocations");
|
AddAttributeTargetName(flagsLeft, BfAttributeTargets_Alloc, resultStr, "allocations");
|
||||||
|
AddAttributeTargetName(flagsLeft, BfAttributeTargets_Alias, resultStr, "aliases");
|
||||||
if (resultStr.IsEmpty())
|
if (resultStr.IsEmpty())
|
||||||
return "<nothing>";
|
return "<nothing>";
|
||||||
return resultStr;
|
return resultStr;
|
||||||
|
|
|
@ -1413,6 +1413,7 @@ public:
|
||||||
BfError* FailInternal(const StringImpl& error, BfAstNode* refNode = NULL);
|
BfError* FailInternal(const StringImpl& error, BfAstNode* refNode = NULL);
|
||||||
BfError* FailAfter(const StringImpl& error, BfAstNode* refNode);
|
BfError* FailAfter(const StringImpl& error, BfAstNode* refNode);
|
||||||
BfError* Warn(int warningNum, const StringImpl& warning, BfAstNode* refNode = NULL, bool isPersistent = false);
|
BfError* Warn(int warningNum, const StringImpl& warning, BfAstNode* refNode = NULL, bool isPersistent = false);
|
||||||
|
void CheckErrorAttributes(BfTypeInstance* typeInstance, BfMethodInstance* methodInstance, BfCustomAttributes* customAttributes, BfAstNode* targetSrc);
|
||||||
void CheckRangeError(BfType* type, BfAstNode* refNode);
|
void CheckRangeError(BfType* type, BfAstNode* refNode);
|
||||||
bool CheckCircularDataError();
|
bool CheckCircularDataError();
|
||||||
BfFileInstance* GetFileFromNode(BfAstNode* astNode);
|
BfFileInstance* GetFileFromNode(BfAstNode* astNode);
|
||||||
|
|
|
@ -949,6 +949,7 @@ bool BfModule::PopulateType(BfType* resolvedTypeRef, BfPopulateType populateType
|
||||||
}
|
}
|
||||||
resolvedTypeRef->mDefineState = BfTypeDefineState_DefinedAndMethodsSlotted;
|
resolvedTypeRef->mDefineState = BfTypeDefineState_DefinedAndMethodsSlotted;
|
||||||
resolvedTypeRef->mRebuildFlags = BfTypeRebuildFlag_None;
|
resolvedTypeRef->mRebuildFlags = BfTypeRebuildFlag_None;
|
||||||
|
typeAlias->mCustomAttributes = GetCustomAttributes(typeDef->mTypeDeclaration->mAttributes, BfAttributeTargets_Alias);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -6046,9 +6047,8 @@ BfType* BfModule::ResolveTypeResult(BfTypeReference* typeRef, BfType* resolvedTy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BfGenericTypeInstance* genericTypeInstance = NULL;
|
BfTypeInstance* typeInstance = resolvedTypeRef->ToTypeInstance();
|
||||||
if (resolvedTypeRef != NULL)
|
BfGenericTypeInstance* genericTypeInstance = resolvedTypeRef->ToGenericTypeInstance();
|
||||||
genericTypeInstance = resolvedTypeRef->ToGenericTypeInstance();
|
|
||||||
|
|
||||||
bool hadError = false;
|
bool hadError = false;
|
||||||
hadError = !PopulateType(resolvedTypeRef, populateType);
|
hadError = !PopulateType(resolvedTypeRef, populateType);
|
||||||
|
@ -6067,10 +6067,22 @@ BfType* BfModule::ResolveTypeResult(BfTypeReference* typeRef, BfType* resolvedTy
|
||||||
{
|
{
|
||||||
if (mCurTypeInstance != NULL)
|
if (mCurTypeInstance != NULL)
|
||||||
AddDependency(resolvedTypeRef, mCurTypeInstance, BfDependencyMap::DependencyFlag_NameReference);
|
AddDependency(resolvedTypeRef, mCurTypeInstance, BfDependencyMap::DependencyFlag_NameReference);
|
||||||
|
if ((typeInstance->mCustomAttributes != NULL) && (!typeRef->IsTemporary()))
|
||||||
|
CheckErrorAttributes(typeInstance, NULL, typeInstance->mCustomAttributes, typeRef);
|
||||||
resolvedTypeRef = resolvedTypeRef->GetUnderlyingType();
|
resolvedTypeRef = resolvedTypeRef->GetUnderlyingType();
|
||||||
|
if (resolvedTypeRef != NULL)
|
||||||
|
typeInstance = resolvedTypeRef->ToTypeInstance();
|
||||||
|
else
|
||||||
|
typeInstance = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeInstance != NULL)
|
||||||
|
{
|
||||||
|
if ((typeInstance->mCustomAttributes != NULL) && (!typeRef->IsTemporary()))
|
||||||
|
CheckErrorAttributes(typeInstance, NULL, typeInstance->mCustomAttributes, typeRef);
|
||||||
|
}
|
||||||
|
|
||||||
return resolvedTypeRef;
|
return resolvedTypeRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10416,6 +10428,12 @@ void BfModule::DoTypeToString(StringImpl& str, BfType* resolvedType, BfTypeNameF
|
||||||
// We don't want the param names, just the commas (this is an unspecialized type reference)
|
// We don't want the param names, just the commas (this is an unspecialized type reference)
|
||||||
if (i > prevGenericParamCount)
|
if (i > prevGenericParamCount)
|
||||||
str += ',';
|
str += ',';
|
||||||
|
|
||||||
|
if ((typeNameFlags & BfTypeNameFlag_UseUnspecializedGenericParamNames) != 0)
|
||||||
|
{
|
||||||
|
str += checkTypeDef->mGenericParamDefs[i]->mName;
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,14 +20,15 @@ enum BfTypeNameFlags : uint16
|
||||||
{
|
{
|
||||||
BfTypeNameFlags_None = 0,
|
BfTypeNameFlags_None = 0,
|
||||||
BfTypeNameFlag_ResolveGenericParamNames = 1,
|
BfTypeNameFlag_ResolveGenericParamNames = 1,
|
||||||
BfTypeNameFlag_OmitNamespace = 2,
|
BfTypeNameFlag_UseUnspecializedGenericParamNames = 2,
|
||||||
BfTypeNameFlag_OmitOuterType = 4,
|
BfTypeNameFlag_OmitNamespace = 4,
|
||||||
BfTypeNameFlag_ReduceName = 8,
|
BfTypeNameFlag_OmitOuterType = 8,
|
||||||
BfTypeNameFlag_UseArrayImplType = 0x10,
|
BfTypeNameFlag_ReduceName = 0x10,
|
||||||
BfTypeNameFlag_DisambiguateDups = 0x20, // Add a disambiguation if mDupDetectedRevision is set
|
BfTypeNameFlag_UseArrayImplType = 0x20,
|
||||||
BfTypeNameFlag_AddGlobalContainerName = 0x40,
|
BfTypeNameFlag_DisambiguateDups = 0x40, // Add a disambiguation if mDupDetectedRevision is set
|
||||||
BfTypeNameFlag_InternalName = 0x80, // Use special delimiters to remove ambiguities (ie: '+' for inner types)
|
BfTypeNameFlag_AddGlobalContainerName = 0x80,
|
||||||
BfTypeNameFlag_HideGlobalName = 0x100
|
BfTypeNameFlag_InternalName = 0x100, // Use special delimiters to remove ambiguities (ie: '+' for inner types)
|
||||||
|
BfTypeNameFlag_HideGlobalName = 0x200,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum BfMethodNameFlags : uint8
|
enum BfMethodNameFlags : uint8
|
||||||
|
@ -1401,28 +1402,29 @@ enum BfAttributeTargets : int32
|
||||||
{
|
{
|
||||||
BfAttributeTargets_SkipValidate = -1,
|
BfAttributeTargets_SkipValidate = -1,
|
||||||
|
|
||||||
BfAttributeTargets_None = 0,
|
BfAttributeTargets_None = 0,
|
||||||
BfAttributeTargets_Assembly = 0x0001,
|
BfAttributeTargets_Assembly = 0x0001,
|
||||||
BfAttributeTargets_Module = 0x0002,
|
BfAttributeTargets_Module = 0x0002,
|
||||||
BfAttributeTargets_Class = 0x0004,
|
BfAttributeTargets_Class = 0x0004,
|
||||||
BfAttributeTargets_Struct = 0x0008,
|
BfAttributeTargets_Struct = 0x0008,
|
||||||
BfAttributeTargets_Enum = 0x0010,
|
BfAttributeTargets_Enum = 0x0010,
|
||||||
BfAttributeTargets_Constructor = 0x0020,
|
BfAttributeTargets_Constructor = 0x0020,
|
||||||
BfAttributeTargets_Method = 0x0040,
|
BfAttributeTargets_Method = 0x0040,
|
||||||
BfAttributeTargets_Property = 0x0080,
|
BfAttributeTargets_Property = 0x0080,
|
||||||
BfAttributeTargets_Field = 0x0100,
|
BfAttributeTargets_Field = 0x0100,
|
||||||
BfAttributeTargets_StaticField = 0x0200,
|
BfAttributeTargets_StaticField = 0x0200,
|
||||||
BfAttributeTargets_Interface = 0x0400,
|
BfAttributeTargets_Interface = 0x0400,
|
||||||
BfAttributeTargets_Parameter = 0x0800,
|
BfAttributeTargets_Parameter = 0x0800,
|
||||||
BfAttributeTargets_Delegate = 0x1000,
|
BfAttributeTargets_Delegate = 0x1000,
|
||||||
BfAttributeTargets_Function = 0x2000,
|
BfAttributeTargets_Function = 0x2000,
|
||||||
BfAttributeTargets_ReturnValue = 0x4000,
|
BfAttributeTargets_ReturnValue = 0x4000,
|
||||||
BfAttributeTargets_GenericParameter = 0x8000,
|
BfAttributeTargets_GenericParameter = 0x8000,
|
||||||
BfAttributeTargets_Invocation = 0x10000,
|
BfAttributeTargets_Invocation = 0x10000,
|
||||||
BfAttributeTargets_MemberAccess = 0x20000,
|
BfAttributeTargets_MemberAccess = 0x20000,
|
||||||
BfAttributeTargets_Alloc = 0x40000,
|
BfAttributeTargets_Alloc = 0x40000,
|
||||||
BfAttributeTargets_Delete = 0x80000,
|
BfAttributeTargets_Delete = 0x80000,
|
||||||
BfAttributeTargets_All = 0xFFFFF
|
BfAttributeTargets_Alias = 0x100000,
|
||||||
|
BfAttributeTargets_All = 0x1FFFFF
|
||||||
};
|
};
|
||||||
|
|
||||||
class BfAttributeData
|
class BfAttributeData
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue