Add CecilProjectContent
This commit is contained in:
Родитель
18eda45b71
Коммит
0035f34051
|
@ -1,54 +1,56 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{63D3B27A-D966-4902-90B3-30290E1692F1}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>ICSharpCode.NRefactory.Tests</RootNamespace>
|
||||
<AssemblyName>ICSharpCode.NRefactory.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugType>Full</DebugType>
|
||||
<Optimize>False</Optimize>
|
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<DebugType>None</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MyClassTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
|
||||
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
|
||||
<Name>ICSharpCode.NRefactory</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{63D3B27A-D966-4902-90B3-30290E1692F1}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>ICSharpCode.NRefactory.Tests</RootNamespace>
|
||||
<AssemblyName>ICSharpCode.NRefactory.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<DebugType>Full</DebugType>
|
||||
<Optimize>False</Optimize>
|
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<DebugType>None</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\lib\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MyClassTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
|
||||
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
|
||||
<Name>ICSharpCode.NRefactory</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
</Project>
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ICSharpCode.NRefactory.Tests
|
||||
{
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Mono.Cecil">
|
||||
<HintPath>..\lib\Mono.Cecil.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
|
@ -40,7 +43,6 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Accessibility.cs" />
|
||||
<Compile Include="CSharp\Dom\AbstractNode.cs" />
|
||||
<Compile Include="CSharp\Dom\AbtractDomVisitor.cs" />
|
||||
<Compile Include="CSharp\Dom\CompilationUnit.cs" />
|
||||
|
@ -127,6 +129,8 @@
|
|||
<Compile Include="CSharp\Dom\TypeMembers\PropertyDeclaration.cs" />
|
||||
<Compile Include="CSharp\Dom\TypeMembers\VariableInitializer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TypeSystem\Accessibility.cs" />
|
||||
<Compile Include="TypeSystem\CecilProjectContent.cs" />
|
||||
<Compile Include="TypeSystem\ClassType.cs" />
|
||||
<Compile Include="TypeSystem\DomRegion.cs" />
|
||||
<Compile Include="TypeSystem\EntityType.cs" />
|
||||
|
@ -145,6 +149,7 @@
|
|||
<Compile Include="TypeSystem\Implementation\AbstractTypeReference.cs" />
|
||||
<Compile Include="TypeSystem\Implementation\DefaultExplicitInterfaceImplementation.cs" />
|
||||
<Compile Include="TypeSystem\Implementation\DefaultParameter.cs" />
|
||||
<Compile Include="TypeSystem\Implementation\ProxyTypeResolveContext.cs" />
|
||||
<Compile Include="TypeSystem\Implementation\DefaultTypeDefinition.cs" />
|
||||
<Compile Include="TypeSystem\Implementation\NullType.cs" />
|
||||
<Compile Include="TypeSystem\Implementation\UnknownType.cs" />
|
||||
|
@ -154,15 +159,14 @@
|
|||
<Compile Include="TypeSystem\IProjectContent.cs" />
|
||||
<Compile Include="TypeSystem\IProperty.cs" />
|
||||
<Compile Include="TypeSystem\ISupportsInterning.cs" />
|
||||
<Compile Include="TypeSystem\ISynchronizedTypeResolveContext.cs" />
|
||||
<Compile Include="TypeSystem\IType.cs" />
|
||||
<Compile Include="TypeSystem\ITypeDefinition.cs" />
|
||||
<Compile Include="TypeSystem\ITypeParameter.cs" />
|
||||
<Compile Include="TypeSystem\ITypeReference.cs" />
|
||||
<Compile Include="TypeSystem\ITypeResolveContext.cs" />
|
||||
<Compile Include="TypeSystem\IVariable.cs" />
|
||||
<Compile Include="TypeSystem\LanguageProperties.cs" />
|
||||
<Compile Include="TypeSystem\SharedTypes.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||
</Project>
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.NRefactory
|
||||
namespace ICSharpCode.NRefactory.TypeSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Enum that describes the accessibility of an entity.
|
|
@ -0,0 +1,183 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
using ICSharpCode.NRefactory.TypeSystem.Implementation;
|
||||
using Mono.Cecil;
|
||||
|
||||
namespace ICSharpCode.NRefactory.TypeSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Project content that represents an already compiled assembly.
|
||||
/// </summary>
|
||||
public class CecilProjectContent : IProjectContent
|
||||
{
|
||||
IList<IAttribute> assemblyAttributes;
|
||||
|
||||
#region Constructor
|
||||
public CecilProjectContent(AssemblyDefinition assemblyDefinition)
|
||||
{
|
||||
this.assemblyAttributes = ReadAttributes(assemblyDefinition, this);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region IProjectContent implementation
|
||||
public IList<IAttribute> AssemblyAttributes {
|
||||
get { return assemblyAttributes; }
|
||||
}
|
||||
|
||||
public ITypeDefinition GetClass(string fullTypeName, int typeParameterCount, StringComparer nameComparer)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public ISynchronizedTypeResolveContext Synchronize()
|
||||
{
|
||||
// CecilProjectContent is immutable, so we don't need to synchronize
|
||||
return new DummySynchronizedTypeResolveContext(this);
|
||||
}
|
||||
|
||||
sealed class DummySynchronizedTypeResolveContext : ProxyTypeResolveContext, ISynchronizedTypeResolveContext
|
||||
{
|
||||
public DummySynchronizedTypeResolveContext(ITypeResolveContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Load Assembly From Disk
|
||||
public static CecilProjectContent LoadAssembly(string fileName)
|
||||
{
|
||||
if (fileName == null)
|
||||
throw new ArgumentNullException("fileName");
|
||||
AssemblyDefinition asm = AssemblyDefinition.ReadAssembly(fileName, new ReaderParameters { AssemblyResolver = new DummyAssemblyResolver() });
|
||||
return new CecilProjectContent(asm);
|
||||
}
|
||||
|
||||
// used to prevent Cecil from loading referenced assemblies
|
||||
sealed class DummyAssemblyResolver : IAssemblyResolver
|
||||
{
|
||||
public AssemblyDefinition Resolve(AssemblyNameReference name)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public AssemblyDefinition Resolve(string fullName)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Read Type Reference
|
||||
public static ITypeReference ReadTypeReference(TypeReference attributeType, ITypeResolveContext earlyBindContext)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Read Attributes
|
||||
public static IList<IAttribute> ReadAttributes(ICustomAttributeProvider attributeProvider, ITypeResolveContext earlyBindContext)
|
||||
{
|
||||
Contract.Ensures(Contract.Result<IList<IAttribute>>() != null);
|
||||
if (attributeProvider == null || !attributeProvider.HasCustomAttributes)
|
||||
return EmptyList<IAttribute>.Instance;
|
||||
var cecilAttributes = attributeProvider.CustomAttributes;
|
||||
IAttribute[] attributes = new IAttribute[cecilAttributes.Count];
|
||||
for (int i = 0; i < attributes.Length; i++) {
|
||||
attributes[i] = new CecilAttribute(cecilAttributes[i], earlyBindContext);
|
||||
}
|
||||
return Array.AsReadOnly(attributes);
|
||||
}
|
||||
|
||||
sealed class CecilAttribute : Immutable, IAttribute
|
||||
{
|
||||
ITypeReference attributeType;
|
||||
volatile CustomAttribute ca;
|
||||
ITypeResolveContext earlyBindContext;
|
||||
IList<IConstantValue> positionalArguments;
|
||||
IList<KeyValuePair<string, IConstantValue>> namedArguments;
|
||||
|
||||
public CecilAttribute(CustomAttribute ca, ITypeResolveContext earlyBindContext)
|
||||
{
|
||||
this.attributeType = ReadTypeReference(ca.AttributeType, earlyBindContext);
|
||||
this.ca = ca;
|
||||
this.earlyBindContext = earlyBindContext;
|
||||
}
|
||||
|
||||
public DomRegion Region {
|
||||
get { return DomRegion.Empty; }
|
||||
}
|
||||
|
||||
public ITypeReference AttributeType {
|
||||
get { return attributeType; }
|
||||
}
|
||||
|
||||
public IList<IConstantValue> PositionalArguments {
|
||||
get {
|
||||
EnsureArguments();
|
||||
return positionalArguments;
|
||||
}
|
||||
}
|
||||
|
||||
public IList<KeyValuePair<string, IConstantValue>> NamedArguments {
|
||||
get {
|
||||
EnsureArguments();
|
||||
return namedArguments;
|
||||
}
|
||||
}
|
||||
|
||||
void EnsureArguments()
|
||||
{
|
||||
CustomAttribute ca = this.ca;
|
||||
if (ca != null) {
|
||||
try {
|
||||
if (ca.HasConstructorArguments) {
|
||||
var posArgs = new List<IConstantValue>();
|
||||
foreach (var arg in ca.ConstructorArguments) {
|
||||
posArgs.Add(ReadConstantValue(arg, earlyBindContext));
|
||||
}
|
||||
this.positionalArguments = posArgs.AsReadOnly();
|
||||
} else {
|
||||
this.positionalArguments = EmptyList<IConstantValue>.Instance;
|
||||
}
|
||||
} catch (InvalidOperationException) {
|
||||
this.positionalArguments = EmptyList<IConstantValue>.Instance;
|
||||
}
|
||||
try {
|
||||
if (ca.HasFields || ca.HasProperties) {
|
||||
var namedArgs = new List<KeyValuePair<string, IConstantValue>>();
|
||||
foreach (var arg in ca.Fields) {
|
||||
namedArgs.Add(new KeyValuePair<string, IConstantValue>(arg.Name, ReadConstantValue(arg.Argument, earlyBindContext)));
|
||||
}
|
||||
foreach (var arg in ca.Properties) {
|
||||
namedArgs.Add(new KeyValuePair<string, IConstantValue>(arg.Name, ReadConstantValue(arg.Argument, earlyBindContext)));
|
||||
}
|
||||
this.namedArguments = namedArgs.AsReadOnly();
|
||||
} else {
|
||||
this.namedArguments = EmptyList<KeyValuePair<string, IConstantValue>>.Instance;
|
||||
}
|
||||
} catch (InvalidOperationException) {
|
||||
this.namedArguments = EmptyList<KeyValuePair<string, IConstantValue>>.Instance;
|
||||
}
|
||||
this.ca = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Read Constant Value
|
||||
public static IConstantValue ReadConstantValue(CustomAttributeArgument arg, ITypeResolveContext earlyBindContext)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -55,7 +55,7 @@ namespace ICSharpCode.NRefactory.TypeSystem
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// The project content in which this entity is defined.
|
||||
/// The assembly in which this entity is defined.
|
||||
/// This property never returns null.
|
||||
/// </summary>
|
||||
IProjectContent ProjectContent {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace ICSharpCode.NRefactory.TypeSystem
|
||||
|
@ -12,15 +13,15 @@ namespace ICSharpCode.NRefactory.TypeSystem
|
|||
[ContractClass(typeof(IProjectContentContract))]
|
||||
public interface IProjectContent : ITypeResolveContext
|
||||
{
|
||||
LanguageProperties Language { get; }
|
||||
IList<IAttribute> AssemblyAttributes { get; }
|
||||
}
|
||||
|
||||
[ContractClassFor(typeof(IProjectContent))]
|
||||
abstract class IProjectContentContract : ITypeResolveContextContract, IProjectContent
|
||||
{
|
||||
LanguageProperties IProjectContent.Language {
|
||||
IList<IAttribute> IProjectContent.AssemblyAttributes {
|
||||
get {
|
||||
Contract.Ensures(Contract.Result<LanguageProperties>() != null);
|
||||
Contract.Ensures(Contract.Result<IList<IAttribute>>() != null);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
// 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;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace ICSharpCode.NRefactory.TypeSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Context representing the set of assemblies in which a type is being searched.
|
||||
/// Guarantees that the list of types available in the context is not changed until Dispose() is called.
|
||||
/// The Dispose() method must be called from the same thread that create the
|
||||
/// <c>ISynchronizedTypeResolveContext</c>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A simple implementation might enter a ReaderWriterLock when the synchronized context
|
||||
/// is created, and releases the lock when Dispose() is called.
|
||||
/// However, implementations based on immutable data structures are also possible.
|
||||
/// </remarks>
|
||||
public interface ISynchronizedTypeResolveContext : ITypeResolveContext, IDisposable
|
||||
{
|
||||
}
|
||||
}
|
|
@ -14,6 +14,15 @@ namespace ICSharpCode.NRefactory.TypeSystem
|
|||
public interface ITypeResolveContext
|
||||
{
|
||||
ITypeDefinition GetClass(string fullTypeName, int typeParameterCount, StringComparer nameComparer);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="ISynchronizedTypeResolveContext"/> that
|
||||
/// represents the same context as this instance, but cannot be modified
|
||||
/// by other threads.
|
||||
/// The ISynchronizedTypeResolveContext must be disposed from the same thread
|
||||
/// that called this method when it is no longer used.
|
||||
/// </summary>
|
||||
ISynchronizedTypeResolveContext Synchronize();
|
||||
}
|
||||
|
||||
[ContractClassFor(typeof(ITypeResolveContext))]
|
||||
|
@ -26,5 +35,11 @@ namespace ICSharpCode.NRefactory.TypeSystem
|
|||
Contract.Requires(nameComparer != null);
|
||||
return null;
|
||||
}
|
||||
|
||||
ISynchronizedTypeResolveContext ITypeResolveContext.Synchronize()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<ISynchronizedTypeResolveContext>() != null);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -321,13 +321,9 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public ITypeDefinition GetCompoundClass()
|
||||
public virtual ITypeDefinition GetCompoundClass()
|
||||
{
|
||||
if (declaringTypeDefinition != null) {
|
||||
return declaringTypeDefinition.GetCompoundClass().InnerClasses.FirstOrDefault(c => projectContent.Language.NameComparer.Equals(c.Name, this.Name)) ?? this;
|
||||
} else {
|
||||
return projectContent.GetClass(this.FullName, this.TypeParameterCount, projectContent.Language.NameComparer) ?? this;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public virtual IList<ITypeDefinition> GetParts()
|
||||
|
@ -349,12 +345,12 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
|
|||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public IList<IType> GetNestedTypes(ITypeResolveContext context)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
public IList<IMethod> GetMethods(ITypeResolveContext context)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
// <file>
|
||||
// <copyright see="prj:///doc/copyright.txt"/>
|
||||
// <license see="prj:///doc/license.txt"/>
|
||||
// <author name="Daniel Grunwald"/>
|
||||
// <version>$Revision$</version>
|
||||
// </file>
|
||||
using System;
|
||||
|
||||
namespace ICSharpCode.NRefactory.TypeSystem.Implementation
|
||||
{
|
||||
/// <summary>
|
||||
/// Proxy that forwards calls to another TypeResolveContext.
|
||||
/// Useful as base class for decorators.
|
||||
/// </summary>
|
||||
public class ProxyTypeResolveContext : ITypeResolveContext
|
||||
{
|
||||
ITypeResolveContext target;
|
||||
|
||||
public ProxyTypeResolveContext(ITypeResolveContext target)
|
||||
{
|
||||
if (target == null)
|
||||
throw new ArgumentNullException("target");
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public virtual ITypeDefinition GetClass(string fullTypeName, int typeParameterCount, StringComparer nameComparer)
|
||||
{
|
||||
return target.GetClass(fullTypeName, typeParameterCount, nameComparer);
|
||||
}
|
||||
|
||||
public virtual ISynchronizedTypeResolveContext Synchronize()
|
||||
{
|
||||
return target.Synchronize();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
// 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;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace ICSharpCode.NRefactory.TypeSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Describes the properties of a language.
|
||||
/// </summary>
|
||||
public class LanguageProperties
|
||||
{
|
||||
// TODO: is this class actually useful? consider removing it
|
||||
|
||||
public virtual StringComparer NameComparer {
|
||||
get {
|
||||
Contract.Ensures(Contract.Result<StringComparer>() != null);
|
||||
Contract.Assume(StringComparer.Ordinal != null);
|
||||
return StringComparer.Ordinal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ namespace ICSharpCode.NRefactory.TypeSystem
|
|||
public readonly static IType UnknownType = new UnknownType();
|
||||
|
||||
/// <summary>
|
||||
/// The null type is used as type of the null literal. It is a reference type without any members that is a subtype of all reference types.
|
||||
/// The null type is used as type of the null literal. It is a reference type without any members; and it is a subtype of all reference types.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Justification = "It's immutable")]
|
||||
public readonly static IType Null = new NullType();
|
||||
|
|
|
@ -1,24 +1,29 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
# SharpDevelop 4.0.0.6197
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.NRefactory", "ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj", "{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.NRefactory.Tests", "ICSharpCode.NRefactory.Tests\ICSharpCode.NRefactory.Tests.csproj", "{63D3B27A-D966-4902-90B3-30290E1692F1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{63D3B27A-D966-4902-90B3-30290E1692F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{63D3B27A-D966-4902-90B3-30290E1692F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{63D3B27A-D966-4902-90B3-30290E1692F1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{63D3B27A-D966-4902-90B3-30290E1692F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
# SharpDevelop 4.0.0.6362
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.NRefactory", "ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj", "{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.NRefactory.Tests", "ICSharpCode.NRefactory.Tests\ICSharpCode.NRefactory.Tests.csproj", "{63D3B27A-D966-4902-90B3-30290E1692F1}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DC98210E-1646-483B-819A-2BB8272461E4}"
|
||||
ProjectSection(SolutionItems) = postProject
|
||||
README = README
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{63D3B27A-D966-4902-90B3-30290E1692F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{63D3B27A-D966-4902-90B3-30290E1692F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{63D3B27A-D966-4902-90B3-30290E1692F1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{63D3B27A-D966-4902-90B3-30290E1692F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
Overview of the NRefactory library:
|
||||
|
||||
ICSharpCode.NRefactory.TypeSystem:
|
||||
Contains a language-independent representation of the .NET type system.
|
||||
|
||||
ICSharpCode.NRefactory.TypeSystem.Implementation:
|
||||
Contains base classes that help implementing the type system interfaces.
|
Загрузка…
Ссылка в новой задаче