Exemplo n.º 1
0
 internal CSharpParseOptions(
     LanguageVersion languageVersion,
     DocumentationMode documentationMode,
     SourceCodeKind kind,
     IEnumerable <string> preprocessorSymbols,
     IReadOnlyDictionary <string, string> features)
     : base(kind, documentationMode)
 {
     this.SpecifiedLanguageVersion = languageVersion;
     this.LanguageVersion          = languageVersion.MapSpecifiedToEffectiveVersion();
     this.PreprocessorSymbols      = preprocessorSymbols.ToImmutableArrayOrEmpty();
     _features = features?.ToImmutableDictionary() ?? ImmutableDictionary <string, string> .Empty;
 }
Exemplo n.º 2
0
 // No validation
 internal CSharpParseOptions(
     LanguageVersion languageVersion,
     DocumentationMode documentationMode,
     SourceCodeKind kind,
     ImmutableArray <string> preprocessorSymbols)
     : base(kind, documentationMode)
 {
     Debug.Assert(!preprocessorSymbols.IsDefault);
     this.SpecifiedLanguageVersion = languageVersion;
     this.LanguageVersion          = languageVersion.MapSpecifiedToEffectiveVersion();
     this.PreprocessorSymbols      = preprocessorSymbols;
     _features = ImmutableDictionary <string, string> .Empty;
 }
Exemplo n.º 3
0
        public CSharpParseOptions WithLanguageVersion(LanguageVersion version)
        {
            if (version == this.SpecifiedLanguageVersion)
            {
                return(this);
            }

            var effectiveLanguageVersion = version.MapSpecifiedToEffectiveVersion();

            return(new CSharpParseOptions(this)
            {
                SpecifiedLanguageVersion = version, LanguageVersion = effectiveLanguageVersion
            });
        }
Exemplo n.º 4
0
        public CSharpParseOptions WithLanguageVersion(LanguageVersion version)
        {
            if (version == this.SpecifiedLanguageVersion)
            {
                return(this);
            }

            var effectiveLanguageVersion = version.MapSpecifiedToEffectiveVersion();

            if (!effectiveLanguageVersion.IsValid())
            {
                throw new ArgumentOutOfRangeException(nameof(version));
            }

            return(new CSharpParseOptions(this)
            {
                SpecifiedLanguageVersion = version, LanguageVersion = effectiveLanguageVersion
            });
        }