// Token: 0x06000009 RID: 9 RVA: 0x0000226C File Offset: 0x0000046C internal string ResolveType(string identifier, Client.SourceLocation location) { string empty = string.Empty; if ((this.defaultResolver != null && this.defaultResolver.TryResolveType(identifier, location, out empty)) || this.fallbackResolver.TryResolveType(identifier, location, out empty)) { return(empty); } return(null); }
// Token: 0x06000007 RID: 7 RVA: 0x00002154 File Offset: 0x00000354 public bool TryResolveType(string identifier, Client.SourceLocation location, out string resolvedType) { resolvedType = null; Document document = this.workspace.CurrentSolution.Projects.SelectMany((Project p) => p.Documents).FirstOrDefault((Document d) => string.Equals(d.FilePath, location.FileName, StringComparison.InvariantCultureIgnoreCase)); if (document != null) { SemanticModel result = document.GetSemanticModelAsync().Result; if (result != null) { IEnumerable <ITypeSymbol> source = result.LookupSymbols(document.GetTextAsync().Result.Lines[location.Line - 1].Start + location.Column - 1, null, identifier, false).OfType <ITypeSymbol>(); if (source.Count <ITypeSymbol>() == 1) { resolvedType = source.First <ITypeSymbol>().ToDisplayString(null); return(true); } } } return(false); }
// Token: 0x06000011 RID: 17 RVA: 0x000023DC File Offset: 0x000005DC public bool TryResolveType(string identifier, Client.SourceLocation location, out string resolvedType) { resolvedType = null; ProjectDocument document = this.GetDocument(location.FileName); if (document != null) { ResolveResult languageItem = this.GetLanguageItem(document, identifier, location); NamespaceResolveResult namespaceResolveResult = languageItem as NamespaceResolveResult; if (namespaceResolveResult != null) { resolvedType = namespaceResolveResult.NamespaceName; return(true); } TypeResolveResult typeResolveResult = languageItem as TypeResolveResult; if (typeResolveResult != null && !typeResolveResult.IsError) { resolvedType = typeResolveResult.Type.FullName; return(true); } } return(false); }
// Token: 0x06000012 RID: 18 RVA: 0x0000243C File Offset: 0x0000063C private ResolveResult GetLanguageItem(ProjectDocument doc, string expression, Client.SourceLocation location) { ParsedDocument parsedDocument = doc.ParsedDocument; if (parsedDocument == null) { return(null); } SyntaxTree ast = parsedDocument.GetAst <SyntaxTree>(); CSharpUnresolvedFile csharpUnresolvedFile = parsedDocument.ParsedFile as CSharpUnresolvedFile; if (ast == null || csharpUnresolvedFile == null) { return(null); } AstNode nodeAt = ast.GetNodeAt(location.Line, location.Column, null); if (nodeAt == null) { return(null); } CSharpTypeResolveContext typeResolveContext = csharpUnresolvedFile.GetTypeResolveContext(doc.Compilation, new TextLocation(location.Line, location.Column)); CSharpResolver resolver = new CSharpResolver(typeResolveContext); CSharpAstResolver csharpAstResolver = new CSharpAstResolver(resolver, ast, csharpUnresolvedFile); csharpAstResolver.ApplyNavigator(new NodeListResolveVisitorNavigator(new AstNode[] { nodeAt }), CancellationToken.None); CSharpResolver resolverStateBefore = csharpAstResolver.GetResolverStateBefore(nodeAt, CancellationToken.None); return(resolverStateBefore.LookupSimpleNameOrTypeName(expression, new List <IType>(), NameLookupMode.Expression)); }
// Token: 0x0600000D RID: 13 RVA: 0x0000235C File Offset: 0x0000055C private string OnResolveType(string identifier, Client.SourceLocation location) { return(this.TypeResolver.ResolveType(identifier, location)); }