mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
AllowDuplicatesAttribute
This commit is contained in:
parent
2618b29daa
commit
8808da307f
13 changed files with 39 additions and 2 deletions
|
@ -49,6 +49,7 @@ namespace Beefy
|
||||||
ShowMaximized = 0x0400'0000,
|
ShowMaximized = 0x0400'0000,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[AllowDuplicates]
|
||||||
public enum HitTestResult
|
public enum HitTestResult
|
||||||
{
|
{
|
||||||
NotHandled = -3,
|
NotHandled = -3,
|
||||||
|
|
|
@ -18,14 +18,17 @@ namespace Beefy.widgets
|
||||||
Shift = 0x10,
|
Shift = 0x10,
|
||||||
Control = 0x11,
|
Control = 0x11,
|
||||||
Alt = 0x12,
|
Alt = 0x12,
|
||||||
|
#unwarn
|
||||||
Menu = 0x12,
|
Menu = 0x12,
|
||||||
Pause = 0x13,
|
Pause = 0x13,
|
||||||
Capital = 0x14,
|
Capital = 0x14,
|
||||||
Kana = 0x15,
|
Kana = 0x15,
|
||||||
|
#unwarn
|
||||||
Hangul = 0x15,
|
Hangul = 0x15,
|
||||||
Junja = 0x17,
|
Junja = 0x17,
|
||||||
Final = 0x18,
|
Final = 0x18,
|
||||||
Hanja = 0x19,
|
Hanja = 0x19,
|
||||||
|
#unwarn
|
||||||
Kanji = 0x19,
|
Kanji = 0x19,
|
||||||
Escape = 0x1B,
|
Escape = 0x1B,
|
||||||
Convert = 0x1C,
|
Convert = 0x1C,
|
||||||
|
|
|
@ -1521,6 +1521,7 @@ namespace SDL2
|
||||||
ArrayF32
|
ArrayF32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AllowDuplicates]
|
||||||
public enum SDL_PIXELORDER_ENUM : uint32
|
public enum SDL_PIXELORDER_ENUM : uint32
|
||||||
{
|
{
|
||||||
/* BITMAPORDER */
|
/* BITMAPORDER */
|
||||||
|
@ -2967,6 +2968,7 @@ namespace SDL2
|
||||||
void* userdata
|
void* userdata
|
||||||
);
|
);
|
||||||
|
|
||||||
|
[AllowDuplicates]
|
||||||
enum EventState : int32
|
enum EventState : int32
|
||||||
{
|
{
|
||||||
Query = -1,
|
Query = -1,
|
||||||
|
@ -3272,6 +3274,7 @@ namespace SDL2
|
||||||
* and all of the names are in an anonymous enum. Yeah...
|
* and all of the names are in an anonymous enum. Yeah...
|
||||||
* that's not going to cut it for C#. We'll just put them in an
|
* that's not going to cut it for C#. We'll just put them in an
|
||||||
* enum for now? */
|
* enum for now? */
|
||||||
|
[AllowDuplicates]
|
||||||
public enum Keycode : uint32
|
public enum Keycode : uint32
|
||||||
{
|
{
|
||||||
UNKNOWN = 0,
|
UNKNOWN = 0,
|
||||||
|
|
|
@ -237,6 +237,12 @@ namespace System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(.Enum)]
|
||||||
|
public struct AllowDuplicatesAttribute : Attribute
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[AttributeUsage(.Class | .Struct)]
|
[AttributeUsage(.Class | .Struct)]
|
||||||
public struct UnionAttribute : Attribute
|
public struct UnionAttribute : Attribute
|
||||||
{
|
{
|
||||||
|
|
|
@ -251,6 +251,12 @@ namespace System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(.Enum)]
|
||||||
|
public struct AllowDuplicatesAttribute : Attribute
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[AttributeUsage(.Class | .Struct)]
|
[AttributeUsage(.Class | .Struct)]
|
||||||
public struct UnionAttribute : Attribute
|
public struct UnionAttribute : Attribute
|
||||||
{
|
{
|
||||||
|
|
|
@ -848,6 +848,7 @@ namespace System.Reflection
|
||||||
EnumDiscriminator = 0x0200
|
EnumDiscriminator = 0x0200
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[AllowDuplicates]
|
||||||
public enum MethodFlags : int16
|
public enum MethodFlags : int16
|
||||||
{
|
{
|
||||||
MethodAccessMask = 0x0007,
|
MethodAccessMask = 0x0007,
|
||||||
|
@ -869,6 +870,7 @@ namespace System.Reflection
|
||||||
|
|
||||||
// vtable layout mask - Use this mask to retrieve vtable attributes.
|
// vtable layout mask - Use this mask to retrieve vtable attributes.
|
||||||
VtableLayoutMask = 0x0100,
|
VtableLayoutMask = 0x0100,
|
||||||
|
|
||||||
ReuseSlot = 0x0000, // The default.
|
ReuseSlot = 0x0000, // The default.
|
||||||
NewSlot = 0x0100, // Method always gets a new slot in the vtable.
|
NewSlot = 0x0100, // Method always gets a new slot in the vtable.
|
||||||
// end vtable layout mask
|
// end vtable layout mask
|
||||||
|
|
|
@ -8,11 +8,14 @@ using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
|
[AllowDuplicates]
|
||||||
enum EnumA
|
enum EnumA
|
||||||
{
|
{
|
||||||
Abo = 1,
|
Abo = 1,
|
||||||
Boop = _*2,
|
Boop = _*2,
|
||||||
Croop = _*2,
|
Croop = _*2,
|
||||||
|
|
||||||
|
Zoop = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Blurg
|
struct Blurg
|
||||||
|
|
|
@ -762,6 +762,15 @@ bool BfAstNode::IsExpression()
|
||||||
return IsA<BfExpression>();
|
return IsA<BfExpression>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BfAstNode::WantsWarning(int warningNumber)
|
||||||
|
{
|
||||||
|
auto parserData = GetParserData();
|
||||||
|
if (parserData == NULL)
|
||||||
|
return true;
|
||||||
|
int srcStart = GetSrcStart();
|
||||||
|
return (!parserData->IsUnwarnedAt(this)) && (parserData->IsWarningEnabledAtSrcIndex(warningNumber, GetSrcStart()));
|
||||||
|
}
|
||||||
|
|
||||||
bool BfAstNode::LocationEquals(BfAstNode* otherNode)
|
bool BfAstNode::LocationEquals(BfAstNode* otherNode)
|
||||||
{
|
{
|
||||||
return (GetSourceData() == otherNode->GetSourceData()) &&
|
return (GetSourceData() == otherNode->GetSourceData()) &&
|
||||||
|
|
|
@ -1040,6 +1040,7 @@ public:
|
||||||
void Add(BfAstNode* bfAstNode);
|
void Add(BfAstNode* bfAstNode);
|
||||||
bool IsMissingSemicolon();
|
bool IsMissingSemicolon();
|
||||||
bool IsExpression();
|
bool IsExpression();
|
||||||
|
bool WantsWarning(int warningNumber);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool IsA()
|
bool IsA()
|
||||||
|
|
|
@ -382,6 +382,7 @@ BfCompiler::BfCompiler(BfSystem* bfSystem, bool isResolveOnly)
|
||||||
mImportAttributeTypeDef = NULL;
|
mImportAttributeTypeDef = NULL;
|
||||||
mCReprAttributeTypeDef = NULL;
|
mCReprAttributeTypeDef = NULL;
|
||||||
mAlignAttributeTypeDef = NULL;
|
mAlignAttributeTypeDef = NULL;
|
||||||
|
mAllowDuplicatesAttributeTypeDef = NULL;
|
||||||
mNoDiscardAttributeTypeDef = NULL;
|
mNoDiscardAttributeTypeDef = NULL;
|
||||||
mDisableChecksAttributeTypeDef = NULL;
|
mDisableChecksAttributeTypeDef = NULL;
|
||||||
mDisableObjectAccessChecksAttributeTypeDef = NULL;
|
mDisableObjectAccessChecksAttributeTypeDef = NULL;
|
||||||
|
@ -5856,6 +5857,7 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
|
||||||
mImportAttributeTypeDef = _GetRequiredType("System.ImportAttribute");
|
mImportAttributeTypeDef = _GetRequiredType("System.ImportAttribute");
|
||||||
mCReprAttributeTypeDef = _GetRequiredType("System.CReprAttribute");
|
mCReprAttributeTypeDef = _GetRequiredType("System.CReprAttribute");
|
||||||
mAlignAttributeTypeDef = _GetRequiredType("System.AlignAttribute");
|
mAlignAttributeTypeDef = _GetRequiredType("System.AlignAttribute");
|
||||||
|
mAllowDuplicatesAttributeTypeDef = _GetRequiredType("System.AllowDuplicatesAttribute");
|
||||||
mNoDiscardAttributeTypeDef = _GetRequiredType("System.NoDiscardAttribute");
|
mNoDiscardAttributeTypeDef = _GetRequiredType("System.NoDiscardAttribute");
|
||||||
mDisableChecksAttributeTypeDef = _GetRequiredType("System.DisableChecksAttribute");
|
mDisableChecksAttributeTypeDef = _GetRequiredType("System.DisableChecksAttribute");
|
||||||
mDisableObjectAccessChecksAttributeTypeDef = _GetRequiredType("System.DisableObjectAccessChecksAttribute");
|
mDisableObjectAccessChecksAttributeTypeDef = _GetRequiredType("System.DisableObjectAccessChecksAttribute");
|
||||||
|
|
|
@ -380,6 +380,7 @@ public:
|
||||||
BfTypeDef* mImportAttributeTypeDef;
|
BfTypeDef* mImportAttributeTypeDef;
|
||||||
BfTypeDef* mCReprAttributeTypeDef;
|
BfTypeDef* mCReprAttributeTypeDef;
|
||||||
BfTypeDef* mAlignAttributeTypeDef;
|
BfTypeDef* mAlignAttributeTypeDef;
|
||||||
|
BfTypeDef* mAllowDuplicatesAttributeTypeDef;
|
||||||
BfTypeDef* mNoDiscardAttributeTypeDef;
|
BfTypeDef* mNoDiscardAttributeTypeDef;
|
||||||
BfTypeDef* mDisableChecksAttributeTypeDef;
|
BfTypeDef* mDisableChecksAttributeTypeDef;
|
||||||
BfTypeDef* mDisableObjectAccessChecksAttributeTypeDef;
|
BfTypeDef* mDisableObjectAccessChecksAttributeTypeDef;
|
||||||
|
|
|
@ -2940,7 +2940,7 @@ BfTypedValue BfExprEvaluator::LookupIdentifier(BfAstNode* refNode, const StringI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mModule->mCurMethodInstance == NULL) && (mModule->mCurTypeInstance->IsEnum()))
|
if ((mModule->mCurMethodInstance == NULL) && (mModule->mCurTypeInstance != NULL) && (mModule->mCurTypeInstance->IsEnum()))
|
||||||
{
|
{
|
||||||
if (findName == "_")
|
if (findName == "_")
|
||||||
{
|
{
|
||||||
|
|
|
@ -2990,7 +2990,7 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
{
|
{
|
||||||
*fieldDefPtr = fieldDef;
|
*fieldDefPtr = fieldDef;
|
||||||
}
|
}
|
||||||
else
|
else if ((typeInstance->mCustomAttributes == NULL) || (typeInstance->mCustomAttributes->Get(mCompiler->mAllowDuplicatesAttributeTypeDef) == NULL))
|
||||||
{
|
{
|
||||||
auto error = Warn(0, StrFormat("Enum value '%lld' for field '%s' is not unique", foreignConst->mInt64, fieldDef->mName.c_str()), fieldDef->GetRefNode(), true);
|
auto error = Warn(0, StrFormat("Enum value '%lld' for field '%s' is not unique", foreignConst->mInt64, fieldDef->mName.c_str()), fieldDef->GetRefNode(), true);
|
||||||
if (error != NULL)
|
if (error != NULL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue