public ProgramState PopValues(int numberOfValuesToPop)
        {
            if (numberOfValuesToPop <= 0)
            {
                return(this);
            }

            var newStack = ImmutableStack.Create(
                ExpressionStack.Skip(numberOfValuesToPop).ToArray());

            return(new ProgramState(
                       Values,
                       Constraints,
                       ProgramPointVisitCounts,
                       newStack,
                       Relationships));
        }
        private async Task <IExecutionResult> ExecuteInternalAsync(
            IExecutionContext executionContext)
        {
            object rootValue = executionContext.Operation.RootValue;

            FieldSelection fieldSelection = executionContext.CollectFields(
                executionContext.Schema.SubscriptionType,
                executionContext.Operation.Definition.SelectionSet,
                null)
                                            .Single();

            ImmutableStack <object> source = ImmutableStack.Create(rootValue);

            var subscribeContext = ResolverContext.Rent(
                executionContext,
                fieldSelection,
                source,
                new FieldData(1));

            SubscribeResolverDelegate subscribeResolver =
                fieldSelection.Field.SubscribeResolver
                ?? DefaultSubscribeResolverAsync;

            try
            {
                IAsyncEnumerable <object> sourceStream =
                    await subscribeResolver(subscribeContext)
                    .ConfigureAwait(false);

                return(new SubscriptionResult(
                           sourceStream,
                           message =>
                {
                    IExecutionContext cloned = executionContext.Clone();
                    cloned.ContextData[WellKnownContextData.EventMessage] = message;
                    return cloned;
                },
                           ExecuteSubscriptionQueryAsync,
                           executionContext.ServiceScope,
                           executionContext.RequestAborted));
            }
            finally
            {
                ResolverContext.Return(subscribeContext);
            }
        }
        public void ImmutableStackTest_2_Success()
        {
            var collection = ImmutableStack.Create <int>();

            collection = collection.Push(0);
            collection = collection.Push(1);
            var target = this.CreateTarget <ImmutableStack <int> >();

            using (var buffer = new MemoryStream())
            {
                target.Pack(buffer, collection);
                buffer.Position = 0;
                var unpacked = target.Unpack(buffer);
                buffer.Position = 0;
                Assert.That(unpacked.ToArray(), Is.EqualTo(collection.ToArray()));
            }
        }
Esempio n. 4
0
        public Blender(Lexer lexer, CSharp.CSharpSyntaxNode oldTree, IEnumerable <TextChangeRange> changes)
        {
            Debug.Assert(lexer != null);
            this.lexer   = lexer;
            this.changes = ImmutableStack.Create <TextChangeRange>();

            if (changes != null)
            {
                // TODO: Consider implementing NormalizedChangeCollection for TextSpan. the real
                // reason why we are collapsing is because we want to extend change ranges and
                // cannot allow them to overlap. This does not seem to be a big deal since multiple
                // changes are infrequent and typically close to each other. However if we have
                // NormalizedChangeCollection for TextSpan we can have both - we can extend ranges
                // and not require collapsing them. NormalizedChangeCollection would also ensure
                // that changes are always normalized.

                // TODO: this is a temporary measure to prevent individual change spans from
                // overlapping after they are widened to effective width (+1 token at the start).
                // once we have normalized collection for TextSpan we will not need to collapse all
                // the change spans.

                var collapsed = changes.Collapse();

                // extend the change to its affected range. This will make it easier
                // to filter out affected nodes since we will be able simply check
                // if node intersects with a change.
                var affectedRange = ExtendToAffectedRange(oldTree, collapsed);
                this.changes = this.changes.Push(affectedRange);
            }

            if (oldTree == null)
            {
                // start at lexer current position if no nodes specified
                this.oldTreeCursor = new Cursor();
                this.newPosition   = lexer.TextWindow.Position;
            }
            else
            {
                this.oldTreeCursor = Cursor.FromRoot(oldTree).MoveToFirstChild();
                this.newPosition   = 0;
            }

            this.changeDelta        = 0;
            this.newLexerDrivenMode = 0;
        }
Esempio n. 5
0
        public void MergeSingleNoChange()
        {
            var source = CreateDummyNode(0);

            var value1 = SymbolicValue <DummyInstruction> .CreateStackValue(source);

            var stack1 = ImmutableStack.Create(value1);

            var value2 = SymbolicValue <DummyInstruction> .CreateStackValue(source);

            var stack2 = ImmutableStack.Create(value2);

            var state1 = new SymbolicProgramState <DummyInstruction>(0, stack1);
            var state2 = new SymbolicProgramState <DummyInstruction>(0, stack2);

            Assert.False(state1.MergeStates(state2, out var newState));
            Assert.Equal(new HashSet <DataFlowNode <DummyInstruction> >(new[] { source }), newState.Stack.Peek().GetNodes());
        }
Esempio n. 6
0
        public void ImmutableCollections()
        {
            var rc = new ReadOnlyCollection <int>(new[] { 4, 5, rngInt, 6, rngInt, 7, 8, rngInt, 98, 34, 2435, 32131 });

            TestDeepEquality(rc);


            var immAr = ImmutableArray.Create(9, 8, 7, 6, 5, 4, 3, 32, rngInt, 123, 15, 42, 5, rngInt, rngInt);

            TestDeepEquality(immAr);


            ImmutableDictionary <int, string> immDict = ImmutableDictionary <int, string> .Empty.AddRange(new[]
            {
                new KeyValuePair <int, string>(rng.Next(0, 10), "a"),
                new KeyValuePair <int, string>(rng.Next(30, 40), "d"),
            });

            TestDeepEquality(immDict);


            var iq = ImmutableQueue.Create(1, 2, 3, rngInt, 5, 6, 7);

            TestDeepEquality(iq);

            var istack = ImmutableStack.Create(1, 23, rngInt, 2, 4, 5, 22);

            TestDeepEquality(istack);

            var ihs = ImmutableHashSet.Create(5, 5, 5, 5, 5, 5, rngInt, rngInt, 1, 2, 3, 4, 5, 6, 7, 8, 9);

            TestDeepEquality(ihs);


            var dict = new ReadOnlyDictionary <string, string>(new Dictionary <string, string>
            {
                ["a"]        = "val a",
                ["asdasdsa"] = "val b",
                ["123"]      = "val c",
            });

            TestDeepEquality(dict);
        }
Esempio n. 7
0
        private static async Task ImportPostAsync(
            Post post,
            ZipArchive jekyllArchive,
            bool doImages)
        {
            Console.WriteLine($"  Processing {post.PostPath}...");

            var assetBundles = from a in post.Assets
                               let task = a.GetBytesAsync()
                                          orderby a.FilePath descending
                                          select new { Task = task, Asset = a };
            var assetStack = doImages
                ? ImmutableStack.Create(assetBundles.ToArray())
                : ImmutableStack.Create(assetBundles.Take(0).ToArray());

            await WriteToArchiveAsync(jekyllArchive, post.PostPath, post.ContentWithFrontMatter);

            while (!assetStack.IsEmpty)
            {
                var bundle  = assetStack.Peek();
                var content = await bundle.Task;

                var asset = bundle.Asset;

                Console.WriteLine($"    Writing {asset.SourceUri}...");
                await WriteToArchiveAsync(jekyllArchive, asset.FilePath, content);

                assetStack = assetStack.Pop();
            }

            if (post.Comments.Any())
            {
                foreach (var comment in post.Comments)
                {
                    Console.WriteLine($"    Writing comment {comment.Id}");
                    await WriteToArchiveAsync(
                        jekyllArchive,
                        $"{post.CommentsRoot}/{comment.Id}.yaml",
                        comment.AsYaml());
                }
            }
        }
Esempio n. 8
0
        public void TestSimpleOperation()
        {
            var stack = ImmutableStack.Create <int> ();

            stack = stack.Push(1);
            stack = stack.Push(2);
            stack = stack.Push(3);

            Assert.AreEqual(3, stack.Peek());
            stack = stack.Pop();
            Assert.IsFalse(stack.IsEmpty);

            Assert.AreEqual(2, stack.Peek());
            stack = stack.Pop();
            Assert.IsFalse(stack.IsEmpty);

            Assert.AreEqual(1, stack.Peek());
            stack = stack.Pop();
            Assert.IsTrue(stack.IsEmpty);
        }
        public void Create()
        {
            ImmutableStack <int> stack = ImmutableStack.Create <int>();

            Assert.True(stack.IsEmpty);

            stack = ImmutableStack.Create(1);
            Assert.False(stack.IsEmpty);
            Assert.Equal(new[] { 1 }, stack);

            stack = ImmutableStack.Create(1, 2);
            Assert.False(stack.IsEmpty);
            Assert.Equal(new[] { 2, 1 }, stack);

            stack = ImmutableStack.CreateRange((IEnumerable <int>) new[] { 1, 2 });
            Assert.False(stack.IsEmpty);
            Assert.Equal(new[] { 2, 1 }, stack);

            Assert.Throws <ArgumentNullException>("items", () => ImmutableStack.CreateRange((IEnumerable <int>)null));
            Assert.Throws <ArgumentNullException>("items", () => ImmutableStack.Create((int[])null));
        }
Esempio n. 10
0
        public void Create()
        {
            ImmutableStack <int> queue = ImmutableStack.Create <int>();

            Assert.True(queue.IsEmpty);

            queue = ImmutableStack.Create(1);
            Assert.False(queue.IsEmpty);
            Assert.Equal(new[] { 1 }, queue);

            queue = ImmutableStack.Create(1, 2);
            Assert.False(queue.IsEmpty);
            Assert.Equal(new[] { 2, 1 }, queue);

            queue = ImmutableStack.CreateRange((IEnumerable <int>) new[] { 1, 2 });
            Assert.False(queue.IsEmpty);
            Assert.Equal(new[] { 2, 1 }, queue);

            Assert.Throws <ArgumentNullException>(() => ImmutableStack.CreateRange((IEnumerable <int>)null));
            Assert.Throws <ArgumentNullException>(() => ImmutableStack.Create((int[])null));
        }
Esempio n. 11
0
        public void MergeSingle()
        {
            var sources = new[]
            {
                CreateDummyNode(0), CreateDummyNode(1),
            };

            var value1 = SymbolicValue <DummyInstruction> .CreateStackValue(sources[0]);

            var stack1 = ImmutableStack.Create(value1);

            var value2 = SymbolicValue <DummyInstruction> .CreateStackValue(sources[1]);

            var stack2 = ImmutableStack.Create(value2);

            var state1 = new SymbolicProgramState <DummyInstruction>(0, stack1);
            var state2 = new SymbolicProgramState <DummyInstruction>(0, stack2);

            Assert.True(state1.MergeStates(state2, out var newState));
            Assert.Equal(new HashSet <DataFlowNode <DummyInstruction> >(sources), newState.Stack.Peek().GetNodes());
        }
Esempio n. 12
0
        /// <summary>
        /// Process all the blocks and determine if their first instruction is reachable,
        /// that is if they have "head reachability".
        ///
        /// "Tail reachability" will have already been determined in CreateBlocks.
        /// </summary>
        private void DetermineHeadReachability(ImmutableArray <BasicBlock> blocks)
        {
            var blockLookup = blocks.ToImmutableDictionary(b => b.StartOffset);

            var headBlock = blockLookup[0];

            var knownLive = ImmutableStack.Create(headBlock);

            while (!knownLive.IsEmpty)
            {
                knownLive = knownLive.Pop(out var block);

                if (block.HeadReachable)
                {
                    // already seen this block
                    continue;
                }

                // we can reach this block, clearly
                block.HeadReachable = true;

                if (block.TailReachable)
                {
                    // we can reach all the blocks it might flow to
                    foreach (var reachableOffset in block.BranchesTo)
                    {
                        var reachableBlock = blockLookup[reachableOffset];
                        knownLive = knownLive.Push(reachableBlock);
                    }
                }

                // if the block is covered by an exception handler, then executing _any_ instruction in it
                //   could conceivably cause those handlers to be visited
                foreach (var exceptionHandlerOffset in block.ExceptionBranchesTo)
                {
                    var reachableHandler = blockLookup[exceptionHandlerOffset];
                    knownLive = knownLive.Push(reachableHandler);
                }
            }
        }
Esempio n. 13
0
        public void EnumeratorTest()
        {
            this.EnumeratorTestHelper(new GenericParameterHelper(1), new GenericParameterHelper(2));
            this.EnumeratorTestHelper <GenericParameterHelper>();

            this.EnumeratorTestHelper(1, 2);
            this.EnumeratorTestHelper <int>();

            var stack            = ImmutableStack.Create <int>(5);
            var enumeratorStruct = stack.GetEnumerator();

            Assert.Throws <InvalidOperationException>(() => enumeratorStruct.Current);
            Assert.True(enumeratorStruct.MoveNext());
            Assert.Equal(5, enumeratorStruct.Current);
            Assert.False(enumeratorStruct.MoveNext());
            Assert.Throws <InvalidOperationException>(() => enumeratorStruct.Current);
            Assert.False(enumeratorStruct.MoveNext());

            var enumerator = ((IEnumerable <int>)stack).GetEnumerator();

            Assert.Throws <InvalidOperationException>(() => enumerator.Current);
            Assert.True(enumerator.MoveNext());
            Assert.Equal(5, enumerator.Current);
            Assert.False(enumerator.MoveNext());
            Assert.Throws <InvalidOperationException>(() => enumerator.Current);
            Assert.False(enumerator.MoveNext());

            enumerator.Reset();
            Assert.Throws <InvalidOperationException>(() => enumerator.Current);
            Assert.True(enumerator.MoveNext());
            Assert.Equal(5, enumerator.Current);
            Assert.False(enumerator.MoveNext());
            enumerator.Dispose();

            Assert.Throws <ObjectDisposedException>(() => enumerator.Reset());
            Assert.Throws <ObjectDisposedException>(() => enumerator.MoveNext());
            Assert.Throws <ObjectDisposedException>(() => enumerator.Current);
        }
Esempio n. 14
0
        public (List <MethodAction>, JavaState) Unconst()
        {
            var actions   = new List <MethodAction>();
            var newStack  = new List <JavaValue>();
            var newLocals = new Dictionary <int, JavaValue>();

            foreach (var st in _stack.Reverse())
            {
                if (st?.IsConst == true)
                {
                    var v = new CalculatedValue(st.ActualType);
                    actions.Add(new ConstantSetAction(v, st));
                    newStack.Add(v);
                }
                else
                {
                    newStack.Add(st);
                }
            }

            foreach (var(key, value) in _locals)
            {
                if (value?.IsConst == true)
                {
                    var v = new CalculatedValue(value.ActualType);
                    actions.Add(new ConstantSetAction(v, value));
                    newLocals.Add(key, v);
                }
                else
                {
                    newLocals.Add(key, value);
                }
            }

            return(actions,
                   new JavaState(ImmutableStack.Create(newStack.ToArray()), newLocals.ToImmutableDictionary()));
        }
Esempio n. 15
0
        private void BuildCurrentBlockConnectivityCache()
        {
            // Possible optimization: build this list incrementally by reusing previous state results?
            // this could become quite complex though
            connectivityToCurrentBlock.Clear();

            // Build list of all paths between start and current block
            var paths = new List <ImmutableStack <ExecutionBlock> >();

            FindAllPaths(paths, ImmutableStack.Create(functionStartBlock), functionStartBlock, CurrentBlock);

            // Let's check which blocks are reached, and if yes, are they reached in all paths
            var reachedBlockCounts = new Dictionary <ExecutionBlock, int>();

            foreach (var path in paths)
            {
                foreach (var block in path)
                {
                    int count;
                    if (reachedBlockCounts.TryGetValue(block, out count))
                    {
                        reachedBlockCounts[block] = count + 1;
                    }
                    else
                    {
                        reachedBlockCounts.Add(block, 1);
                    }
                }
            }

            foreach (var reachedBlockCount in reachedBlockCounts)
            {
                // Reached once per path => this is always executed before current block
                // If less than once per path => this is reached but not in all cases
                connectivityToCurrentBlock[reachedBlockCount.Key] = (reachedBlockCount.Value == paths.Count) ? ExecutionBlockLinkState.Always : ExecutionBlockLinkState.Sometimes;
            }
        }
Esempio n. 16
0
        private static int Main(string[] args)
        {
            MSBuildLocator.RegisterDefaults();

            // Force System.Collections.Immutable to be deployed
            ImmutableStack.Create <int>();

            if (args.Length != 3)
            {
                Console.WriteLine("Arguments: <project file> <output directory>");
                return(1);
            }
            try
            {
                ProcessSnippets(args[0], args[1], args[2]).GetAwaiter().GetResult();
                return(0);
            }
            catch (AggregateException e)
            {
                Console.WriteLine($"Error: {e.InnerException}");
                return(1);
            }
            catch (ReflectionTypeLoadException e)
            {
                Console.WriteLine($"Error: {e}");
                foreach (var ex in e.LoaderExceptions)
                {
                    Console.WriteLine($"Loader error: {ex}");
                }
                return(1);
            }
            catch (Exception e)
            {
                Console.WriteLine($"Error: {e}");
                return(1);
            }
        }
Esempio n. 17
0
        private static IEnumerable <object> GetImmutableCollectionsData()
        {
            var data = new[] { 1, 2, 3 };
            var immutableDataGenerators = new Func <IEnumerable <int> >[]
            {
                () => ImmutableArray.Create(data),
                () => ImmutableList.Create(data),
                () => ImmutableQueue.Create(data),
                () => ImmutableStack.Create(data.Reverse().ToArray()),
                () => new List <int>(data),
                () => data
            };

            for (var i = 0; i < immutableDataGenerators.Length; i++)
            {
                for (var j = i; j < immutableDataGenerators.Length; j++)
                {
                    var x = immutableDataGenerators[i]();
                    var y = immutableDataGenerators[j]();

                    yield return(new object[] { x, y });
                }
            }
        }
        /// <summary>
        /// Creates a cross-reference in the storage, which points to the stack of <see cref="AmbientDbContext"/>
        /// in the ConditionalWeakTable.
        /// </summary>
        private void Initialize()
        {
#if NET451
            var crossReferenceKey = _storage.GetValue <ContextualStorageItem>(AmbientDbContextStorageKey.Key);
#else
            var crossReferenceKey = _storage.GetValue <string>(AmbientDbContextStorageKey.Key);
#endif

            if (crossReferenceKey == null)
            {
#if NET451
                crossReferenceKey = new ContextualStorageItem(Guid.NewGuid().ToString("N"));
#else
                crossReferenceKey = Guid.NewGuid().ToString("N");
#endif
                _storage.SetValue(AmbientDbContextStorageKey.Key, crossReferenceKey);

#if NET451
                AmbientDbContextTable.Add(crossReferenceKey.Value, ImmutableStack.Create <IAmbientDbContext>());
#else
                AmbientDbContextTable.Add(crossReferenceKey, ImmutableStack.Create <IAmbientDbContext>());
#endif
            }
        }
Esempio n. 19
0
        public void TestPeekEx()
        {
            var s = ImmutableStack.Create <int> ();

            s.Peek();
        }
Esempio n. 20
0
 public void DebuggerAttributesValid()
 {
     DebuggerAttributes.ValidateDebuggerDisplayReferences(ImmutableStack.Create <int>());
     DebuggerAttributes.ValidateDebuggerTypeProxyProperties(ImmutableStack.Create <string>("1", "2", "3"));
 }
Esempio n. 21
0
 public override SimultaneousInjectFrame InjectWild <T>(T dependency)
 => injectSimul_internal(ImmutableStack.Create <Type>(), dependency, typeof(T), isWildcard: true);
Esempio n. 22
0
 public static XamlScope Create() => new XamlScope(ImmutableStack.Create <ManagedWeakReference>());
Esempio n. 23
0
        public static CompositionConfiguration Create(ComposableCatalog catalog)
        {
            Requires.NotNull(catalog, nameof(catalog));

            // We consider all the parts in the catalog, plus the specially synthesized ones
            // that should always be applied.
            var customizedCatalog = catalog.AddParts(AlwaysBundledParts);

            // Construct our part builders, initialized with all their imports satisfied.
            // We explicitly use reference equality because ComposablePartDefinition.Equals is too slow, and unnecessary for this.
            var partBuilders = new Dictionary <ComposablePartDefinition, PartBuilder>(ReferenceEquality <ComposablePartDefinition> .Default);

            foreach (ComposablePartDefinition partDefinition in customizedCatalog.Parts)
            {
                var satisfyingImports = partDefinition.Imports.ToImmutableDictionary(i => i, i => customizedCatalog.GetExports(i.ImportDefinition));
                partBuilders.Add(partDefinition, new PartBuilder(partDefinition, satisfyingImports));
            }

            // Create a lookup table that gets all immediate importers for each part.
            foreach (PartBuilder partBuilder in partBuilders.Values)
            {
                // We want to understand who imports each part so we can properly propagate sharing boundaries
                // for MEFv1 attributed parts. ExportFactory's that create sharing boundaries are an exception
                // because if a part has a factory that creates new sharing boundaries, the requirement for
                // that sharing boundary of the child scope shouldn't be interpreted as a requirement for that
                // same boundary by the parent part.
                // However, if the ExportFactory does not create sharing boundaries, it does in fact need all
                // the same sharing boundaries as the parts it constructs.
                var importedPartsExcludingFactoriesWithSharingBoundaries =
                    (from entry in partBuilder.SatisfyingExports
                     where !entry.Key.IsExportFactory || entry.Key.ImportDefinition.ExportFactorySharingBoundaries.Count == 0
                     from export in entry.Value
                     select export.PartDefinition).Distinct(ReferenceEquality <ComposablePartDefinition> .Default);
                foreach (var importedPartDefinition in importedPartsExcludingFactoriesWithSharingBoundaries)
                {
                    var importedPartBuilder = partBuilders[importedPartDefinition];
                    importedPartBuilder.ReportImportingPart(partBuilder);
                }
            }

            // Propagate sharing boundaries defined on parts to all importers (transitive closure).
            foreach (PartBuilder partBuilder in partBuilders.Values)
            {
                partBuilder.ApplySharingBoundary();
            }

            var sharingBoundaryOverrides = ComputeInferredSharingBoundaries(partBuilders.Values);

            // Build up our set of composed parts.
            var partsBuilder = ImmutableHashSet.CreateBuilder <ComposedPart>();

            foreach (var partBuilder in partBuilders.Values)
            {
                var composedPart = new ComposedPart(partBuilder.PartDefinition, partBuilder.SatisfyingExports, partBuilder.RequiredSharingBoundaries.ToImmutableHashSet());
                partsBuilder.Add(composedPart);
            }

            var parts = partsBuilder.ToImmutable();

            // Determine which metadata views to use for each applicable import.
            var metadataViewsAndProviders = GetMetadataViewProvidersMap(customizedCatalog);

            // Validate configuration.
            var errors = new List <ComposedPartDiagnostic>();

            foreach (var part in parts)
            {
                errors.AddRange(part.Validate(metadataViewsAndProviders));
            }

            // Detect loops of all non-shared parts.
            errors.AddRange(FindLoops(parts));

            // If errors are found, re-validate the salvaged parts in case there are parts whose dependencies are affected by the initial errors
            if (errors.Count > 0)
            {
                // Set salvaged parts to current catalog in case there are no errors
                var salvagedParts           = parts;
                var salvagedPartDefinitions = catalog.Parts;

                List <ComposedPartDiagnostic> previousErrors = errors;
                Stack <IReadOnlyCollection <ComposedPartDiagnostic> > stackedErrors = new Stack <IReadOnlyCollection <ComposedPartDiagnostic> >();

                // While we still find errors we validate the exports so that we remove all dependency failures
                while (previousErrors.Count > 0)
                {
                    stackedErrors.Push(previousErrors);

                    // Get the salvaged parts
                    var invalidParts = previousErrors.SelectMany(error => error.Parts).ToList();

                    if (invalidParts.Count == 0)
                    {
                        // If we can't identify the faulty parts but we still have errors, we have to just throw.
                        throw new CompositionFailedException(Strings.FailStableComposition, ImmutableStack.Create <IReadOnlyCollection <ComposedPartDiagnostic> >(errors));
                    }

                    salvagedParts = salvagedParts.Except(invalidParts);
                    var invalidPartDefinitionsSet = new HashSet <ComposablePartDefinition>(invalidParts.Select(p => p.Definition));
                    salvagedPartDefinitions = salvagedPartDefinitions.Except(invalidPartDefinitionsSet);

                    // Empty the list so that we create a new one only with the new set of errors
                    previousErrors = new List <ComposedPartDiagnostic>();

                    foreach (var part in salvagedParts)
                    {
                        previousErrors.AddRange(part.RemoveSatisfyingExports(invalidPartDefinitionsSet));
                    }
                }

                var finalCatalog = ComposableCatalog.Create(catalog.Resolver).AddParts(salvagedPartDefinitions);

                // We want the first found errors to come out of the stack first, so we need to invert the current stack.
                var compositionErrors = ImmutableStack.CreateRange(stackedErrors);

                var configuration = new CompositionConfiguration(
                    finalCatalog,
                    salvagedParts,
                    metadataViewsAndProviders,
                    compositionErrors,
                    sharingBoundaryOverrides);

                return(configuration);
            }

            return(new CompositionConfiguration(
                       catalog,
                       parts,
                       metadataViewsAndProviders,
                       ImmutableStack <IReadOnlyCollection <ComposedPartDiagnostic> > .Empty,
                       sharingBoundaryOverrides));
        }
 public FluentAssertionsCSharpSyntaxVisitor(params MemberValidator[] members)
 {
     AllMembers = ImmutableStack.Create(members);
     Members    = AllMembers;
 }
 /// <summary>
 /// Create an immutable stack
 /// </summary>
 public static IImmutableStack <T> stack <T>(T item) =>
 ImmutableStack.Create <T>();
Esempio n. 26
0
        public static IGremlinQueryEnvironment UseGremlinServer(this IGremlinQueryEnvironment environment,
                                                                Func <IWebSocketGremlinQueryExecutorBuilder, IWebSocketGremlinQueryExecutorBuilder> builderAction)
        {
            return(environment
                   .UseWebSocket(builderAction)
                   .ConfigureFeatureSet(featureSet => featureSet
                                        .ConfigureGraphFeatures(graphFeatures => graphFeatures & ~(GraphFeatures.Transactions | GraphFeatures.ThreadedTransactions | GraphFeatures.ConcurrentAccess))
                                        .ConfigureVertexFeatures(vertexFeatures => vertexFeatures & ~(VertexFeatures.Upsert | VertexFeatures.CustomIds))
                                        .ConfigureVertexPropertyFeatures(vPropertiesFeatures => vPropertiesFeatures & ~(VertexPropertyFeatures.CustomIds))
                                        .ConfigureEdgeFeatures(edgeProperties => edgeProperties & ~(EdgeFeatures.Upsert | EdgeFeatures.CustomIds)))
                   .ConfigureSerializer(s => s
                                        .ConfigureFragmentSerializer(fragmentSerializer => fragmentSerializer
                                                                     .Override <IGremlinQueryBase>((query, env, overridden, recurse) =>
            {
                if (env.Options.GetValue(GremlinServerGremlinqOptions.WorkaroundTinkerpop2112))
                {
                    query = query.AsAdmin().ConfigureSteps <IGremlinQueryBase>(steps => ImmutableStack.Create(steps.Reverse().WorkaroundTINKERPOP_2112().ToArray()));
                }

                return overridden(query, env, recurse);
            }))));
        }
 public MemberMetadataInfo()
 {
     Kind      = MemberKind.Type;
     Names     = new List <string>();
     Modifiers = ImmutableStack.Create <MemberModifiedMetadata>();
 }
 /// <summary>
 /// Create an immutable stack
 /// </summary>
 public static IImmutableStack <T> stack <T>(params T[] items) =>
 ImmutableStack.Create <T>(items);
Esempio n. 29
0
        public void TestPopEx()
        {
            var s = ImmutableStack.Create <int> ();

            s.Pop();
        }
Esempio n. 30
0
 public ParserEnvironment()
     : this(ImmutableStack.Create(new Scope()))
 {
 }