本文整理汇总了C#中TypeSymbol.IsStructType方法的典型用法代码示例。如果您正苦于以下问题:C# TypeSymbol.IsStructType方法的具体用法?C# TypeSymbol.IsStructType怎么用?C# TypeSymbol.IsStructType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeSymbol
的用法示例。
在下文中一共展示了TypeSymbol.IsStructType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitStructAddr
/// <summary>
/// Copies a value type from the top of evaluation stack into a temporary variable and loads its address.
/// </summary>
private void EmitStructAddr(TypeSymbol t)
{
Debug.Assert(t.IsStructType());
var tmp = GetTemporaryLocal(t, true);
_il.EmitLocalStore(tmp);
_il.EmitLocalAddress(tmp);
}
示例2: AddTypesParticipatingInUserDefinedConversion
public static void AddTypesParticipatingInUserDefinedConversion(ArrayBuilder<NamedTypeSymbol> result, TypeSymbol type, bool includeBaseTypes, ref HashSet<DiagnosticInfo> useSiteDiagnostics)
{
if ((object)type == null)
{
return;
}
// CONSIDER: These sets are usually small; if they are large then this is an O(n^2)
// CONSIDER: algorithm. We could use a hash table instead to build up the set.
Debug.Assert(!type.IsTypeParameter());
// optimization:
bool excludeExisting = result.Count > 0;
// The decimal type does not contribute its user-defined conversions to the mix; though its
// conversions are actually implemented via user-defined operators, we logically treat it as
// though those conversions were built-in.
if (type.IsClassType() || type.IsStructType() && type.SpecialType != SpecialType.System_Decimal)
{
var namedType = (NamedTypeSymbol)type;
if (!excludeExisting || !HasIdentityConversionToAny(namedType, result))
{
result.Add(namedType);
}
}
if (!includeBaseTypes)
{
return;
}
NamedTypeSymbol t = type.BaseTypeWithDefinitionUseSiteDiagnostics(ref useSiteDiagnostics);
while ((object)t != null)
{
if (!excludeExisting || !HasIdentityConversionToAny(t, result))
{
result.Add(t);
}
t = t.BaseTypeWithDefinitionUseSiteDiagnostics(ref useSiteDiagnostics);
}
}
示例3: AddTypesParticipatingInUserDefinedConversion
public static void AddTypesParticipatingInUserDefinedConversion(ArrayBuilder<NamedTypeSymbol> result, TypeSymbol type, bool includeBaseTypes, ref HashSet<DiagnosticInfo> useSiteDiagnostics)
{
if ((object)type == null)
{
return;
}
// CONSIDER: These sets are usually small; if they are large then this is an O(n^2)
// CONSIDER: algorithm. We could use a hash table instead to build up the set.
Debug.Assert(!type.IsTypeParameter());
// optimization:
bool excludeExisting = result.Count > 0;
if (type.IsClassType() || type.IsStructType())
{
var namedType = (NamedTypeSymbol)type;
if (!excludeExisting || !HasIdentityConversionToAny(namedType, result))
{
result.Add(namedType);
}
}
if (!includeBaseTypes)
{
return;
}
NamedTypeSymbol t = type.BaseTypeWithDefinitionUseSiteDiagnostics(ref useSiteDiagnostics);
while ((object)t != null)
{
if (!excludeExisting || !HasIdentityConversionToAny(t, result))
{
result.Add(t);
}
t = t.BaseTypeWithDefinitionUseSiteDiagnostics(ref useSiteDiagnostics);
}
}