本文整理汇总了C#中ICSharpCode.NRefactory.CSharp.TypeSystem.CSharpTypeResolveContext类的典型用法代码示例。如果您正苦于以下问题:C# CSharpTypeResolveContext类的具体用法?C# CSharpTypeResolveContext怎么用?C# CSharpTypeResolveContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CSharpTypeResolveContext类属于ICSharpCode.NRefactory.CSharp.TypeSystem命名空间,在下文中一共展示了CSharpTypeResolveContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 };
}
开发者ID:CSRedRat,项目名称:Omnisharp,代码行数:26,代码来源:GotoImplementationHandler.cs
示例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.
}
开发者ID:riviti,项目名称:NRefactory,代码行数:28,代码来源:TypeOrNamespaceReference.cs
示例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);
}
开发者ID:holmak,项目名称:NRefactory,代码行数:8,代码来源:CSharpResolver.cs
示例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);
}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:8,代码来源:CSharpAttribute.cs
示例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);
}
开发者ID:sentientpc,项目名称:SharpSnippetCompiler-v5,代码行数:9,代码来源:CompletionData.cs
示例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;
}
开发者ID:Netring,项目名称:ILSpy,代码行数:9,代码来源:CSharpParameterCompletionEngine.cs
示例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());
}
开发者ID:jcd-as,项目名称:omnisharp-server,代码行数:9,代码来源:GetOverrideTargetsResponse.cs
示例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;
}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:11,代码来源:CSharpParameterCompletionEngine.cs
示例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;
}
开发者ID:nieve,项目名称:NRefactory,代码行数:11,代码来源:CSharpResolver.cs
示例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);
}
开发者ID:jcd-as,项目名称:omnisharp-server,代码行数:12,代码来源:GetOverrideTargetsResponse.cs
示例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);
}
开发者ID:dykim07,项目名称:vim-ide,代码行数:12,代码来源:GotoImplementationHandler.cs
示例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;
}
}
开发者ID:CSRedRat,项目名称:NRefactory,代码行数:13,代码来源:CSharpResolver.cs
示例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;
}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:13,代码来源:CSharpCompletionEngineBase.cs
示例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";
}
开发者ID:Netring,项目名称:ILSpy,代码行数:13,代码来源:CSharpCompletionEngine.cs
示例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";
}
开发者ID:FloodProject,项目名称:ICSharpCode.NRefactory,代码行数:15,代码来源:CSharpCompletionEngine.cs
示例16: ImportCompletionData
public ImportCompletionData(ITypeDefinition typeDef, CSharpTypeResolveContext contextAtCaret, bool useFullName)
: base(typeDef)
{
this.Description = "using " + typeDef.Namespace + ";";
if (useFullName)
{
var astBuilder = new TypeSystemAstBuilder(new CSharpResolver(contextAtCaret));
insertionText = astBuilder.ConvertType(typeDef).GetText();
}
else
{
insertionText = typeDef.Name;
insertUsing = typeDef.Namespace;
}
}
开发者ID:nguyenkien,项目名称:NRefactory-Completion-Sample,代码行数:15,代码来源:ImportCompletionData.cs
示例17: ResolvedUsingScope
public ResolvedUsingScope(CSharpTypeResolveContext context, UsingScope usingScope)
{
if (context == null)
throw new ArgumentNullException("context");
if (usingScope == null)
throw new ArgumentNullException("usingScope");
this.parentContext = context;
this.usingScope = usingScope;
if (usingScope.Parent != null) {
if (context.CurrentUsingScope == null)
throw new InvalidOperationException();
} else {
if (context.CurrentUsingScope != null)
throw new InvalidOperationException();
}
}
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:16,代码来源:ResolvedUsingScope.cs
示例18: CSharpCompletionEngineBase
protected CSharpCompletionEngineBase (IProjectContent content, CSharpTypeResolveContext ctx, CompilationUnit unit, CSharpParsedFile parsedFile)
{
if (content == null)
throw new ArgumentNullException ("content");
if (ctx == null)
throw new ArgumentNullException ("ctx");
if (unit == null)
throw new ArgumentNullException ("unit");
if (parsedFile == null)
throw new ArgumentNullException ("parsedFile");
this.ProjectContent = content;
this.ctx = ctx;
this.Unit = unit;
this.CSharpParsedFile = parsedFile;
}
开发者ID:KAW0,项目名称:Alter-Native,代码行数:16,代码来源:CSharpCompletionEngineBase.cs
示例19: GetAttributes
IList<IAttribute> GetAttributes(ref IList<IAttribute> field, bool assemblyAttributes)
{
IList<IAttribute> result = LazyInit.VolatileRead(ref field);
if (result != null) {
return result;
} else {
result = new List<IAttribute>();
foreach (var parsedFile in projectContent.Files.OfType<CSharpParsedFile>()) {
var attributes = assemblyAttributes ? parsedFile.AssemblyAttributes : parsedFile.ModuleAttributes;
var context = new CSharpTypeResolveContext(this, parsedFile.RootUsingScope.Resolve(compilation));
foreach (var unresolvedAttr in attributes) {
result.Add(unresolvedAttr.CreateResolvedAttribute(context));
}
}
return LazyInit.GetOrSet(ref field, result);
}
}
开发者ID:ariesguy22,项目名称:monodevelop,代码行数:17,代码来源:CSharpAssembly.cs
示例20: GetMemberResponse
private QuickFixResponse GetMemberResponse(CSharpTypeResolveContext rctx, MemberResolveResult resolveResult)
{
var quickFixes = new List<QuickFix>();
//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 quickFix = QuickFix.ForFirstLineInRegion
( member.MemberDefinition.Region
, _solution.GetFile(type.Region.FileName));
quickFixes.Add(quickFix);
}
}
}
return new QuickFixResponse(quickFixes);
}
开发者ID:dykim07,项目名称:vim-ide,代码行数:22,代码来源:GotoImplementationHandler.cs
注:本文中的ICSharpCode.NRefactory.CSharp.TypeSystem.CSharpTypeResolveContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论