Exemplo n.º 1
0
 public SymbolVisitorAdapter(YamlModelGenerator generator, SyntaxLanguage language, Compilation compilation, bool preserveRawInlineComments = false, string filterConfigFile = null, IReadOnlyDictionary <Compilation, IEnumerable <IMethodSymbol> > extensionMethods = null)
 {
     _generator                 = generator;
     Language                   = language;
     _currentCompilation        = compilation;
     _currentCompilationRef     = compilation.ToMetadataReference();
     _preserveRawInlineComments = preserveRawInlineComments;
     FilterVisitor              = string.IsNullOrEmpty(filterConfigFile) ? new DefaultFilterVisitor() : new DefaultFilterVisitor().WithConfig(filterConfigFile).WithCache();
     _extensionMethods          = extensionMethods != null?extensionMethods.ToDictionary(p => p.Key, p => p.Value.Where(e => FilterVisitor.CanVisitApi(e))) : new Dictionary <Compilation, IEnumerable <IMethodSymbol> >();
 }
Exemplo n.º 2
0
        public MetadataSymbolVisitor(Compilation compilation, ExtractMetadataOptions?options)
        {
            _currentCompilation    = compilation;
            _currentCompilationRef = compilation.ToMetadataReference();
            ApiFilter = new DefaultApiFilter();

            _extensionMethods = options?.RoslynExtensionMethods != null
                ? options.RoslynExtensionMethods.ToDictionary(
                p => p.Key,
                p => p.Value.Where(e => ApiFilter.CanVisitApi(e))
                )
                : new Dictionary <Compilation, IEnumerable <IMethodSymbol> >();

            _codeSourceBasePath = options?.CodeSourceBasePath;
        }
Exemplo n.º 3
0
        public SymbolVisitorAdapter(YamlModelGenerator generator, SyntaxLanguage language, Compilation compilation, ExtractMetadataOptions options)
        {
            _generator                 = generator;
            Language                   = language;
            _currentCompilation        = compilation;
            _currentCompilationRef     = compilation.ToMetadataReference();
            _preserveRawInlineComments = options.PreserveRawInlineComments;
            var configFilterRule = ConfigFilterRule.LoadWithDefaults(options.FilterConfigFile);
            var filterVisitor    = options.DisableDefaultFilter ? (IFilterVisitor) new AllMemberFilterVisitor() : new DefaultFilterVisitor();

            FilterVisitor     = filterVisitor.WithConfig(configFilterRule).WithCache();
            _extensionMethods = options.RoslynExtensionMethods != null?options.RoslynExtensionMethods.ToDictionary(p => p.Key, p => p.Value.Where(e => FilterVisitor.CanVisitApi(e))) : new Dictionary <Compilation, IEnumerable <IMethodSymbol> >();

            _codeSourceBasePath = options.CodeSourceBasePath;
        }
Exemplo n.º 4
0
 internal void AddAssemblyMetadata(Assembly assembly, CompilationReference compilationReference)
 {
     cachedAssemblyMetadata[assembly] = compilationReference;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Adds the assembly to the cache.
 /// </summary>
 internal void AddAssembly(Assembly assembly, CompilationReference compilationReference)
 {
     cachedAssemblyMetadata[assembly]    = compilationReference;
     cachedAssemblies[assembly.FullName] = assembly;
 }