src\Dependencies\Collections\RoslynImmutableInterlocked.cs (26)
33public static bool Update<T>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, ImmutableSegmentedList<T>> transformer)
38var oldValue = ImmutableSegmentedList<T>.PrivateMarshal.VolatileRead(in location);
41var newValue = transformer(oldValue);
48var interlockedResult = InterlockedCompareExchange(ref location, newValue, oldValue);
74public static bool Update<T, TArg>(ref ImmutableSegmentedList<T> location, Func<ImmutableSegmentedList<T>, TArg, ImmutableSegmentedList<T>> transformer, TArg transformerArgument)
79var oldValue = ImmutableSegmentedList<T>.PrivateMarshal.VolatileRead(in location);
82var newValue = transformer(oldValue, transformerArgument);
89var interlockedResult = InterlockedCompareExchange(ref location, newValue, oldValue);
105public static ImmutableSegmentedList<T> InterlockedExchange<T>(ref ImmutableSegmentedList<T> location, ImmutableSegmentedList<T> value)
107return ImmutableSegmentedList<T>.PrivateMarshal.InterlockedExchange(ref location, value);
119public static ImmutableSegmentedList<T> InterlockedCompareExchange<T>(ref ImmutableSegmentedList<T> location, ImmutableSegmentedList<T> value, ImmutableSegmentedList<T> comparand)
121return ImmutableSegmentedList<T>.PrivateMarshal.InterlockedCompareExchange(ref location, value, comparand);
133public static bool InterlockedInitialize<T>(ref ImmutableSegmentedList<T> location, ImmutableSegmentedList<T> value)
135return InterlockedCompareExchange(ref location, value, default(ImmutableSegmentedList<T>)).IsDefault;
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1.cs (61)
20/// <para>There are different scenarios best for <see cref="ImmutableSegmentedList{T}"/> and others
24/// <see cref="ImmutableSegmentedList{T}"/>:</para>
29/// <description><see cref="ImmutableSegmentedList{T}"/> Complexity</description>
73internal readonly partial struct ImmutableSegmentedList<T> : IImmutableList<T>, IReadOnlyList<T>, IList<T>, IList, IEquatable<ImmutableSegmentedList<T>>
76public static readonly ImmutableSegmentedList<T> Empty = new(new SegmentedList<T>());
114public static bool operator ==(ImmutableSegmentedList<T> left, ImmutableSegmentedList<T> right)
117public static bool operator !=(ImmutableSegmentedList<T> left, ImmutableSegmentedList<T> right)
120public static bool operator ==(ImmutableSegmentedList<T>? left, ImmutableSegmentedList<T>? right)
123public static bool operator !=(ImmutableSegmentedList<T>? left, ImmutableSegmentedList<T>? right)
129var self = this;
141public ImmutableSegmentedList<T> Add(T value)
143var self = this;
161public ImmutableSegmentedList<T> AddRange(IEnumerable<T> items)
163var self = this;
171if (items is ImmutableSegmentedList<T> immutableList)
173else if (items is ImmutableSegmentedList<T>.Builder builder)
201public ImmutableSegmentedList<T> Clear()
208public ImmutableSegmentedList<TOutput> ConvertAll<TOutput>(Converter<T, TOutput> converter)
231public ImmutableSegmentedList<T> FindAll(Predicate<T> match)
257var self = this;
272var self = this;
293public ImmutableSegmentedList<T> GetRange(int index, int count)
295var self = this;
310public ImmutableSegmentedList<T> Insert(int index, T item)
312var self = this;
325public ImmutableSegmentedList<T> InsertRange(int index, IEnumerable<T> items)
327var self = this;
341var self = this;
361public ImmutableSegmentedList<T> Remove(T value)
363var self = this;
373public ImmutableSegmentedList<T> Remove(T value, IEqualityComparer<T>? equalityComparer)
375var self = this;
385public ImmutableSegmentedList<T> RemoveAll(Predicate<T> match)
395public ImmutableSegmentedList<T> RemoveAt(int index)
404public ImmutableSegmentedList<T> RemoveRange(IEnumerable<T> items)
409var self = this;
428public ImmutableSegmentedList<T> RemoveRange(IEnumerable<T> items, IEqualityComparer<T>? equalityComparer)
433var self = this;
452public ImmutableSegmentedList<T> RemoveRange(int index, int count)
454var self = this;
468public ImmutableSegmentedList<T> Replace(T oldValue, T newValue)
470var self = this;
482public ImmutableSegmentedList<T> Replace(T oldValue, T newValue, IEqualityComparer<T>? equalityComparer)
484var self = this;
496public ImmutableSegmentedList<T> Reverse()
498var self = this;
508public ImmutableSegmentedList<T> Reverse(int index, int count)
516public ImmutableSegmentedList<T> SetItem(int index, T value)
525public ImmutableSegmentedList<T> Sort()
527var self = this;
539public ImmutableSegmentedList<T> Sort(IComparer<T>? comparer)
541var self = this;
553public ImmutableSegmentedList<T> Sort(Comparison<T> comparison)
560var self = this;
572public ImmutableSegmentedList<T> Sort(int index, int count, IComparer<T>? comparer)
592return obj is ImmutableSegmentedList<T> other
596public bool Equals(ImmutableSegmentedList<T> other)
src\Dependencies\Collections\Segmented\ImmutableSegmentedListExtensions.cs (9)
17public static bool All<T>(this ImmutableSegmentedList<T> immutableList, Func<T, bool> predicate)
33public static bool Any<T>(this ImmutableSegmentedList<T> immutableList)
41public static bool Any<T>(this ImmutableSegmentedList<T>.Builder builder)
49public static bool Any<T>(this ImmutableSegmentedList<T> immutableList, Func<T, bool> predicate)
65public static T Last<T>(this ImmutableSegmentedList<T> immutableList)
74public static T Last<T>(this ImmutableSegmentedList<T>.Builder builder)
86public static T Last<T>(this ImmutableSegmentedList<T> immutableList, Func<T, bool> predicate)
103public static IEnumerable<TResult> Select<T, TResult>(this ImmutableSegmentedList<T> immutableList, Func<T, TResult> selector)
120public static int BinarySearch<TElement, TValue>(this ImmutableSegmentedList<TElement> array, TValue value, Func<TElement, TValue, int> comparer)
src\Dependencies\Threading\AsyncBatchingWorkQueue`1.cs (4)
19Func<ImmutableSegmentedList<TItem>, CancellationToken, ValueTask> processBatchAsync,
26Func<ImmutableSegmentedList<TItem>, CancellationToken, ValueTask> processBatchAsync,
37private static Func<ImmutableSegmentedList<TItem>, CancellationToken, ValueTask<VoidResult>> Convert(Func<ImmutableSegmentedList<TItem>, CancellationToken, ValueTask> processBatchAsync)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (4)
191protected static int ConvertTextAtIndexToRune(string tokenText, int index, ImmutableSegmentedList<VirtualChar>.Builder result, int offset)
194protected static int ConvertTextAtIndexToRune(SourceText tokenText, int index, ImmutableSegmentedList<VirtualChar>.Builder result, int offset)
198T tokenText, int index, TTextInfo info, ImmutableSegmentedList<VirtualChar>.Builder result, int offset)
231ImmutableSegmentedList<VirtualChar>.Builder result)