Esempio n. 1
0
        public CSharpAdapter(IAssemblyReferenceCollector referenceCollector)
        {
            var referencedAssemblies = referenceCollector.SlowGetAllReferencedAssembliesRecursive(
                // Essential
                NetFrameworkRuntime.AssemblyOfValueTask,
                NetFrameworkRuntime.AssemblyOfValueTuple,
                NetFrameworkRuntime.AssemblyOfSpan,
                typeof(Binder).Assembly,

                // Runtime
                typeof(JitGenericAttribute).Assembly,

                // Requested
                typeof(XDocument).Assembly,   // System.Xml.Linq
                typeof(IDataReader).Assembly, // System.Data
                typeof(HttpUtility).Assembly  // System.Web
                ).ToImmutableList();

            var referencedAssembliesTaskSource = new ReferencedAssembliesLoadTaskSource();

            referencedAssembliesTaskSource.Complete(referencedAssemblies);
            ReferencedAssembliesTask = referencedAssembliesTaskSource.Task;

            _references = referencedAssemblies
                          .Select(a => (MetadataReference)MetadataReference.CreateFromFile(a.Location))
                          .ToImmutableList();
        }
Esempio n. 2
0
        public void SlowSetup(MirrorSharpOptions options)
        {
            // ReSharper disable HeapView.ObjectAllocation.Evident
            // ReSharper disable HeapView.DelegateAllocation
            options.EnableVisualBasic(o => {
                // This setup will only run if the language is used, so branches
                // where no one ever used VB will be faster to open.
                var maxLanguageVersion = Enum.GetValues(typeof(LanguageVersion)).Cast <LanguageVersion>().Max();

                o.ParseOptions = new VisualBasicParseOptions(
                    maxLanguageVersion,
                    documentationMode: DocumentationMode.Diagnose
                    );
                var referencedAssemblies = _referenceCollector.SlowGetAllReferencedAssembliesRecursive(
                    // Essential
                    NetFrameworkRuntime.AssemblyOfValueTuple,
                    NetFrameworkRuntime.AssemblyOfValueTask,
                    NetFrameworkRuntime.AssemblyOfSpan,
                    typeof(StandardModuleAttribute).Assembly,

                    // Runtime
                    typeof(JitGenericAttribute).Assembly,

                    // Requested
                    typeof(XDocument).Assembly,  // System.Xml.Linq
                    typeof(HttpUtility).Assembly // System.Web
                    ).ToImmutableList();
                _referencedAssembliesTaskSource.Complete(referencedAssemblies);
                o.MetadataReferences = referencedAssemblies
                                       .Select(a => (MetadataReference)MetadataReference.CreateFromFile(a.Location))
                                       .ToImmutableList();
            });
            // ReSharper restore HeapView.DelegateAllocation
            // ReSharper restore HeapView.ObjectAllocation.Evident
        }
Esempio n. 3
0
        public void SlowSetup(MirrorSharpOptions options)
        {
            options.EnableFSharp(o => {
                var referencedAssemblies = ImmutableList.Create(
                    // Essential
                    typeof(object).Assembly,
                    NetFrameworkRuntime.AssemblyOfValueTask,
                    typeof(TaskExtensions).Assembly,
                    typeof(FSharpOption <>).Assembly,

                    // Runtime
                    typeof(JitGenericAttribute).Assembly,

                    // Requested
                    typeof(XDocument).Assembly,   // System.Xml.Linq
                    typeof(IDataReader).Assembly, // System.Data
                    typeof(HttpUtility).Assembly  // System.Web
                    );
                _referencedAssembliesTaskSource.Complete(referencedAssemblies);
                o.AssemblyReferencePaths = referencedAssemblies.Select(a => a.Location).ToImmutableArray();
            });
        }