4 instantiations of TemporaryArray
Microsoft.CodeAnalysis (2)
src\Dependencies\Collections\TemporaryArray`1.cs (2)
99return new TemporaryArray<T>() 456_array = new TemporaryArray<T>(in array);
Microsoft.CodeAnalysis.CSharp (1)
Lowering\SyntheticBoundNodeFactory.cs (1)
537var statements = new TemporaryArray<BoundStatement>();
Microsoft.CodeAnalysis.UnitTests (1)
Collections\TemporaryArrayTests.cs (1)
21Assert.Equal(0, new TemporaryArray<int>().Count);
133 references to TemporaryArray
Microsoft.CodeAnalysis (35)
Collections\TopologicalSort.cs (6)
14internal delegate void TopologicalSortAddSuccessors<TNode>(ref TemporaryArray<TNode> builder, TNode node); 38/// <param name="addSuccessors">A function that adds successor nodes to a provided <see cref="TemporaryArray{TNode}"/>.</param> 50using var successors = TemporaryArray<TNode>.Empty; 105using var successors = TemporaryArray<TNode>.Empty;
Compilation\Compilation.cs (2)
3822using var builder = TemporaryArray<AssemblyIdentity>.Empty;
DiagnosticAnalyzer\AnalyzerDriver.cs (2)
1137using var builder = TemporaryArray<Diagnostic>.Empty;
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (1)
782internal static ImmutableArray<T> AddRange<T>(this ImmutableArray<T> self, in TemporaryArray<T> items)
src\Dependencies\Collections\TemporaryArray`1.cs (11)
79/// This field is initialized to non-<see langword="null"/> the first time the <see cref="TemporaryArray{T}"/> 85private TemporaryArray(in TemporaryArray<T> array) 93public static TemporaryArray<T> GetInstance(int capacity) 105public static TemporaryArray<T> Empty => default; 201public void AddRange(in TemporaryArray<T> items) 329/// Transitions the current <see cref="TemporaryArray{T}"/> from inline storage to dynamic storage storage. An 448private readonly TemporaryArray<T> _array; 453public Enumerator(in TemporaryArray<T> array) 480public static int InlineCapacity => TemporaryArray<T>.InlineCapacity; 482public static bool HasDynamicStorage(in TemporaryArray<T> array) 485public static int InlineCount(in TemporaryArray<T> array)
src\Dependencies\Collections\TemporaryArrayExtensions.cs (13)
16/// Gets a mutable reference to a <see cref="TemporaryArray{T}"/> stored in a <c>using</c> variable. 19/// <para>This supporting method allows <see cref="TemporaryArray{T}"/>, a non-copyable <see langword="struct"/> 40public static ref TemporaryArray<T> AsRef<T>(this in TemporaryArray<T> array) 45public static bool Any<T>(this in TemporaryArray<T> array, Func<T, bool> predicate) 56public static bool All<T>(this in TemporaryArray<T> array, Func<T, bool> predicate) 70public static T? SingleOrDefault<T>(this in TemporaryArray<T> array, Func<T, bool> predicate) 91public static T? SingleOrDefault<T, TArg>(this in TemporaryArray<T> array, Func<T, TArg, bool> predicate, TArg arg) 112public static T? FirstOrDefault<T>(this in TemporaryArray<T> array) 115public static T? FirstOrDefault<T, TArg>(this in TemporaryArray<T> array, Func<T, TArg, bool> predicate, TArg arg) 126public static int IndexOf<T, TArg>(this in TemporaryArray<T> array, Func<T, TArg, bool> predicate, TArg arg) 140public static void AddIfNotNull<T>(this ref TemporaryArray<T> array, T? value) 149public static void AddIfNotNull<T>(this ref TemporaryArray<T> array, T? value)
Microsoft.CodeAnalysis.CSharp (38)
Binder\DecisionDagBuilder.cs (11)
135using var builder = TemporaryArray<StateForCase>.Empty; 148using var builder = TemporaryArray<StateForCase>.GetInstance(switchSections.Length); 173using var builder = TemporaryArray<StateForCase>.GetInstance(switchArms.Length); 737private BoundDecisionDag MakeBoundDecisionDag(SyntaxNode syntax, ref TemporaryArray<StateForCase> cases) 814ref TemporaryArray<StateForCase> casesForRootNode, 820using var workList = TemporaryArray<DagState>.Empty; 1627private static void AddSuccessor(ref TemporaryArray<DagState> builder, DagState state)
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (4)
1401using var uninst1 = TemporaryArray<TypeSymbol>.Empty; 1402using var uninst2 = TemporaryArray<TypeSymbol>.Empty;
Binder\Semantics\OverloadResolution\OverloadResolution.cs (10)
2485using (var uninst1 = TemporaryArray<TypeSymbol>.Empty) 2486using (var uninst2 = TemporaryArray<TypeSymbol>.Empty) 2733private static BetterResult MoreSpecificType(ref TemporaryArray<TypeSymbol> t1, ref TemporaryArray<TypeSymbol> t2, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo) 2842using var allTypeArgs1 = TemporaryArray<TypeSymbol>.Empty; 2843using var allTypeArgs2 = TemporaryArray<TypeSymbol>.Empty;
Binder\SwitchExpressionBinder.cs (1)
111static void addNonNullSuccessors(ref TemporaryArray<BoundDecisionDagNode> builder, BoundDecisionDagNode n)
BoundTree\BoundDecisionDag.cs (1)
24internal static void AddSuccessors(ref TemporaryArray<BoundDecisionDagNode> builder, BoundDecisionDagNode node)
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (1)
237public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
Lowering\Instrumentation\CompoundInstrumenter.cs (1)
89public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
Lowering\Instrumentation\DebugInfoInjector.cs (1)
186public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
Lowering\Instrumentation\Instrumenter.cs (1)
74public virtual void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (1)
284public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
Lowering\Instrumentation\ModuleCancellationInstrumenter.cs (1)
67public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
Lowering\Instrumentation\StackOverflowProbingInstrumenter.cs (1)
57public override void InstrumentBlock(BoundBlock original, LocalRewriter rewriter, ref TemporaryArray<LocalSymbol> additionalLocals, out BoundStatement? prologue, out BoundStatement? epilogue, out BoundBlockInstrumentation? instrumentation)
Lowering\LocalRewriter\LocalRewriter_Block.cs (2)
35var additionalLocals = TemporaryArray<LocalSymbol>.Empty;
Lowering\SyntheticBoundNodeFactory.cs (1)
537var statements = new TemporaryArray<BoundStatement>();
Symbols\NamedTypeSymbol.cs (1)
1280internal void GetAllTypeArguments(ref TemporaryArray<TypeSymbol> builder, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
Microsoft.CodeAnalysis.UnitTests (60)
Collections\TemporaryArrayTests.cs (57)
19Assert.Equal(0, TemporaryArray<int>.Empty.Count); 20Assert.Equal(0, default(TemporaryArray<int>).Count); 23Assert.Throws<IndexOutOfRangeException>(() => TemporaryArray<int>.Empty[-1]); 26using var array = TemporaryArray<int>.Empty; 30Assert.Throws<IndexOutOfRangeException>(() => TemporaryArray<int>.Empty[0]); 33using var array = TemporaryArray<int>.Empty; 37Assert.False(TemporaryArray<int>.Empty.GetEnumerator().MoveNext()); 43using var array = TemporaryArray<int>.Empty; 44for (var i = 0; i < TemporaryArray<int>.TestAccessor.InlineCapacity; i++) 48Assert.False(TemporaryArray<int>.TestAccessor.HasDynamicStorage(in array)); 49Assert.Equal(i + 1, TemporaryArray<int>.TestAccessor.InlineCount(in array)); 53Assert.Equal(TemporaryArray<int>.TestAccessor.InlineCapacity, array.Count); 54Assert.False(TemporaryArray<int>.TestAccessor.HasDynamicStorage(in array)); 56Assert.True(TemporaryArray<int>.TestAccessor.HasDynamicStorage(in array)); 57Assert.Equal(0, TemporaryArray<int>.TestAccessor.InlineCount(in array)); 60Assert.Equal(TemporaryArray<int>.TestAccessor.InlineCapacity + 1, array.Count); 62Assert.True(TemporaryArray<int>.TestAccessor.HasDynamicStorage(in array)); 63Assert.Equal(0, TemporaryArray<int>.TestAccessor.InlineCount(in array)); 83Assert.Equal(0, TemporaryArray<int>.Empty.Count); 84TemporaryArray<int>.Empty.Add(0); 85Assert.Equal(0, TemporaryArray<int>.Empty.Count); 91var array = TemporaryArray<int>.Empty; 92array.AddRange(Enumerable.Range(0, TemporaryArray<int>.TestAccessor.InlineCapacity + 1).ToImmutableArray()); 93Assert.True(TemporaryArray<int>.TestAccessor.HasDynamicStorage(in array)); 96Assert.False(TemporaryArray<int>.TestAccessor.HasDynamicStorage(in array)); 103using var array = TemporaryArray<int>.Empty; 111if (array.Count > TemporaryArray<int>.TestAccessor.InlineCapacity) 113Assert.True(TemporaryArray<int>.TestAccessor.HasDynamicStorage(in array)); 114Assert.Equal(0, TemporaryArray<int>.TestAccessor.InlineCount(in array)); 118Assert.False(TemporaryArray<int>.TestAccessor.HasDynamicStorage(in array)); 119Assert.Equal(array.Count, TemporaryArray<int>.TestAccessor.InlineCount(in array)); 133using var array = TemporaryArray<int>.Empty; 145initialItems > TemporaryArray<int>.TestAccessor.InlineCapacity, 146TemporaryArray<int>.TestAccessor.HasDynamicStorage(in array)); 153using var array = TemporaryArray<int>.Empty; 173using var array = TemporaryArray<int>.Empty; 187initialItems > TemporaryArray<int>.TestAccessor.InlineCapacity, 188TemporaryArray<int>.TestAccessor.HasDynamicStorage(in array)); 195using var array = TemporaryArray<int>.Empty; 213for (int i = 0; i <= TemporaryArray<int>.TestAccessor.InlineCapacity + 1; i++) 225using var array = TemporaryArray<int>.Empty; 275using var array = TemporaryArray<int>.Empty; 295using var array = TemporaryArray<int>.Empty; 309using var array = TemporaryArray<int>.Empty;
Collections\TopologicalSortTests.cs (3)
22=> (ref TemporaryArray<T> builder, T value) => builder.AddRange(successors[toInt(value)].ToImmutableArray()); 215using var successors = TemporaryArray<T>.Empty;