本文整理汇总了C#中ICSharpCode.NRefactory.CSharp.TypeSystem.CSharpTypeResolveContext类的典型用法代码示例。如果您正苦于以下问题:C# CSharpTypeResolveContext类的具体用法?C# CSharpTypeResolveContext怎么用?C# CSharpTypeResolveContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CSharpTypeResolveContext类属于ICSharpCode.NRefactory.CSharp.TypeSystem命名空间,在下文中一共展示了CSharpTypeResolveContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMemberResponse
private GotoImplementationResponse GetMemberResponse(CSharpTypeResolveContext rctx, MemberResolveResult resolveResult)
{
var locations = new List<Location>();
//TODO: we don't need to scan all types in all projects
foreach (IUnresolvedTypeDefinition type in GetAllTypes())
{
ITypeDefinition resolvedDef = type.Resolve(rctx).GetDefinition();
if (resolvedDef != null)
{
IMember member =
InheritanceHelper.GetDerivedMember(resolveResult.Member, resolvedDef);
if (member != null)
{
var region = member.MemberDefinition.Region;
var location = new Location
{
FileName = region.FileName,
Line = region.BeginLine,
Column = region.BeginColumn
};
locations.Add(location);
}
}
}
return new GotoImplementationResponse { Locations = locations };
}
示例2: CSharpTypeResolveContext
IType ITypeReference.Resolve(ITypeResolveContext context)
{
// Strictly speaking, we might have to resolve the type in a nested compilation, similar
// to what we're doing with ConstantExpression.
// However, in almost all cases this will work correctly - if the resulting type is only available in the
// nested compilation and not in this, we wouldn't be able to map it anyways.
var ctx = context as CSharpTypeResolveContext;
if (ctx == null) {
ctx = new CSharpTypeResolveContext(context.CurrentAssembly ?? context.Compilation.MainAssembly, null, context.CurrentTypeDefinition, context.CurrentMember);
}
return ResolveType(new CSharpResolver(ctx));
// A potential issue might be this scenario:
// Assembly 1:
// class A { public class Nested {} }
// Assembly 2: (references asm 1)
// class B : A {}
// Assembly 3: (references asm 1 and 2)
// class C { public B.Nested Field; }
// Assembly 4: (references asm 1 and 3, but not 2):
// uses C.Field;
// Here we would not be able to resolve 'B.Nested' in the compilation of assembly 4, as type B is missing there.
}
示例3: CSharpResolver
public CSharpResolver(ICompilation compilation)
{
if (compilation == null)
throw new ArgumentNullException("compilation");
this.compilation = compilation;
this.conversions = Conversions.Get(compilation);
this.context = new CSharpTypeResolveContext(compilation.MainAssembly);
}
示例4: CSharpResolvedAttribute
public CSharpResolvedAttribute(CSharpTypeResolveContext context, CSharpAttribute unresolved)
{
this.context = context;
this.unresolved = unresolved;
// Pretty much any access to the attribute checks the type first, so
// we don't need to use lazy-loading for that.
this.attributeType = unresolved.AttributeType.Resolve(context);
}
示例5: OverrideCompletionData
public OverrideCompletionData(int declarationBegin, IMember m, CSharpTypeResolveContext contextAtCaret)
: base(m)
{
this.declarationBegin = declarationBegin;
this.contextAtCaret = contextAtCaret;
var ambience = new CSharpAmbience();
ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList | ConversionFlags.ShowParameterList | ConversionFlags.ShowParameterNames;
this.CompletionText = ambience.ConvertEntity(m);
}
示例6: CSharpParameterCompletionEngine
public CSharpParameterCompletionEngine (IDocument document, IParameterCompletionDataFactory factory, IProjectContent content, CSharpTypeResolveContext ctx, CompilationUnit unit, CSharpParsedFile parsedFile) : base (content, ctx, unit, parsedFile)
{
if (document == null)
throw new ArgumentNullException ("document");
if (factory == null)
throw new ArgumentNullException ("factory");
this.document = document;
this.factory = factory;
}
示例7: CSharpResolver
public static string GetOverrideTargetName
(IMember m, CSharpTypeResolveContext resolveContext) {
var builder = new TypeSystemAstBuilder
(new CSharpResolver(resolveContext));
return builder.ConvertEntity(m).ToString()
// Builder automatically adds a trailing newline
.TrimEnd(Environment.NewLine.ToCharArray());
}
示例8: CSharpParameterCompletionEngine
public CSharpParameterCompletionEngine(IDocument document, ICompletionContextProvider completionContextProvider, IParameterCompletionDataFactory factory, IProjectContent content, CSharpTypeResolveContext ctx) : base (content, completionContextProvider, ctx)
{
if (document == null) {
throw new ArgumentNullException("document");
}
if (factory == null) {
throw new ArgumentNullException("factory");
}
this.document = document;
this.factory = factory;
}
示例9: CSharpResolver
private CSharpResolver(ICompilation compilation, CSharpConversions conversions, CSharpTypeResolveContext context, bool checkForOverflow, bool isWithinLambdaExpression, TypeDefinitionCache currentTypeDefinitionCache, ImmutableStack<IVariable> localVariableStack, ObjectInitializerContext objectInitializerStack)
{
this.compilation = compilation;
this.conversions = conversions;
this.context = context;
this.checkForOverflow = checkForOverflow;
this.isWithinLambdaExpression = isWithinLambdaExpression;
this.currentTypeDefinitionCache = currentTypeDefinitionCache;
this.localVariableStack = localVariableStack;
this.objectInitializerStack = objectInitializerStack;
}
示例10: ArgumentNullException
public GetOverrideTargetsResponse
( IMember m
, CSharpTypeResolveContext resolveContext) {
if (resolveContext == null)
throw new ArgumentNullException("resolveContext");
if (m == null)
throw new ArgumentNullException("m");
this.OverrideTargetName =
GetOverrideTargetName(m, resolveContext);
}
示例11: GetTypeResponse
private QuickFixResponse GetTypeResponse(CSharpTypeResolveContext rctx, ITypeDefinition typeDefinition)
{
var types = GetAllTypes().Select(t => t.Resolve(rctx).GetDefinition());
var quickFixes = from type in types where type != null
&& type != typeDefinition
&& type.IsDerivedFrom(typeDefinition)
select QuickFix.ForFirstLineInRegion
( type.Region
, _solution.GetFile(type.Region.FileName));
return new QuickFixResponse(quickFixes);
}
示例12: CSharpResolver
public CSharpResolver(ICompilation compilation)
{
if (compilation == null)
throw new ArgumentNullException("compilation");
this.compilation = compilation;
this.conversions = CSharpConversions.Get(compilation);
this.context = new CSharpTypeResolveContext(compilation.MainAssembly);
var pc = compilation.MainAssembly.UnresolvedAssembly as CSharpProjectContent;
if (pc != null) {
this.checkForOverflow = pc.CompilerSettings.CheckForOverflow;
}
}
示例13: CSharpCompletionEngineBase
protected CSharpCompletionEngineBase(IProjectContent content, ICompletionContextProvider completionContextProvider, CSharpTypeResolveContext ctx)
{
if (content == null)
throw new ArgumentNullException("content");
if (ctx == null)
throw new ArgumentNullException("ctx");
if (completionContextProvider == null)
throw new ArgumentNullException("completionContextProvider");
this.ProjectContent = content;
this.CompletionContextProvider = completionContextProvider;
this.ctx = ctx;
}
示例14: CSharpCompletionEngine
public CSharpCompletionEngine (IDocument document, ICompletionDataFactory factory, IProjectContent content, CSharpTypeResolveContext ctx, CompilationUnit unit, CSharpParsedFile parsedFile) : base (content, ctx, unit, parsedFile)
{
if (document == null)
throw new ArgumentNullException ("document");
if (factory == null)
throw new ArgumentNullException ("factory");
this.document = document;
this.factory = factory;
// Set defaults for additional input properties
this.FormattingPolicy = new CSharpFormattingOptions();
this.EolMarker = Environment.NewLine;
this.IndentString = "\t";
}
示例15: CSharpCompletionEngine
public CSharpCompletionEngine(IDocument document, ICompletionContextProvider completionContextProvider, ICompletionDataFactory factory, IProjectContent content, CSharpTypeResolveContext ctx) : base (content, completionContextProvider, ctx)
{
if (document == null) {
throw new ArgumentNullException("document");
}
if (factory == null) {
throw new ArgumentNullException("factory");
}
this.document = document;
this.factory = factory;
// Set defaults for additional input properties
this.FormattingPolicy = FormattingOptionsFactory.CreateMono();
this.EolMarker = Environment.NewLine;
this.IndentString = "\t";
}