mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-12 13:24:09 +02:00
More 'if (Compiler.IsComptime)' protections
This commit is contained in:
parent
49a22f1c87
commit
575e6b439c
1 changed files with 25 additions and 10 deletions
|
@ -35,16 +35,22 @@ namespace System
|
|||
public TypeDeclaration BaseType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Compiler.IsComptime)
|
||||
{
|
||||
int32 baseTypeId = Type.[Friend]Comptime_Type_GetBaseType((.)mTypeId);
|
||||
return Type.[Friend]Comptime_GetTypeDeclarationById(baseTypeId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public TypeDeclaration OuterType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Compiler.IsComptime)
|
||||
return Type.[Friend]Comptime_GetTypeDeclarationById((.)mOuterTypeId);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,20 +60,23 @@ namespace System
|
|||
public bool AlwaysVisible => mFlags.HasFlag(.AlwaysVisible);
|
||||
public bool SometimesVisible => mFlags.HasFlag(.SometimesVisible);
|
||||
|
||||
public Type ResolvedType => Type.[Friend]Comptime_GetTypeById((.)mTypeId);
|
||||
public Type ResolvedType => Compiler.IsComptime ? Type.[Friend]Comptime_GetTypeById((.)mTypeId) : null;
|
||||
|
||||
public void GetFullName(String strBuffer)
|
||||
{
|
||||
if (Compiler.IsComptime)
|
||||
strBuffer.Append(Type.[Friend]Comptime_Type_ToString((.)mTypeId));
|
||||
}
|
||||
|
||||
public void GetName(String strBuffer)
|
||||
{
|
||||
if (Compiler.IsComptime)
|
||||
strBuffer.Append(Type.[Friend]Comptime_TypeName_ToString((.)mTypeId));
|
||||
}
|
||||
|
||||
public void GetNamespace(String strBuffer)
|
||||
{
|
||||
if (Compiler.IsComptime)
|
||||
strBuffer.Append(Type.[Friend]Comptime_Namespace_ToString((.)mTypeId));
|
||||
}
|
||||
|
||||
|
@ -165,17 +174,23 @@ namespace System
|
|||
|
||||
public bool HasDeclaredField(StringView fieldName)
|
||||
{
|
||||
if (Compiler.IsComptime)
|
||||
return Type.[Friend]Comptime_Type_HasDeclaredMember((.)mTypeId, 0, fieldName);
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool HasDeclaredMethod(StringView fieldName)
|
||||
{
|
||||
if (Compiler.IsComptime)
|
||||
return Type.[Friend]Comptime_Type_HasDeclaredMember((.)mTypeId, 1, fieldName);
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool HasDeclaredProperty(StringView fieldName)
|
||||
{
|
||||
if (Compiler.IsComptime)
|
||||
return Type.[Friend]Comptime_Type_HasDeclaredMember((.)mTypeId, 2, fieldName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue