|
|
|
@ -25,87 +25,88 @@ namespace ICSharpCode.NRefactory.TypeSystem |
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Contains well-known type references.
|
|
|
|
/// Contains well-known type references.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static class KnownTypeReference |
|
|
|
[Serializable] |
|
|
|
|
|
|
|
public sealed class KnownTypeReference : ITypeReference |
|
|
|
{ |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a type reference pointing to the <c>void</c> type.
|
|
|
|
/// Gets a type reference pointing to the <c>void</c> type.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static readonly ITypeReference Void = new GetClassTypeReference("System", "Void", 0); |
|
|
|
public static readonly KnownTypeReference Void = new KnownTypeReference(TypeCode.Empty); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a type reference pointing to the <c>object</c> type.
|
|
|
|
/// Gets a type reference pointing to the <c>object</c> type.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static readonly ITypeReference Object = new GetClassTypeReference("System", "Object", 0); |
|
|
|
public static readonly KnownTypeReference Object = new KnownTypeReference(TypeCode.Object); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a type reference pointing to the <c>bool</c> type.
|
|
|
|
/// Gets a type reference pointing to the <c>bool</c> type.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static readonly ITypeReference Boolean = new GetClassTypeReference("System", "Boolean", 0); |
|
|
|
public static readonly KnownTypeReference Boolean = new KnownTypeReference(TypeCode.Boolean); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Gets a type reference pointing to the <c>char</c> type.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public static readonly KnownTypeReference Char = new KnownTypeReference(TypeCode.Char); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a type reference pointing to the <c>sbyte</c> type.
|
|
|
|
/// Gets a type reference pointing to the <c>sbyte</c> type.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static readonly ITypeReference SByte = new GetClassTypeReference("System", "SByte", 0); |
|
|
|
public static readonly KnownTypeReference SByte = new KnownTypeReference(TypeCode.SByte); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a type reference pointing to the <c>byte</c> type.
|
|
|
|
/// Gets a type reference pointing to the <c>byte</c> type.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static readonly ITypeReference Byte = new GetClassTypeReference("System", "Byte", 0); |
|
|
|
public static readonly KnownTypeReference Byte = new KnownTypeReference(TypeCode.Byte); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a type reference pointing to the <c>short</c> type.
|
|
|
|
/// Gets a type reference pointing to the <c>short</c> type.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static readonly ITypeReference Int16 = new GetClassTypeReference("System", "Int16", 0); |
|
|
|
public static readonly KnownTypeReference Int16 = new KnownTypeReference(TypeCode.Int16); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a type reference pointing to the <c>ushort</c> type.
|
|
|
|
/// Gets a type reference pointing to the <c>ushort</c> type.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static readonly ITypeReference UInt16 = new GetClassTypeReference("System", "UInt16", 0); |
|
|
|
public static readonly KnownTypeReference UInt16 = new KnownTypeReference(TypeCode.UInt16); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a type reference pointing to the <c>int</c> type.
|
|
|
|
/// Gets a type reference pointing to the <c>int</c> type.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static readonly ITypeReference Int32 = new GetClassTypeReference("System", "Int32", 0); |
|
|
|
public static readonly KnownTypeReference Int32 = new KnownTypeReference(TypeCode.Int32); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a type reference pointing to the <c>uint</c> type.
|
|
|
|
/// Gets a type reference pointing to the <c>uint</c> type.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static readonly ITypeReference UInt32 = new GetClassTypeReference("System", "UInt32", 0); |
|
|
|
public static readonly KnownTypeReference UInt32 = new KnownTypeReference(TypeCode.UInt32); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a type reference pointing to the <c>long</c> type.
|
|
|
|
/// Gets a type reference pointing to the <c>long</c> type.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static readonly ITypeReference Int64 = new GetClassTypeReference("System", "Int64", 0); |
|
|
|
public static readonly KnownTypeReference Int64 = new KnownTypeReference(TypeCode.Int64); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a type reference pointing to the <c>ulong</c> type.
|
|
|
|
/// Gets a type reference pointing to the <c>ulong</c> type.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static readonly ITypeReference UInt64 = new GetClassTypeReference("System", "UInt64", 0); |
|
|
|
public static readonly KnownTypeReference UInt64 = new KnownTypeReference(TypeCode.UInt64); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Gets a type reference pointing to the <c>string</c> type.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public static readonly ITypeReference String = new GetClassTypeReference("System", "String", 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Gets a type reference pointing to the <c>char</c> type.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public static readonly ITypeReference Char = new GetClassTypeReference("System", "Char", 0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a type reference pointing to the <c>float</c> type.
|
|
|
|
/// Gets a type reference pointing to the <c>float</c> type.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static readonly ITypeReference Single = new GetClassTypeReference("System", "Single", 0); |
|
|
|
public static readonly KnownTypeReference Single = new KnownTypeReference(TypeCode.Single); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a type reference pointing to the <c>double</c> type.
|
|
|
|
/// Gets a type reference pointing to the <c>double</c> type.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static readonly ITypeReference Double = new GetClassTypeReference("System", "Double", 0); |
|
|
|
public static readonly KnownTypeReference Double = new KnownTypeReference(TypeCode.Double); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a type reference pointing to the <c>decimal</c> type.
|
|
|
|
/// Gets a type reference pointing to the <c>decimal</c> type.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public static readonly ITypeReference Decimal = new GetClassTypeReference("System", "Decimal", 0); |
|
|
|
public static readonly KnownTypeReference Decimal = new KnownTypeReference(TypeCode.Decimal); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Gets a type reference pointing to the <c>string</c> type.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public static readonly KnownTypeReference String = new KnownTypeReference(TypeCode.String); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a type reference pointing to the <c>System.Type</c> type.
|
|
|
|
/// Gets a type reference pointing to the <c>System.Type</c> type.
|
|
|
|
@ -125,5 +126,25 @@ namespace ICSharpCode.NRefactory.TypeSystem |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readonly TypeCode typeCode; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public KnownTypeReference(TypeCode typeCode) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
this.typeCode = typeCode; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public IType Resolve(ITypeResolveContext context) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return context.GetKnownTypeDefinition(typeCode) ?? SharedTypes.UnknownType; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string Namespace { |
|
|
|
|
|
|
|
get { return "System"; } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string Name { |
|
|
|
|
|
|
|
get { return ReflectionHelper.GetShortNameByTypeCode(typeCode); } |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|