mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-18 16:10:26 +02:00
Added '->' operator, static indexer fix, RefCounted<T>
This commit is contained in:
parent
dd7986aaa9
commit
abd511a93d
14 changed files with 302 additions and 20 deletions
|
@ -50,6 +50,9 @@ namespace System.Reflection
|
|||
public bool IsReadOnly => Compiler.IsComptime ?
|
||||
Type.[Friend]Comptime_Method_GetInfo(mData.mComptimeMethodInstance).mMethodFlags.HasFlag(.ReadOnly) :
|
||||
mData.mMethodData.[Friend]mFlags.HasFlag(.ReadOnly);
|
||||
public bool IsStatic => Compiler.IsComptime ?
|
||||
Type.[Friend]Comptime_Method_GetInfo(mData.mComptimeMethodInstance).mMethodFlags.HasFlag(.Static) :
|
||||
mData.mMethodData.[Friend]mFlags.HasFlag(.Static);
|
||||
|
||||
public StringView Name => Compiler.IsComptime ?
|
||||
Type.[Friend]Comptime_Method_GetName(mData.mComptimeMethodInstance) :
|
||||
|
@ -112,6 +115,19 @@ namespace System.Reflection
|
|||
}
|
||||
}
|
||||
|
||||
public TypeInstance.ParamFlags GetParamFlags(int paramIdx)
|
||||
{
|
||||
if (Compiler.IsComptime)
|
||||
{
|
||||
return Type.[Friend]Comptime_Method_GetParamInfo(mData.mComptimeMethodInstance, (.)paramIdx).mParamFlags;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Assert((uint)paramIdx < (uint)mData.mMethodData.mParamCount);
|
||||
return mData.mMethodData.mParamData[paramIdx].mParamFlags;
|
||||
}
|
||||
}
|
||||
|
||||
public Result<T> GetParamCustomAttribute<T>(int paramIdx) where T : Attribute
|
||||
{
|
||||
if (Compiler.IsComptime)
|
||||
|
@ -967,19 +983,60 @@ namespace System.Reflection
|
|||
strBuffer.Append(' ');
|
||||
strBuffer.Append(mData.mMethodData.mName);
|
||||
strBuffer.Append('(');
|
||||
|
||||
int useParamIdx = 0;
|
||||
for (int paramIdx < mData.mMethodData.mParamCount)
|
||||
{
|
||||
if (paramIdx > 0)
|
||||
strBuffer.Append(", ");
|
||||
let paramData = mData.mMethodData.mParamData[paramIdx];
|
||||
let paramType = Type.[Friend]GetType(paramData.mType);
|
||||
if (paramData.mParamFlags.HasFlag(.Implicit))
|
||||
continue;
|
||||
if (useParamIdx > 0)
|
||||
strBuffer.Append(", ");
|
||||
paramType.ToString(strBuffer);
|
||||
strBuffer.Append(' ');
|
||||
strBuffer.Append(paramData.mName);
|
||||
useParamIdx++;
|
||||
}
|
||||
strBuffer.Append(')');
|
||||
}
|
||||
|
||||
public void GetParamsDecl(String strBuffer)
|
||||
{
|
||||
int useParamIdx = 0;
|
||||
for (int paramIdx < ParamCount)
|
||||
{
|
||||
var flag = GetParamFlags(paramIdx);
|
||||
if (flag.HasFlag(.Implicit))
|
||||
continue;
|
||||
if (useParamIdx > 0)
|
||||
strBuffer.Append(", ");
|
||||
if (flag.HasFlag(.Params))
|
||||
strBuffer.Append("params ");
|
||||
strBuffer.Append(GetParamType(paramIdx));
|
||||
strBuffer.Append(" ");
|
||||
strBuffer.Append(GetParamName(paramIdx));
|
||||
useParamIdx++;
|
||||
}
|
||||
}
|
||||
|
||||
public void GetArgsList(String strBuffer)
|
||||
{
|
||||
int useParamIdx = 0;
|
||||
for (int paramIdx < ParamCount)
|
||||
{
|
||||
var flag = GetParamFlags(paramIdx);
|
||||
if (flag.HasFlag(.Implicit))
|
||||
continue;
|
||||
if (useParamIdx > 0)
|
||||
strBuffer.Append(", ");
|
||||
if (flag.HasFlag(.Params))
|
||||
strBuffer.Append("params ");
|
||||
strBuffer.Append(GetParamName(paramIdx));
|
||||
useParamIdx++;
|
||||
}
|
||||
}
|
||||
|
||||
public struct Enumerator : IEnumerator<MethodInfo>
|
||||
{
|
||||
BindingFlags mBindingFlags;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue