19 changed files with 146 additions and 128 deletions
@ -0,0 +1,31 @@ |
|||||||
|
// Copyright (c) 2010 AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.NRefactory.TypeSystem.Implementation |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Type representing the C# 'dynamic' type.
|
||||||
|
/// </summary>
|
||||||
|
sealed class DynamicType : AbstractType |
||||||
|
{ |
||||||
|
public override string Name { |
||||||
|
get { return "dynamic"; } |
||||||
|
} |
||||||
|
|
||||||
|
public override bool? IsReferenceType { |
||||||
|
get { return true; } |
||||||
|
} |
||||||
|
|
||||||
|
public override bool Equals(IType other) |
||||||
|
{ |
||||||
|
return other is DynamicType; |
||||||
|
} |
||||||
|
|
||||||
|
public override int GetHashCode() |
||||||
|
{ |
||||||
|
return 31986112; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
// Copyright (c) 2010 AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.NRefactory.TypeSystem.Implementation |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// A simple constant value that is independent of the resolve context.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class SimpleConstantValue : Immutable, IConstantValue |
||||||
|
{ |
||||||
|
readonly ITypeReference type; |
||||||
|
readonly object value; |
||||||
|
|
||||||
|
public SimpleConstantValue(ITypeReference type, object value) |
||||||
|
{ |
||||||
|
if (type == null) |
||||||
|
throw new ArgumentNullException("type"); |
||||||
|
this.type = type; |
||||||
|
this.value = value; |
||||||
|
} |
||||||
|
|
||||||
|
public IType GetValueType(ITypeResolveContext context) |
||||||
|
{ |
||||||
|
return type.Resolve(context); |
||||||
|
} |
||||||
|
|
||||||
|
public object GetValue(ITypeResolveContext context) |
||||||
|
{ |
||||||
|
if (value is ITypeReference) |
||||||
|
return ((ITypeReference)value).Resolve(context); |
||||||
|
else |
||||||
|
return value; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue