示例#1
0
 // Defaults correspond to the compiler's defaults or indicate that the user did not specify when that is significant.
 // That's significant when one option depends on another's setting. SubsystemVersion depends on Platform and Target.
 public CSharpCompilationOptions(
     OutputKind outputKind,
     string moduleName                   = null,
     string mainTypeName                 = null,
     string scriptClassName              = null,
     IEnumerable <string> usings         = null,
     OptimizationLevel optimizationLevel = OptimizationLevel.Debug,
     bool checkOverflow                  = false,
     bool allowUnsafe                      = false,
     string cryptoKeyContainer             = null,
     string cryptoKeyFile                  = null,
     ImmutableArray <byte> cryptoPublicKey = default(ImmutableArray <byte>),
     bool?delaySign    = null,
     Platform platform = Platform.AnyCpu,
     ReportDiagnostic generalDiagnosticOption = ReportDiagnostic.Default,
     int warningLevel = 4,
     IEnumerable <KeyValuePair <string, ReportDiagnostic> > specificDiagnosticOptions = null,
     bool concurrentBuild = true,
     XmlReferenceResolver xmlReferenceResolver           = null,
     SourceReferenceResolver sourceReferenceResolver     = null,
     MetadataReferenceResolver metadataReferenceResolver = null,
     AssemblyIdentityComparer assemblyIdentityComparer   = null,
     StrongNameProvider strongNameProvider = null)
     : this(outputKind, moduleName, mainTypeName, scriptClassName, usings, optimizationLevel, checkOverflow, allowUnsafe,
            cryptoKeyContainer, cryptoKeyFile, cryptoPublicKey, delaySign, platform, generalDiagnosticOption, warningLevel,
            specificDiagnosticOptions, concurrentBuild,
            extendedCustomDebugInformation : true,
            xmlReferenceResolver : xmlReferenceResolver,
            sourceReferenceResolver : sourceReferenceResolver,
            metadataReferenceResolver : metadataReferenceResolver,
            assemblyIdentityComparer : assemblyIdentityComparer,
            strongNameProvider : strongNameProvider,
            metadataImportOptions : MetadataImportOptions.Public)
 {
 }
示例#2
0
 // Expects correct arguments.
 internal CSharpCompilationOptions(
     OutputKind outputKind,
     string moduleName,
     string mainTypeName,
     string scriptClassName,
     IEnumerable <string> usings,
     OptimizationLevel optimizationLevel,
     bool checkOverflow,
     bool allowUnsafe,
     string cryptoKeyContainer,
     string cryptoKeyFile,
     ImmutableArray <byte> cryptoPublicKey,
     bool?delaySign,
     Platform platform,
     ReportDiagnostic generalDiagnosticOption,
     int warningLevel,
     IEnumerable <KeyValuePair <string, ReportDiagnostic> > specificDiagnosticOptions,
     bool concurrentBuild,
     bool extendedCustomDebugInformation,
     XmlReferenceResolver xmlReferenceResolver,
     SourceReferenceResolver sourceReferenceResolver,
     MetadataReferenceResolver metadataReferenceResolver,
     AssemblyIdentityComparer assemblyIdentityComparer,
     StrongNameProvider strongNameProvider,
     MetadataImportOptions metadataImportOptions)
     : base(outputKind, moduleName, mainTypeName, scriptClassName, cryptoKeyContainer, cryptoKeyFile, cryptoPublicKey, delaySign, optimizationLevel, checkOverflow,
            platform, generalDiagnosticOption, warningLevel, specificDiagnosticOptions.ToImmutableDictionaryOrEmpty(),
            concurrentBuild, extendedCustomDebugInformation, xmlReferenceResolver, sourceReferenceResolver, metadataReferenceResolver, assemblyIdentityComparer,
            strongNameProvider, metadataImportOptions)
 {
     this.Usings      = usings.AsImmutableOrEmpty();
     this.AllowUnsafe = allowUnsafe;
 }
 // Defaults correspond to the compiler's defaults or indicate that the user did not specify when that is significant.
 // That's significant when one option depends on another's setting. SubsystemVersion depends on Platform and Target.
 public CSharpCompilationOptions(
     OutputKind outputKind,
     string moduleName           = null,
     string mainTypeName         = null,
     string scriptClassName      = WellKnownMemberNames.DefaultScriptClassName,
     IEnumerable <string> usings = null,
     bool optimize             = false,
     bool checkOverflow        = false,
     bool allowUnsafe          = false,
     string cryptoKeyContainer = null,
     string cryptoKeyFile      = null,
     bool?delaySign            = null,
     int fileAlignment         = 0,
     ulong baseAddress         = 0,
     Platform platform         = Platform.AnyCpu,
     ReportDiagnostic generalDiagnosticOption = ReportDiagnostic.Default,
     int warningLevel = 4,
     IEnumerable <KeyValuePair <string, ReportDiagnostic> > specificDiagnosticOptions = null,
     bool highEntropyVirtualAddressSpace       = false,
     DebugInformationKind debugInformationKind = DebugInformationKind.None,
     SubsystemVersion subsystemVersion         = default(SubsystemVersion),
     string runtimeMetadataVersion             = null,
     bool concurrentBuild = true,
     XmlReferenceResolver xmlReferenceResolver           = null,
     SourceReferenceResolver sourceReferenceResolver     = null,
     MetadataReferenceResolver metadataReferenceResolver = null,
     MetadataReferenceProvider metadataReferenceProvider = null,
     AssemblyIdentityComparer assemblyIdentityComparer   = null,
     StrongNameProvider strongNameProvider = null)
     : this(outputKind, moduleName, mainTypeName, scriptClassName, usings, optimize, checkOverflow, allowUnsafe,
            cryptoKeyContainer, cryptoKeyFile, delaySign, fileAlignment, baseAddress, platform, generalDiagnosticOption, warningLevel,
            specificDiagnosticOptions, highEntropyVirtualAddressSpace, debugInformationKind, subsystemVersion, runtimeMetadataVersion, concurrentBuild,
            xmlReferenceResolver, sourceReferenceResolver, metadataReferenceResolver, metadataReferenceProvider, assemblyIdentityComparer, strongNameProvider, MetadataImportOptions.Public, features : null)
 {
 }
示例#4
0
        ///// <summary>
        ///// Flags applied to the top-level binder created for each syntax tree in the compilation
        ///// as well as for the binder of global imports.
        ///// </summary>
        //internal BinderFlags TopLevelBinderFlags { get; private set; }

        // Defaults correspond to the compiler's defaults or indicate that the user did not specify when that is significant.
        // That's significant when one option depends on another's setting. SubsystemVersion depends on Platform and Target.
        public PhpCompilationOptions(
            OutputKind outputKind,
            string baseDirectory,
            string sdkDirectory,
            string subDirectory = null,
            bool reportSuppressedDiagnostics = false,
            string moduleName      = null,
            string mainTypeName    = null,
            string scriptClassName = null,
            string versionString   = null,
            PhpOptimizationLevel optimizationLevel = PhpOptimizationLevel.Debug,
            bool checkOverflow                    = false,
            string cryptoKeyContainer             = null,
            string cryptoKeyFile                  = null,
            ImmutableArray <byte> cryptoPublicKey = default,
            bool?delaySign    = null,
            Platform platform = Platform.AnyCpu,
            ReportDiagnostic generalDiagnosticOption = ReportDiagnostic.Default,
            int warningLevel = 4,
            IEnumerable <KeyValuePair <string, ReportDiagnostic> > specificDiagnosticOptions = null,
            bool concurrentBuild      = true,
            bool deterministic        = false,
            DateTime currentLocalTime = default(DateTime),
            XmlReferenceResolver xmlReferenceResolver           = null,
            SourceReferenceResolver sourceReferenceResolver     = null,
            MetadataReferenceResolver metadataReferenceResolver = null,
            AssemblyIdentityComparer assemblyIdentityComparer   = null,
            StrongNameProvider strongNameProvider = null,
            bool publicSign          = false,
            PhpDocTypes phpdocTypes  = PhpDocTypes.None,
            bool embedSourceMetadata = true,
            ImmutableArray <Diagnostic> diagnostics      = default,
            PhpParseOptions parseOptions                 = null,
            ImmutableDictionary <string, string> defines = default,
            bool referencesSupersedeLowerVersions        = false)
            : this(outputKind, baseDirectory, sdkDirectory, subDirectory,
                   reportSuppressedDiagnostics, moduleName, mainTypeName, scriptClassName,
                   versionString,
                   optimizationLevel, checkOverflow,
                   cryptoKeyContainer, cryptoKeyFile, cryptoPublicKey, delaySign, platform,
                   generalDiagnosticOption, warningLevel,
                   specificDiagnosticOptions, concurrentBuild, deterministic,
                   debugPlusMode : false,
                   currentLocalTime : currentLocalTime,
                   xmlReferenceResolver : xmlReferenceResolver,
                   sourceReferenceResolver : sourceReferenceResolver,
                   metadataReferenceResolver : metadataReferenceResolver,
                   assemblyIdentityComparer : assemblyIdentityComparer,
                   strongNameProvider : strongNameProvider,
                   metadataImportOptions : MetadataImportOptions.Public,
                   publicSign : publicSign,
                   phpdocTypes : phpdocTypes,
                   embedSourceMetadata : embedSourceMetadata,
                   diagnostics : diagnostics,
                   defines : defines,
                   parseOptions : parseOptions,
                   referencesSupersedeLowerVersions : referencesSupersedeLowerVersions)
        {
        }
示例#5
0
        public new PhpCompilationOptions WithXmlReferenceResolver(XmlReferenceResolver resolver)
        {
            if (ReferenceEquals(resolver, this.XmlReferenceResolver))
            {
                return this;
            }

            return new PhpCompilationOptions(this) { XmlReferenceResolver = resolver };
        }
示例#6
0
 // Expects correct arguments.
 internal PhpCompilationOptions(
     OutputKind outputKind,
     string baseDirectory,
     string sdkDirectory,
     string subDirectory,
     bool reportSuppressedDiagnostics,
     string moduleName,
     string mainTypeName,
     string scriptClassName,
     string versionString,
     PhpOptimizationLevel optimizationLevel,
     bool checkOverflow,
     string cryptoKeyContainer,
     string cryptoKeyFile,
     ImmutableArray <byte> cryptoPublicKey,
     bool?delaySign,
     Platform platform,
     ReportDiagnostic generalDiagnosticOption,
     int warningLevel,
     IEnumerable <KeyValuePair <string, ReportDiagnostic> > specificDiagnosticOptions,
     bool concurrentBuild,
     bool deterministic,
     DateTime currentLocalTime,
     bool debugPlusMode,
     XmlReferenceResolver xmlReferenceResolver,
     SourceReferenceResolver sourceReferenceResolver,
     MetadataReferenceResolver metadataReferenceResolver,
     AssemblyIdentityComparer assemblyIdentityComparer,
     StrongNameProvider strongNameProvider,
     MetadataImportOptions metadataImportOptions,
     bool publicSign,
     PhpDocTypes phpdocTypes,
     bool embedSourceMetadata,
     ImmutableArray <Diagnostic> diagnostics,
     PhpParseOptions parseOptions,
     ImmutableDictionary <string, string> defines,
     bool referencesSupersedeLowerVersions)
     : base(outputKind, reportSuppressedDiagnostics, moduleName, mainTypeName, scriptClassName,
            cryptoKeyContainer, cryptoKeyFile, cryptoPublicKey, delaySign, publicSign, optimizationLevel.AsOptimizationLevel(), checkOverflow,
            platform, generalDiagnosticOption, warningLevel, specificDiagnosticOptions.ToImmutableDictionaryOrEmpty(),
            concurrentBuild, deterministic, currentLocalTime, debugPlusMode, xmlReferenceResolver,
            sourceReferenceResolver, metadataReferenceResolver, assemblyIdentityComparer,
            strongNameProvider, metadataImportOptions, referencesSupersedeLowerVersions)
 {
     this.BaseDirectory       = baseDirectory;
     this.SdkDirectory        = sdkDirectory;
     this.SubDirectory        = subDirectory;
     this.PhpDocTypes         = phpdocTypes;
     this.EmbedSourceMetadata = embedSourceMetadata;
     this.ParseOptions        = parseOptions;
     this.Diagnostics         = diagnostics;
     this.VersionString       = versionString;
     this.OptimizationLevel   = optimizationLevel;
     this.Defines             = defines;
 }
        public new LanguageCompilationOptions WithXmlReferenceResolver(XmlReferenceResolver resolver)
        {
            if (ReferenceEquals(resolver, this.XmlReferenceResolver))
            {
                return(this);
            }
            var clone = this.Clone();

            clone.XmlReferenceResolver = resolver;
            return(clone);
        }
示例#8
0
        public new CSharpCompilationOptions WithXmlReferenceResolver(XmlReferenceResolver resolver)
        {
            if (ReferenceEquals(resolver, this.XmlReferenceResolver))
            {
                return(this);
            }

            return(new CSharpCompilationOptions(this)
            {
                XmlReferenceResolver = resolver
            });
        }
        /// <summary>
        /// Zero or more named arguments that specify values for fields and properties of the attribute.
        /// </summary>
        public ImmutableArray <Cci.IMetadataNamedArgument> GetNamedArguments(EmitContext context)
        {
            // Perform fixup
            Cci.ITypeReference stringType = context.Module.GetPlatformType(Cci.PlatformType.SystemString, context);

#if DEBUG
            // Must have exactly 1 named argument.
            ImmutableArray <Cci.IMetadataNamedArgument> namedArgs = _sourceAttribute.GetNamedArguments(context);
            Debug.Assert(namedArgs.Length == 1);

            // Named argument must be 'File' property of string type
            Cci.IMetadataNamedArgument fileArg = namedArgs.First();
            Debug.Assert(fileArg.ArgumentName == FilePropertyName);
            Debug.Assert(context.Module.IsPlatformType(fileArg.Type, Cci.PlatformType.SystemString));

            // Named argument value must be a non-empty string
            Debug.Assert(fileArg.ArgumentValue is MetadataConstant);
            string fileName = (string)((MetadataConstant)fileArg.ArgumentValue).Value;
            Debug.Assert(!String.IsNullOrEmpty(fileName));

            // PermissionSetAttribute type must have a writable public string type property member 'Hex'
            Debug.Assert(((INamedTypeSymbol)_sourceAttribute.GetType(context)).GetMembers(HexPropertyName).Any(
                             member => member.Kind == SymbolKind.Property && ((IPropertySymbol)member).Type.SpecialType == SpecialType.System_String));
#endif

            string hexFileContent;

            // Read the file contents at the resolved file path into a byte array.
            // May throw PermissionSetFileReadException, which is handled in Compilation.Emit.
            XmlReferenceResolver resolver = context.Module.CommonCompilation.Options.XmlReferenceResolver;

            // If the resolver isn't available we won't get here since we had to use it to resolve the path.
            Debug.Assert(resolver != null);

            try
            {
                using (Stream stream = resolver.OpenReadChecked(_resolvedPermissionSetFilePath))
                {
                    // Convert the byte array contents into a string in hexadecimal format.
                    hexFileContent = ConvertToHex(stream);
                }
            }
            catch (IOException e)
            {
                throw new PermissionSetFileReadException(e.Message, _resolvedPermissionSetFilePath);
            }

            // Synthesize a named attribute argument "Hex = hexFileContent".
            return(ImmutableArray.Create <Cci.IMetadataNamedArgument>(new HexPropertyMetadataNamedArgument(stringType, new MetadataConstant(stringType, hexFileContent))));
        }
示例#10
0
 // Defaults correspond to the compiler's defaults or indicate that the user did not specify when that is significant.
 // That's significant when one option depends on another's setting. SubsystemVersion depends on Platform and Target.
 public CSharpCompilationOptions(
     OutputKind outputKind,
     bool reportSuppressedDiagnostics = false,
     string moduleName                   = null,
     string mainTypeName                 = null,
     string scriptClassName              = null,
     IEnumerable <string> usings         = null,
     OptimizationLevel optimizationLevel = OptimizationLevel.Debug,
     bool checkOverflow                  = false,
     bool allowUnsafe                      = false,
     string cryptoKeyContainer             = null,
     string cryptoKeyFile                  = null,
     ImmutableArray <byte> cryptoPublicKey = default(ImmutableArray <byte>),
     bool?delaySign    = null,
     Platform platform = Platform.AnyCpu,
     ReportDiagnostic generalDiagnosticOption = ReportDiagnostic.Default,
     int warningLevel = 4,
     IEnumerable <KeyValuePair <string, ReportDiagnostic> > specificDiagnosticOptions = null,
     bool concurrentBuild = true,
     bool deterministic   = false,
     XmlReferenceResolver xmlReferenceResolver           = null,
     SourceReferenceResolver sourceReferenceResolver     = null,
     MetadataReferenceResolver metadataReferenceResolver = null,
     AssemblyIdentityComparer assemblyIdentityComparer   = null,
     StrongNameProvider strongNameProvider = null,
     bool publicSign = false,
     MetadataImportOptions metadataImportOptions   = MetadataImportOptions.Public,
     NullableContextOptions nullableContextOptions = NullableContextOptions.Disable)
     : this(outputKind, reportSuppressedDiagnostics, moduleName, mainTypeName, scriptClassName,
            usings, optimizationLevel, checkOverflow, allowUnsafe,
            cryptoKeyContainer, cryptoKeyFile, cryptoPublicKey, delaySign, platform,
            generalDiagnosticOption, warningLevel,
            specificDiagnosticOptions, concurrentBuild, deterministic,
            currentLocalTime : default(DateTime),
            debugPlusMode : false,
            xmlReferenceResolver : xmlReferenceResolver,
            sourceReferenceResolver : sourceReferenceResolver,
            metadataReferenceResolver : metadataReferenceResolver,
            assemblyIdentityComparer : assemblyIdentityComparer,
            strongNameProvider : strongNameProvider,
            metadataImportOptions : metadataImportOptions,
            referencesSupersedeLowerVersions : false,
            publicSign : publicSign,
            topLevelBinderFlags : BinderFlags.None,
            nullableContextOptions : nullableContextOptions)
 {
 }
示例#11
0
        ///// <summary>
        ///// Flags applied to the top-level binder created for each syntax tree in the compilation
        ///// as well as for the binder of global imports.
        ///// </summary>
        //internal BinderFlags TopLevelBinderFlags { get; private set; }

        // Defaults correspond to the compiler's defaults or indicate that the user did not specify when that is significant.
        // That's significant when one option depends on another's setting. SubsystemVersion depends on Platform and Target.
        public PhpCompilationOptions(
            OutputKind outputKind,
            string baseDirectory,
            string sdkDirectory,
            bool reportSuppressedDiagnostics = false,
            string moduleName      = null,
            string mainTypeName    = null,
            string scriptClassName = null,
            OptimizationLevel optimizationLevel = OptimizationLevel.Debug,
            bool checkOverflow                    = false,
            string cryptoKeyContainer             = null,
            string cryptoKeyFile                  = null,
            ImmutableArray <byte> cryptoPublicKey = default(ImmutableArray <byte>),
            bool?delaySign    = null,
            Platform platform = Platform.AnyCpu,
            ReportDiagnostic generalDiagnosticOption = ReportDiagnostic.Default,
            int warningLevel = 4,
            IEnumerable <KeyValuePair <string, ReportDiagnostic> > specificDiagnosticOptions = null,
            bool concurrentBuild = true,
            bool deterministic   = false,
            XmlReferenceResolver xmlReferenceResolver           = null,
            SourceReferenceResolver sourceReferenceResolver     = null,
            MetadataReferenceResolver metadataReferenceResolver = null,
            AssemblyIdentityComparer assemblyIdentityComparer   = null,
            StrongNameProvider strongNameProvider = null,
            bool publicSign              = false,
            PhpDocTypes phpdocTypes      = PhpDocTypes.None,
            PhpParseOptions parseOptions = null)
            : this(outputKind, baseDirectory, sdkDirectory,
                   reportSuppressedDiagnostics, moduleName, mainTypeName, scriptClassName,
                   optimizationLevel, checkOverflow,
                   cryptoKeyContainer, cryptoKeyFile, cryptoPublicKey, delaySign, platform,
                   generalDiagnosticOption, warningLevel,
                   specificDiagnosticOptions, concurrentBuild, deterministic,
                   extendedCustomDebugInformation : true,
                   debugPlusMode : false,
                   xmlReferenceResolver : xmlReferenceResolver,
                   sourceReferenceResolver : sourceReferenceResolver,
                   metadataReferenceResolver : metadataReferenceResolver,
                   assemblyIdentityComparer : assemblyIdentityComparer,
                   strongNameProvider : strongNameProvider,
                   metadataImportOptions : MetadataImportOptions.Public,
                   publicSign : publicSign,
                   phpdocTypes : phpdocTypes,
                   parseOptions : parseOptions)
        {
        }
示例#12
0
        // Expects correct arguments.
        internal CSharpCompilationOptions(
            OutputKind outputKind,
            bool reportSuppressedDiagnostics,
            string moduleName,
            string mainTypeName,
            string scriptClassName,
            IEnumerable <string> usings,
            OptimizationLevel optimizationLevel,
            bool checkOverflow,
            bool allowUnsafe,
            string cryptoKeyContainer,
            string cryptoKeyFile,
            ImmutableArray <byte> cryptoPublicKey,
            bool?delaySign,
            Platform platform,
            ReportDiagnostic generalDiagnosticOption,
            int warningLevel,
            IEnumerable <KeyValuePair <string, ReportDiagnostic> > specificDiagnosticOptions,
            bool concurrentBuild,
            bool deterministic,
            DateTime currentLocalTime,
            bool debugPlusMode,
            XmlReferenceResolver xmlReferenceResolver,
            SourceReferenceResolver sourceReferenceResolver,
            MetadataReferenceResolver metadataReferenceResolver,
            AssemblyIdentityComparer assemblyIdentityComparer,
            StrongNameProvider strongNameProvider,
            MetadataImportOptions metadataImportOptions,
            bool referencesSupersedeLowerVersions,
            bool publicSign,
            BinderFlags topLevelBinderFlags)
            : base(outputKind, reportSuppressedDiagnostics, moduleName, mainTypeName, scriptClassName,
                   cryptoKeyContainer, cryptoKeyFile, cryptoPublicKey, delaySign, publicSign, optimizationLevel, checkOverflow,
                   platform, generalDiagnosticOption, warningLevel, specificDiagnosticOptions.ToImmutableDictionaryOrEmpty(),
                   concurrentBuild, deterministic, currentLocalTime, debugPlusMode, xmlReferenceResolver,
                   sourceReferenceResolver, metadataReferenceResolver, assemblyIdentityComparer,
                   strongNameProvider, metadataImportOptions, referencesSupersedeLowerVersions)
        {
            this.Usings              = usings.AsImmutableOrEmpty();
            this.AllowUnsafe         = allowUnsafe;
            this.TopLevelBinderFlags = topLevelBinderFlags;
#if XSHARP
            this.SetXSharpSpecificOptions(XSharpSpecificCompilationOptions.Default);
#endif
        }
示例#13
0
 public CSharpCompilationOptions(
     OutputKind outputKind,
     bool reportSuppressedDiagnostics,
     string moduleName,
     string mainTypeName,
     string scriptClassName,
     IEnumerable <string> usings,
     OptimizationLevel optimizationLevel,
     bool checkOverflow,
     bool allowUnsafe,
     string cryptoKeyContainer,
     string cryptoKeyFile,
     ImmutableArray <byte> cryptoPublicKey,
     bool?delaySign,
     Platform platform,
     ReportDiagnostic generalDiagnosticOption,
     int warningLevel,
     IEnumerable <KeyValuePair <string, ReportDiagnostic> > specificDiagnosticOptions,
     bool concurrentBuild,
     bool deterministic,
     XmlReferenceResolver xmlReferenceResolver,
     SourceReferenceResolver sourceReferenceResolver,
     MetadataReferenceResolver metadataReferenceResolver,
     AssemblyIdentityComparer assemblyIdentityComparer,
     StrongNameProvider strongNameProvider)
     : this(outputKind, false, moduleName, mainTypeName, scriptClassName, usings, optimizationLevel,
            checkOverflow, allowUnsafe, cryptoKeyContainer, cryptoKeyFile, cryptoPublicKey,
            delaySign, platform, generalDiagnosticOption, warningLevel,
            specificDiagnosticOptions, concurrentBuild,
            deterministic : deterministic,
            currentLocalTime : default(DateTime),
            extendedCustomDebugInformation : true,
            debugPlusMode : false,
            xmlReferenceResolver : xmlReferenceResolver,
            sourceReferenceResolver : sourceReferenceResolver,
            metadataReferenceResolver : metadataReferenceResolver,
            assemblyIdentityComparer : assemblyIdentityComparer,
            strongNameProvider : strongNameProvider,
            metadataImportOptions : MetadataImportOptions.Public,
            referencesSupersedeLowerVersions : false,
            publicSign : false,
            topLevelBinderFlags : BinderFlags.None)
 {
 }
 // Defaults correspond to the compiler's defaults or indicate that the user did not specify when that is significant.
 // That's significant when one option depends on another's setting. SubsystemVersion depends on Platform and Target.
 public LanguageCompilationOptions(
     Language language,
     OutputKind outputKind,
     bool reportSuppressedDiagnostics = false,
     string moduleName                   = null,
     string mainTypeName                 = null,
     string scriptClassName              = null,
     IEnumerable <string> usings         = null,
     OptimizationLevel optimizationLevel = OptimizationLevel.Debug,
     bool checkOverflow                  = false,
     bool allowUnsafe                      = false,
     string cryptoKeyContainer             = null,
     string cryptoKeyFile                  = null,
     ImmutableArray <byte> cryptoPublicKey = default(ImmutableArray <byte>),
     bool?delaySign    = null,
     Platform platform = Platform.AnyCpu,
     ReportDiagnostic generalDiagnosticOption = ReportDiagnostic.Default,
     int warningLevel = 4,
     IEnumerable <KeyValuePair <string, ReportDiagnostic> > specificDiagnosticOptions = null,
     bool concurrentBuild      = true,
     bool deterministic        = false,
     DateTime currentLocalTime = default(DateTime),
     bool debugPlusMode        = false,
     XmlReferenceResolver xmlReferenceResolver           = null,
     SourceReferenceResolver sourceReferenceResolver     = null,
     MetadataReferenceResolver metadataReferenceResolver = null,
     AssemblyIdentityComparer assemblyIdentityComparer   = null,
     StrongNameProvider strongNameProvider = null,
     bool publicSign = false,
     MetadataImportOptions metadataImportOptions = MetadataImportOptions.Public,
     bool referencesSupersedeLowerVersions       = false,
     BinderFlags topLevelBinderFlags             = null)
     : base(outputKind, reportSuppressedDiagnostics, moduleName, mainTypeName, scriptClassName,
            cryptoKeyContainer, cryptoKeyFile, cryptoPublicKey, delaySign, publicSign, optimizationLevel, checkOverflow,
            platform, generalDiagnosticOption, warningLevel, specificDiagnosticOptions.ToImmutableDictionaryOrEmpty(),
            concurrentBuild, deterministic, currentLocalTime, debugPlusMode, xmlReferenceResolver,
            sourceReferenceResolver, metadataReferenceResolver, assemblyIdentityComparer,
            strongNameProvider, metadataImportOptions, referencesSupersedeLowerVersions)
 {
     _language                = language;
     this.Usings              = usings.AsImmutableOrEmpty();
     this.AllowUnsafe         = allowUnsafe;
     this.TopLevelBinderFlags = topLevelBinderFlags ?? BinderFlags.None;
 }
示例#15
0
 // Expects correct arguments.
 internal PhpCompilationOptions(
     OutputKind outputKind,
     string baseDirectory,
     string sdkDirectory,
     bool reportSuppressedDiagnostics,
     string moduleName,
     string mainTypeName,
     string scriptClassName,
     OptimizationLevel optimizationLevel,
     bool checkOverflow,
     string cryptoKeyContainer,
     string cryptoKeyFile,
     ImmutableArray <byte> cryptoPublicKey,
     bool?delaySign,
     Platform platform,
     ReportDiagnostic generalDiagnosticOption,
     int warningLevel,
     IEnumerable <KeyValuePair <string, ReportDiagnostic> > specificDiagnosticOptions,
     bool concurrentBuild,
     bool deterministic,
     bool extendedCustomDebugInformation,
     bool debugPlusMode,
     XmlReferenceResolver xmlReferenceResolver,
     SourceReferenceResolver sourceReferenceResolver,
     MetadataReferenceResolver metadataReferenceResolver,
     AssemblyIdentityComparer assemblyIdentityComparer,
     StrongNameProvider strongNameProvider,
     MetadataImportOptions metadataImportOptions,
     bool publicSign,
     PhpDocTypes phpdocTypes,
     PhpParseOptions parseOptions)
     : base(outputKind, reportSuppressedDiagnostics, moduleName, mainTypeName, scriptClassName,
            cryptoKeyContainer, cryptoKeyFile, cryptoPublicKey, delaySign, publicSign, optimizationLevel, checkOverflow,
            platform, generalDiagnosticOption, warningLevel, specificDiagnosticOptions.ToImmutableDictionaryOrEmpty(),
            concurrentBuild, deterministic, extendedCustomDebugInformation, debugPlusMode, xmlReferenceResolver,
            sourceReferenceResolver, metadataReferenceResolver, assemblyIdentityComparer,
            strongNameProvider, metadataImportOptions)
 {
     this.BaseDirectory = baseDirectory;
     this.SdkDirectory  = sdkDirectory;
     this.PhpDocTypes   = phpdocTypes;
     this.ParseOptions  = parseOptions;
 }
示例#16
0
 // 15.9 BACKCOMPAT OVERLOAD -- DO NOT TOUCH
 public CSharpCompilationOptions(
     OutputKind outputKind,
     bool reportSuppressedDiagnostics,
     string moduleName,
     string mainTypeName,
     string scriptClassName,
     IEnumerable <string> usings,
     OptimizationLevel optimizationLevel,
     bool checkOverflow,
     bool allowUnsafe,
     string cryptoKeyContainer,
     string cryptoKeyFile,
     ImmutableArray <byte> cryptoPublicKey,
     bool?delaySign,
     Platform platform,
     ReportDiagnostic generalDiagnosticOption,
     int warningLevel,
     IEnumerable <KeyValuePair <string, ReportDiagnostic> > specificDiagnosticOptions,
     bool concurrentBuild,
     bool deterministic,
     XmlReferenceResolver xmlReferenceResolver,
     SourceReferenceResolver sourceReferenceResolver,
     MetadataReferenceResolver metadataReferenceResolver,
     AssemblyIdentityComparer assemblyIdentityComparer,
     StrongNameProvider strongNameProvider,
     bool publicSign,
     MetadataImportOptions metadataImportOptions)
     : this(outputKind, reportSuppressedDiagnostics, moduleName, mainTypeName, scriptClassName,
            usings, optimizationLevel, checkOverflow, allowUnsafe,
            cryptoKeyContainer, cryptoKeyFile, cryptoPublicKey, delaySign, platform,
            generalDiagnosticOption, warningLevel,
            specificDiagnosticOptions, concurrentBuild, deterministic,
            xmlReferenceResolver,
            sourceReferenceResolver,
            metadataReferenceResolver,
            assemblyIdentityComparer,
            strongNameProvider,
            publicSign,
            metadataImportOptions,
            nullableContextOptions : NullableContextOptions.Disable)
 {
 }
 // Expects correct arguments.
 internal CSharpCompilationOptions(
     OutputKind outputKind,
     string moduleName,
     string mainTypeName,
     string scriptClassName,
     IEnumerable <string> usings,
     bool optimize,
     bool checkOverflow,
     bool allowUnsafe,
     string cryptoKeyContainer,
     string cryptoKeyFile,
     bool?delaySign,
     int fileAlignment,
     ulong baseAddress,
     Platform platform,
     ReportDiagnostic generalDiagnosticOption,
     int warningLevel,
     IEnumerable <KeyValuePair <string, ReportDiagnostic> > specificDiagnosticOptions,
     bool highEntropyVirtualAddressSpace,
     DebugInformationKind debugInformationKind,
     SubsystemVersion subsystemVersion,
     string runtimeMetadataVersion,
     bool concurrentBuild,
     XmlReferenceResolver xmlReferenceResolver,
     SourceReferenceResolver sourceReferenceResolver,
     MetadataReferenceResolver metadataReferenceResolver,
     MetadataReferenceProvider metadataReferenceProvider,
     AssemblyIdentityComparer assemblyIdentityComparer,
     StrongNameProvider strongNameProvider,
     MetadataImportOptions metadataImportOptions,
     ImmutableArray <string> features)
     : base(outputKind, moduleName, mainTypeName, scriptClassName, cryptoKeyContainer, cryptoKeyFile, delaySign, optimize, checkOverflow, fileAlignment, baseAddress,
            platform, generalDiagnosticOption, warningLevel, specificDiagnosticOptions, highEntropyVirtualAddressSpace, debugInformationKind,
            subsystemVersion, concurrentBuild, xmlReferenceResolver, sourceReferenceResolver, metadataReferenceResolver, metadataReferenceProvider, assemblyIdentityComparer, strongNameProvider, metadataImportOptions, features)
 {
     this.Usings                 = usings.AsImmutableOrEmpty();
     this.AllowUnsafe            = allowUnsafe;
     this.RuntimeMetadataVersion = runtimeMetadataVersion;
 }
示例#18
0
        protected void ReadCompilationOptionsFrom(
            ObjectReader reader,
            out OutputKind outputKind,
            out bool reportSuppressedDiagnostics,
            out string moduleName,
            out string mainTypeName,
            out string scriptClassName,
            out OptimizationLevel optimizationLevel,
            out bool checkOverflow,
            out string cryptoKeyContainer,
            out string cryptoKeyFile,
            out ImmutableArray <byte> cryptoPublicKey,
            out bool?delaySign,
            out Platform platform,
            out ReportDiagnostic generalDiagnosticOption,
            out int warningLevel,
            out IEnumerable <KeyValuePair <string, ReportDiagnostic> > specificDiagnosticOptions,
            out bool concurrentBuild,
            out bool deterministic,
            out bool publicSign,
            out XmlReferenceResolver xmlReferenceResolver,
            out SourceReferenceResolver sourceReferenceResolver,
            out MetadataReferenceResolver metadataReferenceResolver,
            out AssemblyIdentityComparer assemblyIdentityComparer,
            out StrongNameProvider strongNameProvider,
            CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            outputKind = (OutputKind)reader.ReadInt32();
            reportSuppressedDiagnostics = reader.ReadBoolean();
            moduleName   = reader.ReadString();
            mainTypeName = reader.ReadString();

            scriptClassName   = reader.ReadString();
            optimizationLevel = (OptimizationLevel)reader.ReadInt32();
            checkOverflow     = reader.ReadBoolean();

            // REVIEW: is it okay this being not part of snapshot?
            cryptoKeyContainer = reader.ReadString();
            cryptoKeyFile      = reader.ReadString();

            cryptoPublicKey = reader.ReadArray <byte>().ToImmutableArrayOrEmpty();

            delaySign = reader.ReadBoolean() ? (bool?)reader.ReadBoolean() : null;

            platform = (Platform)reader.ReadInt32();
            generalDiagnosticOption = (ReportDiagnostic)reader.ReadInt32();

            warningLevel = reader.ReadInt32();

            // REVIEW: I don't think there is a guarantee on ordering of elements in the immutable dictionary.
            //         unfortunately, we need to sort them to make it deterministic
            //         not sure why CompilationOptions uses SequencialEqual to check options equality
            //         when ordering can change result of it even if contents are same.
            var count = reader.ReadInt32();
            List <KeyValuePair <string, ReportDiagnostic> > specificDiagnosticOptionsList = null;

            if (count > 0)
            {
                specificDiagnosticOptionsList = new List <KeyValuePair <string, ReportDiagnostic> >(count);

                for (var i = 0; i < count; i++)
                {
                    var key   = reader.ReadString();
                    var value = (ReportDiagnostic)reader.ReadInt32();

                    specificDiagnosticOptionsList.Add(KeyValuePair.Create(key, value));
                }
            }

            specificDiagnosticOptions = specificDiagnosticOptionsList ?? SpecializedCollections.EmptyEnumerable <KeyValuePair <string, ReportDiagnostic> >();

            concurrentBuild = reader.ReadBoolean();
            deterministic   = reader.ReadBoolean();
            publicSign      = reader.ReadBoolean();

            // REVIEW: What should I do with these. are these service required when compilation is built ourselves, not through
            //         compiler.
            xmlReferenceResolver      = XmlFileResolver.Default;
            sourceReferenceResolver   = SourceFileResolver.Default;
            metadataReferenceResolver = null;
            assemblyIdentityComparer  = DesktopAssemblyIdentityComparer.Default;
            strongNameProvider        = new DesktopStrongNameProvider();
        }
 internal CompilationOptionsAdapter(OutputKind outputKind, bool reportSuppressedDiagnostics, string moduleName, string mainTypeName, string scriptClassName, string cryptoKeyContainer, string cryptoKeyFile, ImmutableArray <byte> cryptoPublicKey, bool?delaySign, bool publicSign, OptimizationLevel optimizationLevel, bool checkOverflow, Platform platform, ReportDiagnostic generalDiagnosticOption, int warningLevel, ImmutableDictionary <string, ReportDiagnostic> specificDiagnosticOptions, bool concurrentBuild, bool deterministic, DateTime currentLocalTime, bool debugPlusMode, XmlReferenceResolver xmlReferenceResolver, SourceReferenceResolver sourceReferenceResolver, MetadataReferenceResolver metadataReferenceResolver, AssemblyIdentityComparer assemblyIdentityComparer, StrongNameProvider strongNameProvider, MetadataImportOptions metadataImportOptions, bool referencesSupersedeLowerVersions)
     : base(outputKind, reportSuppressedDiagnostics, moduleName, mainTypeName, scriptClassName, cryptoKeyContainer, cryptoKeyFile, cryptoPublicKey, delaySign, publicSign, optimizationLevel, checkOverflow, platform, generalDiagnosticOption, warningLevel, specificDiagnosticOptions, concurrentBuild, deterministic, currentLocalTime, debugPlusMode, xmlReferenceResolver, sourceReferenceResolver, metadataReferenceResolver, assemblyIdentityComparer, strongNameProvider, metadataImportOptions, referencesSupersedeLowerVersions)
 {
 }
 public new MetaCompilationOptions WithXmlReferenceResolver(XmlReferenceResolver resolver) => (MetaCompilationOptions)base.WithXmlReferenceResolver(resolver);
        protected void ReadCompilationOptionsFrom(
            ObjectReader reader,
            out OutputKind outputKind,
            out bool reportSuppressedDiagnostics,
            out string moduleName,
            out string mainTypeName,
            out string scriptClassName,
            out OptimizationLevel optimizationLevel,
            out bool checkOverflow,
            out string cryptoKeyContainer,
            out string cryptoKeyFile,
            out ImmutableArray<byte> cryptoPublicKey,
            out bool? delaySign,
            out Platform platform,
            out ReportDiagnostic generalDiagnosticOption,
            out int warningLevel,
            out IEnumerable<KeyValuePair<string, ReportDiagnostic>> specificDiagnosticOptions,
            out bool concurrentBuild,
            out bool deterministic,
            out bool publicSign,
            out XmlReferenceResolver xmlReferenceResolver,
            out SourceReferenceResolver sourceReferenceResolver,
            out MetadataReferenceResolver metadataReferenceResolver,
            out AssemblyIdentityComparer assemblyIdentityComparer,
            out StrongNameProvider strongNameProvider,
            CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            outputKind = (OutputKind)reader.ReadInt32();
            reportSuppressedDiagnostics = reader.ReadBoolean();
            moduleName = reader.ReadString();
            mainTypeName = reader.ReadString();

            scriptClassName = reader.ReadString();
            optimizationLevel = (OptimizationLevel)reader.ReadInt32();
            checkOverflow = reader.ReadBoolean();

            // REVIEW: is it okay this being not part of snapshot?
            cryptoKeyContainer = reader.ReadString();
            cryptoKeyFile = reader.ReadString();

            cryptoPublicKey = reader.ReadArray<byte>().ToImmutableArrayOrEmpty();

            delaySign = reader.ReadBoolean() ? (bool?)reader.ReadBoolean() : null;

            platform = (Platform)reader.ReadInt32();
            generalDiagnosticOption = (ReportDiagnostic)reader.ReadInt32();

            warningLevel = reader.ReadInt32();

            // REVIEW: I don't think there is a guarantee on ordering of elements in the immutable dictionary.
            //         unfortunately, we need to sort them to make it deterministic
            //         not sure why CompilationOptions uses SequencialEqual to check options equality
            //         when ordering can change result of it even if contents are same.
            var count = reader.ReadInt32();
            List<KeyValuePair<string, ReportDiagnostic>> specificDiagnosticOptionsList = null;

            if (count > 0)
            {
                specificDiagnosticOptionsList = new List<KeyValuePair<string, ReportDiagnostic>>(count);

                for (var i = 0; i < count; i++)
                {
                    var key = reader.ReadString();
                    var value = (ReportDiagnostic)reader.ReadInt32();

                    specificDiagnosticOptionsList.Add(KeyValuePair.Create(key, value));
                }
            }

            specificDiagnosticOptions = specificDiagnosticOptionsList ?? SpecializedCollections.EmptyEnumerable<KeyValuePair<string, ReportDiagnostic>>();

            concurrentBuild = reader.ReadBoolean();
            deterministic = reader.ReadBoolean();
            publicSign = reader.ReadBoolean();

            // REVIEW: What should I do with these. are these service required when compilation is built ourselves, not through
            //         compiler.
            xmlReferenceResolver = XmlFileResolver.Default;
            sourceReferenceResolver = SourceFileResolver.Default;
            metadataReferenceResolver = null;
            assemblyIdentityComparer = DesktopAssemblyIdentityComparer.Default;
            strongNameProvider = new DesktopStrongNameProvider();
        }
示例#22
0
 protected override CompilationOptions CommonWithXmlReferenceResolver(XmlReferenceResolver resolver) =>
     WithXmlReferenceResolver(resolver);
示例#23
0
 protected override CompilationOptions CommonWithXmlReferenceResolver(XmlReferenceResolver resolver)
 {
     return(WithXmlReferenceResolver(resolver));
 }