/// <summary> /// Finds all references in the given file. /// </summary> /// <param name="searchScopes">The search scopes for which to look.</param> /// <param name="parsedFile">The type system representation of the file being searched.</param> /// <param name="compilationUnit">The compilation unit of the file being searched.</param> /// <param name="compilation">The compilation for the project that contains the file.</param> /// <param name="callback">Callback used to report the references that were found.</param> /// <param name="cancellationToken">CancellationToken that may be used to cancel the operation.</param> public void FindReferencesInFile(IList <IFindReferenceSearchScope> searchScopes, CppParsedFile parsedFile, CompilationUnit compilationUnit, ICompilation compilation, FoundReferenceCallback callback, CancellationToken cancellationToken) { if (searchScopes == null) { throw new ArgumentNullException("searchScopes"); } if (parsedFile == null) { throw new ArgumentNullException("parsedFile"); } if (compilationUnit == null) { throw new ArgumentNullException("compilationUnit"); } if (compilation == null) { throw new ArgumentNullException("compilation"); } if (callback == null) { throw new ArgumentNullException("callback"); } if (searchScopes.Count == 0) { return; } var navigators = new IResolveVisitorNavigator[searchScopes.Count]; for (int i = 0; i < navigators.Length; i++) { navigators[i] = searchScopes[i].GetNavigator(compilation, callback); } IResolveVisitorNavigator combinedNavigator; if (searchScopes.Count == 1) { combinedNavigator = navigators[0]; } else { combinedNavigator = new CompositeResolveVisitorNavigator(navigators); } cancellationToken.ThrowIfCancellationRequested(); combinedNavigator = new DetectSkippableNodesNavigator(combinedNavigator, compilationUnit); cancellationToken.ThrowIfCancellationRequested(); CppAstResolver resolver = new CppAstResolver(compilation, compilationUnit, parsedFile); resolver.ApplyNavigator(combinedNavigator, cancellationToken); foreach (var n in navigators) { var frn = n as FindReferenceNavigator; if (frn != null) { frn.NavigatorDone(resolver, cancellationToken); } } }
/// <summary> /// Finds all references in the given file. /// </summary> /// <param name="searchScopes">The search scopes for which to look.</param> /// <param name="parsedFile">The type system representation of the file being searched.</param> /// <param name="compilationUnit">The compilation unit of the file being searched.</param> /// <param name="compilation">The compilation for the project that contains the file.</param> /// <param name="callback">Callback used to report the references that were found.</param> /// <param name="cancellationToken">CancellationToken that may be used to cancel the operation.</param> public void FindReferencesInFile(IList<IFindReferenceSearchScope> searchScopes, CppParsedFile parsedFile, CompilationUnit compilationUnit, ICompilation compilation, FoundReferenceCallback callback, CancellationToken cancellationToken) { if (searchScopes == null) throw new ArgumentNullException("searchScopes"); if (parsedFile == null) throw new ArgumentNullException("parsedFile"); if (compilationUnit == null) throw new ArgumentNullException("compilationUnit"); if (compilation == null) throw new ArgumentNullException("compilation"); if (callback == null) throw new ArgumentNullException("callback"); if (searchScopes.Count == 0) return; var navigators = new IResolveVisitorNavigator[searchScopes.Count]; for (int i = 0; i < navigators.Length; i++) { navigators[i] = searchScopes[i].GetNavigator(compilation, callback); } IResolveVisitorNavigator combinedNavigator; if (searchScopes.Count == 1) { combinedNavigator = navigators[0]; } else { combinedNavigator = new CompositeResolveVisitorNavigator(navigators); } cancellationToken.ThrowIfCancellationRequested(); combinedNavigator = new DetectSkippableNodesNavigator(combinedNavigator, compilationUnit); cancellationToken.ThrowIfCancellationRequested(); CppAstResolver resolver = new CppAstResolver(compilation, compilationUnit, parsedFile); resolver.ApplyNavigator(combinedNavigator, cancellationToken); foreach (var n in navigators) { var frn = n as FindReferenceNavigator; if (frn != null) frn.NavigatorDone(resolver, cancellationToken); } }