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; }
// 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; }
public CSharpParseOptions WithLanguageVersion(LanguageVersion version) { if (version == this.SpecifiedLanguageVersion) { return(this); } var effectiveLanguageVersion = version.MapSpecifiedToEffectiveVersion(); return(new CSharpParseOptions(this) { SpecifiedLanguageVersion = version, LanguageVersion = effectiveLanguageVersion }); }
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 }); }