예제 #1
0
        private void AddFileReference(Import node)
        {
            RemoveCurrentNode();

            //we may need to preserve this, since it may be used in several compiler cycles.
            //which will set them to different things
            CompilerErrorCollection     errors     = Errors;
            CompilerReferenceCollection references = Parameters.References;
            string url = GetFilePath(node);

            Assembly assembly;

            if (assemblyCache.TryGetValue(url, out assembly) == false)
            {
                assembly = CompileAssembly(node, url, errors);

                if (assembly == null)
                {
                    throw new CompilationErrorsException(errors);
                }

                assemblyCache.Add(url, assembly);
            }

            references.Add(assembly);
        }
예제 #2
0
        public CompilerParameters(IReflectionTypeSystemProvider reflectionProvider, bool loadDefaultReferences)
        {
            _libPaths = new List<string>();
            _systemDir = Permissions.WithDiscoveryPermission(() => GetSystemDir());
            if (_systemDir != null)
            {
                _libPaths.Add(_systemDir);
                _libPaths.Add(Directory.GetCurrentDirectory());
            }
            _input = new CompilerInputCollection();
            _resources = new CompilerResourceCollection();
            _compilerReferences = new CompilerReferenceCollection(reflectionProvider);

            MaxExpansionIterations = 12;
            _outputAssembly = String.Empty;
            OutputType = CompilerOutputType.Auto;
            _outputWriter = Console.Out;
            Debug = true;
            Checked = true;
            GenerateInMemory = true;
            StdLib = true;
            DelaySign = false;

            Strict = false;
            TraceLevel = DefaultTraceLevel();

            if (loadDefaultReferences)
                LoadDefaultReferences();
        }
예제 #3
0
        public CompilerParameters(IReflectionTypeSystemProvider reflectionProvider, bool loadDefaultReferences)
        {
            _libPaths = new List<string>();
            _systemDir = Permissions.WithDiscoveryPermission(() => GetSystemDir());
            if (_systemDir != null)
            {
                _libPaths.Add(_systemDir);
                _libPaths.Add(Directory.GetCurrentDirectory());
            }
            _pipeline = null;
            _input = new CompilerInputCollection();
            _resources = new CompilerResourceCollection();
            _compilerReferences = new CompilerReferenceCollection(reflectionProvider);

            _maxExpansionIterations = 12;
            _outputAssembly = String.Empty;
            _outputType = CompilerOutputType.Auto;
            _outputWriter = Console.Out;
            _debug = true;
            _checked = true;
            _generateInMemory = true;
            _stdLib = true;

            if (Permissions.WithEnvironmentPermission(() => System.Environment.GetEnvironmentVariable("TRACE") != null))
                EnableTraceSwitch();

            _delaySign = false;

            Strict = false;

            if (loadDefaultReferences)
                LoadDefaultReferences();
        }