ResolvedAssembly( string path, AssemblyName assemblyName, bool hasIntegration, IEnumerable <AssemblyName> references = null, IEnumerable <ResolvedAssembly> resolvedReferences = null, IEnumerable <ExternalDependency> externalDependencies = null) { if (path == null) { throw new ArgumentNullException(nameof(path)); } if (assemblyName == null) { throw new ArgumentNullException(nameof(assemblyName)); } Path = path; AssemblyName = assemblyName; HasIntegration = hasIntegration; References = references?.ToImmutableHashSet() ?? ImmutableHashSet <AssemblyName> .Empty; ResolvedReferences = resolvedReferences?.ToImmutableHashSet() ?? ImmutableHashSet <ResolvedAssembly> .Empty; ExternalDependencies = externalDependencies?.ToImmutableArray() ?? ImmutableArray <ExternalDependency> .Empty; }
protected override TestOptions CommonWithAllowedCompilerDiagnosticIds(IEnumerable <string> values) { return(new VisualBasicTestOptions(this) { AllowedCompilerDiagnosticIds = values?.ToImmutableArray() ?? ImmutableArray <string> .Empty }); }
public EvaluatedPassInfo(EvaluationPass pass, string description, IEnumerable <EvaluatedLocationInfo> locations, TimeInfo time) { Pass = pass; Description = description; Locations = locations?.ToImmutableArray() ?? ImmutableArray <EvaluatedLocationInfo> .Empty; Time = time; }
private static void Start( string inputFilePath, string outputFilePath, bool unattended, string libraryName, IEnumerable <string>?includeDirectories = null, IEnumerable <string>?defineMacros = null, IEnumerable <string>?additionalArgs = null) { try { var programState = new ProgramState( inputFilePath, outputFilePath, unattended, libraryName, includeDirectories?.ToImmutableArray(), defineMacros?.ToImmutableArray(), additionalArgs?.ToImmutableArray()); var program = new Program(programState); program.Execute(); } catch (ProgramException e) { Console.Error.WriteLine(e.Message); Environment.Exit(-1); } }
private SimpleDiagnostic( DiagnosticDescriptor descriptor, DiagnosticSeverity severity, int warningLevel, Location location, IEnumerable<Location> additionalLocations, object[] messageArgs) { if ((warningLevel == 0 && severity != DiagnosticSeverity.Error) || (warningLevel != 0 && severity == DiagnosticSeverity.Error)) { throw new ArgumentException(nameof(warningLevel)); } if(descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } _descriptor = descriptor; _severity = severity; _warningLevel = warningLevel; _location = location ?? Location.None; _additionalLocations = additionalLocations == null ? SpecializedCollections.EmptyReadOnlyList<Location>() : additionalLocations.ToImmutableArray(); _messageArgs = messageArgs ?? SpecializedCollections.EmptyArray<object>(); }
public MultiColumnCountsPartial( IEnumerable <ColumnProjection> projections, IEnumerable <int>?rootIndices = default) { ColumnProjections = projections.ToImmutableArray(); RootIndices = rootIndices?.ToImmutableArray() ?? ImmutableArray <int> .Empty; }
public Bootstrapper(ILogger <Bootstrapper> logger, IEnumerable <IInitializer> initializers, IInitializersValidator validator, IProcessConstructor builder) { Logger = logger ?? throw new ArgumentNullException(nameof(logger)); var immutableInitializers = initializers?.ToImmutableArray() ?? throw new ArgumentNullException(nameof(initializers)); if (validator == null) { throw new ArgumentNullException(nameof(validator)); } if (builder == null) { throw new ArgumentNullException(nameof(builder)); } var result = validator.Validate(immutableInitializers); if (!result.IsValid) { throw new ValidationException(result); } AdditionalTime = TimeSpan.FromSeconds(5); StartProcess = new Lazy <IProcess>(() => builder.BuildStartupProcess(immutableInitializers)); StopProcess = new Lazy <IProcess>(() => builder.BuildShutdownProcess(immutableInitializers)); }
/// <summary> /// Create a RuleSet. /// </summary> public RuleSet(string filePath, ReportDiagnostic generalOption, IDictionary<string, ReportDiagnostic> specificOptions, IEnumerable<RuleSetInclude> includes) { this.filePath = filePath; this.generalDiagnosticOption = generalOption; this.specificDiagnosticOptions = specificOptions == null ? ImmutableDictionary<string, ReportDiagnostic>.Empty : specificOptions.ToImmutableDictionary(); this.includes = includes == null ? ImmutableArray<RuleSetInclude>.Empty : includes.ToImmutableArray(); }
public MathEquation(string equationString, IEnumerable <double> actualResults, double shownResult, double tolerance) { this.EquationString = equationString ?? throw new ArgumentNullException(nameof(equationString)); this.ShownResult = shownResult; this.Tolerance = tolerance; this.ActualResults = actualResults?.ToImmutableArray() ?? throw new ArgumentNullException(nameof(actualResults)); }
private SimpleDiagnostic( DiagnosticDescriptor descriptor, DiagnosticSeverity severity, int warningLevel, Location location, IEnumerable <Location> additionalLocations, object[] messageArgs, ImmutableDictionary <string, string> properties, bool isSuppressed) { if ((warningLevel == 0 && severity != DiagnosticSeverity.Error) || (warningLevel != 0 && severity == DiagnosticSeverity.Error)) { throw new ArgumentException($"{nameof(warningLevel)} ({warningLevel}) and {nameof(severity)} ({severity}) are not compatible.", nameof(warningLevel)); } _descriptor = descriptor ?? throw new ArgumentNullException(nameof(descriptor)); _severity = severity; _warningLevel = warningLevel; _location = location ?? Location.None; _additionalLocations = additionalLocations?.ToImmutableArray() ?? SpecializedCollections.EmptyReadOnlyList <Location>(); _messageArgs = messageArgs ?? Array.Empty <object>(); _properties = properties ?? ImmutableDictionary <string, string> .Empty; _isSuppressed = isSuppressed; }
protected override TestOptions CommonWithMetadataReferences(IEnumerable <MetadataReference> values) { return(new VisualBasicTestOptions(this) { MetadataReferences = values?.ToImmutableArray() ?? ImmutableArray <MetadataReference> .Empty }); }
public EmitSettings( string @namespace, ImmutableDictionary <string, string> primitiveTypeMapping = null, ImmutableDictionary <string, ValidatorConfig> validators = null, IEnumerable <ExternalSymbolConfig> externalSymbols = null, IEnumerable <string> additionalReferences = null, bool emitWithMethods = true, bool emitInterfaceWithMethods = true, bool emitOptionalWithMethods = true, bool withMethodReturnsValidationResult = true, bool fallbackToStringType = false, bool addJsonPropertyAttributes = false, bool emitPartialClasses = false, bool emitValidationExtension = false) { Namespace = @namespace; PrimitiveTypeMapping = primitiveTypeMapping ?? ImmutableDictionary <string, string> .Empty; Validators = validators ?? ImmutableDictionary <string, ValidatorConfig> .Empty; ExternalSymbols = externalSymbols?.ToImmutableArray() ?? ImmutableArray <ExternalSymbolConfig> .Empty; AdditionalReferences = additionalReferences?.ToImmutableArray() ?? ImmutableArray <string> .Empty; EmitWithMethods = emitWithMethods; EmitInterfaceWithMethods = emitInterfaceWithMethods; EmitOptionalWithMethods = emitOptionalWithMethods; WithMethodReturnValidationResult = withMethodReturnsValidationResult; FallbackToStringType = fallbackToStringType; AddJsonPropertyAttributes = addJsonPropertyAttributes; EmitPartialClasses = emitPartialClasses; if (emitValidationExtension && !emitPartialClasses) { throw new ArgumentException("Validation extension can only be enabled with partial classes", nameof(emitValidationExtension)); } EmitValidationExtension = emitValidationExtension; }
public SignatureHelpModel(TextSpan applicableSpan, IEnumerable<SignatureItem> signatures, SignatureItem signature, int selectedParameter) { Signatures = signatures.ToImmutableArray(); ApplicableSpan = applicableSpan; Signature = signature; SelectedParameter = selectedParameter; }
public GameRound(Guid id, DateTimeOffset startTime, MathEquation equation, IEnumerable <GamePlayer> players) { this.Id = id; this.StartTime = startTime; this.Equation = equation ?? throw new ArgumentNullException(nameof(equation)); this.Players = players?.ToImmutableArray() ?? throw new ArgumentNullException(nameof(players)); }
public AComplexImmutableType(string id, string name, IEnumerable <string> children, Uri?uri = null) { Id = id; Name = name; Children = children?.ToImmutableArray() ?? ImmutableArray <string> .Empty; Uri = uri; }
internal RepoConfig( IEnumerable<NuGetPackage> fixedPackages, IEnumerable<string> toolsetPackages, IEnumerable<Regex> nuspecExcludes, IEnumerable<Regex> projectJsonExcludes, GenerateData? msbuildGenerateData) { Debug.Assert(toolsetPackages.Distinct().Count() == toolsetPackages.Count()); MSBuildGenerateData = msbuildGenerateData; FixedPackages = fixedPackages.OrderBy(x => x.Name).ToImmutableArray(); NuSpecExcludes = nuspecExcludes.ToImmutableArray(); ProjectJsonExcludes = projectJsonExcludes.ToImmutableArray(); ToolsetPackages = toolsetPackages.OrderBy(x => x).ToImmutableArray(); var map = new Dictionary<string, List<string>>(); foreach (var nugetRef in fixedPackages) { List<string> list; if (!map.TryGetValue(nugetRef.Name, out list)) { list = new List<string>(capacity: 1); map[nugetRef.Name] = list; } list.Add(nugetRef.Version); } }
public TSLField(ITSLType type, string name, bool optional, IEnumerable <TSLAttribute> attributes = null) { Type = type; Name = name; Optional = optional; Attributes = (attributes?.ToImmutableArray()).GetValueOrDefault(); }
/// <summary> /// Initializes a new instance of <see cref="DiagnosticTestData"/>. /// </summary> /// <param name="descriptor"></param> /// <param name="source"></param> /// <param name="spans"></param> /// <param name="additionalSpans"></param> /// <param name="additionalFiles"></param> /// <param name="diagnosticMessage"></param> /// <param name="formatProvider"></param> /// <param name="equivalenceKey"></param> /// <param name="alwaysVerifyAdditionalLocations"></param> public DiagnosticTestData( DiagnosticDescriptor descriptor, string source, IEnumerable <TextSpan> spans, IEnumerable <TextSpan> additionalSpans = null, IEnumerable <AdditionalFile> additionalFiles = null, string diagnosticMessage = null, IFormatProvider formatProvider = null, string equivalenceKey = null, bool alwaysVerifyAdditionalLocations = false) { Descriptor = descriptor ?? throw new ArgumentNullException(nameof(descriptor)); Source = source ?? throw new ArgumentNullException(nameof(source)); Spans = spans?.ToImmutableArray() ?? ImmutableArray <TextSpan> .Empty; AdditionalSpans = additionalSpans?.ToImmutableArray() ?? ImmutableArray <TextSpan> .Empty; AdditionalFiles = additionalFiles?.ToImmutableArray() ?? ImmutableArray <AdditionalFile> .Empty; DiagnosticMessage = diagnosticMessage; FormatProvider = formatProvider; EquivalenceKey = equivalenceKey; AlwaysVerifyAdditionalLocations = alwaysVerifyAdditionalLocations; if (Spans.Length > 1 && !AdditionalSpans.IsEmpty) { throw new ArgumentException("", nameof(additionalSpans)); } }
public FunctionResolver(ObjectType declaringObject, IEnumerable <FunctionOverload>?functionOverloads = null, IEnumerable <BannedFunction>?bannedFunctions = null) { this.functionOverloads = functionOverloads?.ToImmutableArray() ?? ImmutableArray <FunctionOverload> .Empty; this.bannedFunctions = bannedFunctions?.ToImmutableArray() ?? ImmutableArray <BannedFunction> .Empty; var wildcardOverloads = this.functionOverloads.OfType <FunctionWildcardOverload>(); // prepopulate cache with all known (non-wildcard) symbols // TODO: make cache building logic lazy this.FunctionCache = this.functionOverloads .Where(fo => fo is not FunctionWildcardOverload) .GroupBy(fo => fo.Name, (name, overloads) => { var matchingWildcards = wildcardOverloads.Where(x => x.WildcardRegex.IsMatch(name)); return(new FunctionSymbol(declaringObject, name, overloads.Concat(matchingWildcards))); }, LanguageConstants.IdentifierComparer) .ToDictionary <FunctionSymbol, string, FunctionSymbol?>(s => s.Name, s => s, LanguageConstants.IdentifierComparer); this.BannedFunctions = this.bannedFunctions.ToImmutableDictionary(bf => bf.Name, LanguageConstants.IdentifierComparer); // don't pre-build symbols for wildcard functions, because we don't want to equate two differently-named symbols with each other this.FunctionWildcardOverloads = this.functionOverloads .OfType <FunctionWildcardOverload>() .ToImmutableArray(); this.declaringObject = declaringObject; }
internal StepEventStateMetadata( string urn, string type, bool?custom, bool?delete, string id, string parent, bool?protect, IDictionary <string, object> inputs, IDictionary <string, object> outputs, string provider, IEnumerable <string>?initErrors) { Urn = urn; Type = type; Custom = custom; Delete = delete; Id = id; Parent = parent; Protect = protect; Inputs = inputs.ToImmutableDictionary(); Outputs = outputs.ToImmutableDictionary(); Provider = provider; InitErrors = initErrors?.ToImmutableArray(); }
public ParsingResult(Settings settings, ITextSnapshot textSnapshot, IEnumerable<TextSpan> attributeSpans) { TextSnapshot = textSnapshot; AttributeSpans = attributeSpans.ToImmutableArray(); }
public FileAssemblyLoader( ILogger <FileAssemblyLoader> logger, IEnumerable <string> directoriesToCheck) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _directoriesToCheck = directoriesToCheck?.ToImmutableArray() ?? throw new ArgumentNullException(nameof(directoriesToCheck)); }
private SimpleDiagnostic( DiagnosticDescriptor descriptor, DiagnosticSeverity severity, int warningLevel, Location location, IEnumerable <Location> additionalLocations, object[] messageArgs, ImmutableDictionary <string, string> properties) { if ((warningLevel == 0 && severity != DiagnosticSeverity.Error) || (warningLevel != 0 && severity == DiagnosticSeverity.Error)) { throw new ArgumentException(nameof(warningLevel)); } if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } _descriptor = descriptor; _severity = severity; _warningLevel = warningLevel; _location = location ?? Location.None; _additionalLocations = additionalLocations?.ToImmutableArray() ?? SpecializedCollections.EmptyReadOnlyList <Location>(); _messageArgs = messageArgs ?? SpecializedCollections.EmptyArray <object>(); _properties = properties ?? ImmutableDictionary <string, string> .Empty; }
internal SimpleDiagnostic(string id, string category, string message, DiagnosticSeverity severity, bool isEnabledByDefault, int warningLevel, bool isWarningAsError, Location location, IEnumerable<Location> additionalLocations) { if (isWarningAsError && severity != DiagnosticSeverity.Warning) { throw new ArgumentException("isWarningAsError"); } if ((warningLevel == 0 && severity == DiagnosticSeverity.Warning) || (warningLevel != 0 && severity != DiagnosticSeverity.Warning)) { throw new ArgumentException("warningLevel"); } this.id = id; this.category = category; this.message = message; this.severity = severity; this.isEnabledByDefault = isEnabledByDefault; this.warningLevel = warningLevel; this.isWarningAsError = isWarningAsError; this.location = location; this.additionalLocations = additionalLocations == null ? SpecializedCollections.EmptyReadOnlyList<Location>() : additionalLocations.ToImmutableArray(); }
// NOTE: Change table actions to be IEnumerable<namedType> rather than IEnumerable<Tuple<>>. private EwfTable( bool hideIfEmpty, EwfTableStyle style, IEnumerable <string> classes, string postBackIdBase, string caption, string subCaption, bool allowExportToExcel, IEnumerable <Tuple <string, Action> > tableActions, IEnumerable <EwfTableField> fields, IEnumerable <EwfTableItem> headItems, DataRowLimit defaultItemLimit, bool disableEmptyFieldDetection, IEnumerable <EwfTableItemGroup> itemGroups, IEnumerable <TailUpdateRegion> tailUpdateRegions) { this.hideIfEmpty = hideIfEmpty; this.style = style; this.classes = (classes ?? new string[0]).ToList().AsReadOnly(); this.postBackIdBase = PostBack.GetCompositeId("ewfTable", postBackIdBase); this.caption = caption; this.subCaption = subCaption; this.allowExportToExcel = allowExportToExcel; this.tableActions = (tableActions ?? new Tuple <string, Action> [0]).ToList().AsReadOnly(); if (fields != null) { if (!fields.Any()) { throw new ApplicationException("If fields are specified, there must be at least one of them."); } specifiedFields = fields.ToArray(); } this.headItems = (headItems ?? new EwfTableItem[0]).ToList(); this.defaultItemLimit = defaultItemLimit; this.disableEmptyFieldDetection = disableEmptyFieldDetection; this.itemGroups = itemGroups.ToImmutableArray(); this.tailUpdateRegions = tailUpdateRegions?.ToImmutableArray() ?? ImmutableArray <TailUpdateRegion> .Empty; // When we migrate EwfTable to the new component model, consider having ElementComponent (or ElementNode) store the current DMs and execute the // elementDataGetter with them. This would save developers from having to manually do this when creating intermediate post-backs for click scripts. dataModifications = FormState.Current.DataModifications; }
public CompletionModel(SemanticModel semanticModel, TextSpan applicableSpan, ITextSnapshot textSnapshot, IEnumerable<CompletionItem> items) { SemanticModel = semanticModel; ApplicableSpan = applicableSpan; TextSnapshot = textSnapshot; Items = items.ToImmutableArray(); }
/// <summary> /// Initializes a new instance of the <see cref="UserNotificationMetadata"/> class. /// </summary> /// <param name="correlationIds">The <see cref="CorrelationIds"/>.</param> /// <param name="etag">The <see cref="ETag"/>.</param> public UserNotificationMetadata(IEnumerable <string> correlationIds, string?etag) { // Note: although correlation Ids should not be null, some combinations of serializer settings can result // in an empty array not being serialized, meaning that when this constructor is called during // deserialization we will get a null value. As such, we'll just treat null the same as an empty array. this.CorrelationIds = correlationIds?.ToImmutableArray() ?? throw new ArgumentNullException(nameof(correlationIds)); this.ETag = etag; }
public DefaultFromContextPropertyBinder(IEnumerable<DefaultFromContextProperty> properties) { if (properties == null) { throw Logger.Fatal.ArgumentNull(nameof(properties)); } Properties = properties.ToImmutableArray(); }
protected CodeVerificationOptions( IEnumerable <string> assemblyNames = null, DiagnosticSeverity allowedCompilerDiagnosticSeverity = DiagnosticSeverity.Info, IEnumerable <string> allowedCompilerDiagnosticIds = null) { AssemblyNames = assemblyNames; AllowedCompilerDiagnosticSeverity = allowedCompilerDiagnosticSeverity; AllowedCompilerDiagnosticIds = allowedCompilerDiagnosticIds?.ToImmutableArray() ?? ImmutableArray <string> .Empty; }
public ResolvedPropertyBinder(IEnumerable<PropertyAccessor> properties) { if (properties == null) { throw Logger.Fatal.ArgumentNull(nameof(properties)); } Properties = properties.ToImmutableArray(); }
internal static ImmutableArray <T> SafeToImmutableArray <T>([CanBeNull] this IEnumerable <T> enumerable) { if (enumerable is ImmutableArray <T> array) { return(array); } return(enumerable?.ToImmutableArray() ?? ImmutableArray <T> .Empty); }
public SerializationObjectMap( IEnumerable <SerializationPropertyMap> properties, LambdaExpression ctor, IEnumerable <LambdaExpression> ctorArguments) { this.Properties = properties?.ToImmutableArray() ?? ImmutableArray <SerializationPropertyMap> .Empty; this.Ctor = ctor; this.CtorArguments = ctorArguments?.ToImmutableArray() ?? ImmutableArray <LambdaExpression> .Empty; }
public Headers( IEnumerable <CallableDeclarationHeader> callables = null, IEnumerable <SpecializationDeclarationHeader> specs = null, IEnumerable <TypeDeclarationHeader> types = null) { this.Callables = callables?.ToImmutableArray() ?? ImmutableArray <CallableDeclarationHeader> .Empty; this.Specializations = specs?.ToImmutableArray() ?? ImmutableArray <SpecializationDeclarationHeader> .Empty; this.Types = types?.ToImmutableArray() ?? ImmutableArray <TypeDeclarationHeader> .Empty; }
/// <summary> /// Initializes a new instance of <see cref="TestOptions"/>. /// </summary> /// <param name="metadataReferences"></param> /// <param name="allowedCompilerDiagnosticIds"></param> /// <param name="allowedCompilerDiagnosticSeverity"></param> internal TestOptions( IEnumerable <MetadataReference> metadataReferences = null, IEnumerable <string> allowedCompilerDiagnosticIds = null, DiagnosticSeverity allowedCompilerDiagnosticSeverity = DiagnosticSeverity.Info) { MetadataReferences = metadataReferences?.ToImmutableArray() ?? ImmutableArray <MetadataReference> .Empty; AllowedCompilerDiagnosticIds = allowedCompilerDiagnosticIds?.ToImmutableArray() ?? ImmutableArray <string> .Empty; AllowedCompilerDiagnosticSeverity = allowedCompilerDiagnosticSeverity; }
public BoundFunctionInvocationExpression Update(IEnumerable<BoundExpression> arguments, OverloadResolutionResult<FunctionSymbolSignature> result) { var newArguments = arguments.ToImmutableArray(); if (newArguments == Arguments && result == Result) return this; return new BoundFunctionInvocationExpression(Syntax, newArguments, result); }
public GangStoreFactory( Func <string, IEnumerable <Func <TData, IEnumerable <object> > >, IGangStore <TData> > create, IEnumerable <Func <TData, IEnumerable <object> > > indexers = null ) { _create = create; _indexers = indexers ?.ToImmutableArray() ?? ImmutableArray <Func <TData, IEnumerable <object> > > .Empty; }
public CodeRefactoring(CodeRefactoringProvider provider, IEnumerable<CodeAction> actions) { _provider = provider; _actions = actions.ToImmutableArray(); if (_actions.Count == 0) { throw new ArgumentException("Actions can not be empty", "actions"); } }
public BuildSummary(int buildId, string projectPath, IEnumerable <string> dimensions, IEnumerable <string> targets, BuildType buildType, DateTime startTime) { BuildId = buildId; ProjectName = Path.GetFileName(projectPath); Dimensions = dimensions.ToImmutableArray(); Targets = targets?.ToImmutableArray() ?? ImmutableArray <string> .Empty; BuildType = buildType; StartTime = startTime; Status = BuildStatus.Running; }
public EvaluatedLocationInfo(string elementName, string elementDescription, EvaluationLocationKind kind, string file, int?line, IEnumerable <EvaluatedLocationInfo> children, TimeInfo time) { ElementName = elementName; ElementDescription = elementDescription; Kind = kind; File = file; Line = line; Children = children?.ToImmutableArray() ?? ImmutableArray <EvaluatedLocationInfo> .Empty; Time = time; }
/// <summary> /// Creates a remaining data object. /// </summary> /// <param name="groupName">A control that contains the name of the group and any other information you want in the group head</param> /// <param name="groupActions">Group action buttons</param> /// <param name="groupHeadClickScript">The click script for the group head</param> /// <param name="initiallyCollapsed">Whether the group is initially collapsed. Null means the group cannot be collapsed and is always visible.</param> /// <param name="tailUpdateRegions">The tail update regions for the group. If a table uses item limiting, these regions will include all subsequent item /// groups in the table. This is necessary because any number of items could be appended to this item group, potentially causing subsequent item groups to /// become invisible.</param> public EwfTableItemGroupRemainingData( Control groupName, IEnumerable<Tuple<string, Action>> groupActions = null, ClickScript groupHeadClickScript = null, bool? initiallyCollapsed = null, IEnumerable<TailUpdateRegion> tailUpdateRegions = null) { GroupName = groupName; GroupActions = ( groupActions ?? new Tuple<string, Action>[ 0 ] ).ToList().AsReadOnly(); GroupHeadClickScript = groupHeadClickScript; InitiallyCollapsed = initiallyCollapsed; TailUpdateRegions = tailUpdateRegions != null ? tailUpdateRegions.ToImmutableArray() : ImmutableArray<TailUpdateRegion>.Empty; }
public IngredientProcessing(string name, IEnumerable <int> newOrder, IEnumerable <string> supportedIngredientPropertys) { this.SupportedIngredientPropertys = supportedIngredientPropertys?.ToImmutableHashSet() ?? throw new ArgumentNullException(nameof(supportedIngredientPropertys)); this.Name = name ?? throw new ArgumentNullException(nameof(name)); this.NewOrder = newOrder?.ToImmutableArray() ?? throw new ArgumentNullException(nameof(newOrder)); if (this.NewOrder.Length != 4 * 3) { throw new ArgumentException($"Must be exactly {4 * 3} elements were {this.NewOrder.Length}"); } }
internal PropertyMetaInfo(string name, bool required, Type propertyType, IEnumerable <ValueSuggestion> suggestions = default) { Name = name ?? throw new ArgumentNullException(nameof(name)); Required = required; PropertyType = propertyType ?? throw new ArgumentNullException(nameof(propertyType)); Suggestions = suggestions?.ToImmutableArray() ?? ImmutableArray <ValueSuggestion> .Empty; }
public CodeFixCollection( object provider, TextSpan span, IEnumerable<CodeFix> fixes, FixAllState fixAllState, IEnumerable<FixAllScope> supportedScopes, Diagnostic firstDiagnostic) : this(provider, span, fixes.ToImmutableArray(), fixAllState, supportedScopes, firstDiagnostic) { }
/// <summary> /// Initializes an instance of <see cref="TextChangeEventArgs"/>. /// </summary> /// <param name="oldText">The text before the change.</param> /// <param name="newText">The text after the change.</param> /// <param name="changes">A non-empty set of ranges for the change.</param> public TextChangeEventArgs(SourceText oldText, SourceText newText, IEnumerable<TextChangeRange> changes) { if (changes == null || changes.IsEmpty()) { throw new ArgumentException("changes"); } this.OldText = oldText; this.NewText = newText; this.Changes = changes.ToImmutableArray(); }
public TestCaseViewModel(string displayName, string skipReason, string assemblyFileName, IEnumerable<TraitViewModel> traits) { this.DisplayName = displayName; this.SkipReason = skipReason; this.AssemblyFileName = assemblyFileName; this.Traits = traits.ToImmutableArray(); if (!string.IsNullOrEmpty(skipReason)) { _state = TestState.Skipped; } }
/// <summary> /// Initializes a new <see cref="Sampler"/>. /// </summary> /// <param name="textureUnit">The <see cref="TextureUnit"/> to bind the <see cref="Sampler"/> to.</param> /// <param name="parameters">Sampler parameters.</param> public Sampler(IEnumerable<SamplerParameterDescription> parameters) { Contract.Requires<ArgumentNullException>(parameters != null); this.VerifyAccess(); this.Parameters = parameters.ToImmutableArray(); this.Handle = GL.GenSampler(); foreach (SamplerParameterDescription description in this.Parameters.EnsureNonNull()) { GL.SamplerParameter(this, description.ParameterName, description.Value); } }
public NavigateToItemProvider( Workspace workspace, IGlyphService glyphService, IAsynchronousOperationListener asyncListener, IEnumerable<Lazy<INavigateToOptionsService, VisualStudioVersionMetadata>> optionsServices) { Contract.ThrowIfNull(workspace); Contract.ThrowIfNull(glyphService); Contract.ThrowIfNull(asyncListener); _workspace = workspace; _asyncListener = asyncListener; _optionsServices = optionsServices.ToImmutableArray(); _displayFactory = new ItemDisplayFactory(new NavigateToIconFactory(glyphService)); }
public ParameterSet(String name, IEnumerable<Parameter> parameters, Boolean isDefault) { if (String.IsNullOrWhiteSpace(name)) { throw Logger.Fatal.ArgumentNullOrWhiteSpace(nameof(name)); } if (parameters == null) { throw Logger.Fatal.ArgumentNull(nameof(parameters)); } Name = name; IsDefault = isDefault; Parameters = parameters.ToImmutableArray(); }
private RepoData(RepoConfig config, string sourcesPath, IEnumerable<NuGetFeed> nugetFeeds, IEnumerable<NuGetPackage> floatingPackages) { SourcesPath = sourcesPath; RepoConfig = config; NuGetFeeds = nugetFeeds.ToImmutableArray(); FloatingToolsetPackages = floatingPackages .Where(x => RepoConfig.ToolsetPackages.Contains(x.Name, Constants.NugetPackageNameComparer)) .OrderBy(x => x.Name) .ToImmutableArray(); FloatingBuildPackages = floatingPackages .Where(x => !RepoConfig.ToolsetPackages.Contains(x.Name, Constants.NugetPackageNameComparer)) .OrderBy(x => x.Name) .ToImmutableArray(); FloatingPackages = floatingPackages .OrderBy(x => x.Name) .ToImmutableArray(); AllPackages = Combine(FloatingBuildPackages, FloatingToolsetPackages, FixedPackages); }
public NavigateToItemProvider( Workspace workspace, IGlyphService glyphService, IAsynchronousOperationListener asyncListener, IEnumerable<Lazy<INavigateToHostVersionService, VisualStudioVersionMetadata>> hostServices) { Contract.ThrowIfNull(workspace); Contract.ThrowIfNull(glyphService); Contract.ThrowIfNull(asyncListener); _workspace = workspace; _asyncListener = asyncListener; _hostServices = hostServices.ToImmutableArray(); var hostService = _hostServices.Length > 0 ? VersionSelector.SelectHighest(hostServices) : new Dev14NavigateToHostVersionService(glyphService); _displayFactory = hostService.CreateDisplayFactory(); }
private ImmutableArray<Diagnostic> FilterDiagnostics(IEnumerable<Diagnostic> diagnostics) { if (!IncludeNoLocationDiagnostics) { diagnostics = diagnostics.Where(d => d.Location.IsInSource); } if (!IncludeSuppressedDiagnostics) { diagnostics = diagnostics.Where(d => !d.IsSuppressed); } if (!IncludeUnsuppressedDiagnostics) { diagnostics = diagnostics.Where(d => d.IsSuppressed); } return diagnostics.ToImmutableArray(); }
NRefactoryDiagnosticDiagnostic( DiagnosticDescriptor descriptor, DiagnosticSeverity severity, int warningLevel, Location location, IEnumerable<Location> additionalLocations, object[] messageArgs, string[] customTags = null) { if ((warningLevel == 0 && severity != DiagnosticSeverity.Error) || (warningLevel != 0 && severity == DiagnosticSeverity.Error)) { throw new ArgumentException("warningLevel"); } this.descriptor = descriptor; this.severity = severity; this.warningLevel = warningLevel; this.location = location; this.additionalLocations = additionalLocations == null ? emptyList : additionalLocations.ToImmutableArray(); this.messageArgs = messageArgs ?? emptyArray; this.CustomTags = customTags ?? emptyTags; }
public MoveableBody(IEnumerable<PrimitiveTriangle> tris) { Triangles = tris.ToImmutableArray(); }
private static FixAllState GetFixAllState( FixAllProvider fixAllProvider, IEnumerable<Diagnostic> diagnostics, DiagnosticAnalyzer provider, CodeFixProvider fixer, TestDiagnosticAnalyzerDriver testDriver, Document document, FixAllScope scope, string fixAllActionId) { Assert.NotEmpty(diagnostics); if (scope == FixAllScope.Custom) { // Bulk fixing diagnostics in selected scope. var diagnosticsToFix = ImmutableDictionary.CreateRange(SpecializedCollections.SingletonEnumerable(KeyValuePair.Create(document, diagnostics.ToImmutableArray()))); return FixAllState.Create(fixAllProvider, diagnosticsToFix, fixer, fixAllActionId); } var diagnostic = diagnostics.First(); Func<Document, ImmutableHashSet<string>, CancellationToken, Task<IEnumerable<Diagnostic>>> getDocumentDiagnosticsAsync = async (d, diagIds, c) => { var root = await d.GetSyntaxRootAsync(); var diags = await testDriver.GetDocumentDiagnosticsAsync(provider, d, root.FullSpan); diags = diags.Where(diag => diagIds.Contains(diag.Id)); return diags; }; Func<Project, bool, ImmutableHashSet<string>, CancellationToken, Task<IEnumerable<Diagnostic>>> getProjectDiagnosticsAsync = async (p, includeAllDocumentDiagnostics, diagIds, c) => { var diags = includeAllDocumentDiagnostics ? await testDriver.GetAllDiagnosticsAsync(provider, p) : await testDriver.GetProjectDiagnosticsAsync(provider, p); diags = diags.Where(diag => diagIds.Contains(diag.Id)); return diags; }; var diagnosticIds = ImmutableHashSet.Create(diagnostic.Id); var fixAllDiagnosticProvider = new FixAllState.FixAllDiagnosticProvider(diagnosticIds, getDocumentDiagnosticsAsync, getProjectDiagnosticsAsync); return diagnostic.Location.IsInSource ? new FixAllState(fixAllProvider, document, fixer, scope, fixAllActionId, diagnosticIds, fixAllDiagnosticProvider) : new FixAllState(fixAllProvider, document.Project, fixer, scope, fixAllActionId, diagnosticIds, fixAllDiagnosticProvider); }
public LinkFileReader(IEnumerable<PathMapping> mappings) { Mappings = mappings.ToImmutableArray(); }
public MarkdownTokenValidatorAdapter(IEnumerable<IMarkdownTokenValidator> validators) { Validators = validators.ToImmutableArray(); }
/// <summary> /// Given a set of compiler or <see cref="DiagnosticAnalyzer"/> generated <paramref name="diagnostics"/>, returns the effective diagnostics after applying the below filters: /// 1) <see cref="CompilationOptions.SpecificDiagnosticOptions"/> specified for the given <paramref name="compilation"/>. /// 2) <see cref="CompilationOptions.GeneralDiagnosticOption"/> specified for the given <paramref name="compilation"/>. /// 3) Diagnostic suppression through applied <see cref="System.Diagnostics.CodeAnalysis.SuppressMessageAttribute"/>. /// 4) Pragma directives for the given <paramref name="compilation"/>. /// </summary> public static IEnumerable<Diagnostic> GetEffectiveDiagnostics(IEnumerable<Diagnostic> diagnostics, Compilation compilation) { if (diagnostics == null) { throw new ArgumentNullException(nameof(diagnostics)); } if (compilation == null) { throw new ArgumentNullException(nameof(compilation)); } var suppressMessageState = new SuppressMessageAttributeState(compilation); foreach (var diagnostic in diagnostics.ToImmutableArray()) { if (diagnostic != null) { var effectiveDiagnostic = compilation.Options.FilterDiagnostic(diagnostic); if (effectiveDiagnostic != null) { effectiveDiagnostic = suppressMessageState.ApplySourceSuppressions(effectiveDiagnostic); yield return effectiveDiagnostic; } } } }
/// <summary> /// Given a set of compiler or <see cref="DiagnosticAnalyzer"/> generated <paramref name="diagnostics"/>, returns the effective diagnostics after applying the below filters: /// 1) <see cref="CompilationOptions.SpecificDiagnosticOptions"/> specified for the given <paramref name="compilation"/>. /// 2) <see cref="CompilationOptions.GeneralDiagnosticOption"/> specified for the given <paramref name="compilation"/>. /// 3) Diagnostic suppression through applied <see cref="System.Diagnostics.CodeAnalysis.SuppressMessageAttribute"/>. /// 4) Pragma directives for the given <paramref name="compilation"/>. /// </summary> public static IEnumerable<Diagnostic> GetEffectiveDiagnostics(IEnumerable<Diagnostic> diagnostics, Compilation compilation) { if (diagnostics == null) { throw new ArgumentNullException(nameof(diagnostics)); } if (compilation == null) { throw new ArgumentNullException(nameof(compilation)); } var suppressMessageState = AnalyzerDriver.GetCachedCompilationData(compilation).SuppressMessageAttributeState; foreach (var diagnostic in diagnostics.ToImmutableArray()) { if (diagnostic != null) { var effectiveDiagnostic = compilation.Options.FilterDiagnostic(diagnostic); if (effectiveDiagnostic != null && !suppressMessageState.IsDiagnosticSuppressed(effectiveDiagnostic)) { yield return effectiveDiagnostic; } } } }
public BoundFunctionInvocationExpression(SyntaxNode syntax, IEnumerable<BoundExpression> arguments, OverloadResolutionResult<FunctionSymbolSignature> result) : base(BoundNodeKind.FunctionInvocationExpression, syntax) { Arguments = arguments.ToImmutableArray(); Result = result; }
/// <summary> /// Add supplied <paramref name="action"/> to the list of fixes that will be offered to the user. /// </summary> /// <param name="action">The <see cref="CodeAction"/> that will be invoked to apply the fix.</param> /// <param name="diagnostics">The subset of <see cref="Diagnostics"/> being addressed / fixed by the <paramref name="action"/>.</param> public void RegisterCodeFix(CodeAction action, IEnumerable<Diagnostic> diagnostics) { if (diagnostics == null) { throw new ArgumentNullException(nameof(diagnostics)); } RegisterCodeFix(action, diagnostics.ToImmutableArray()); }