Skip to content

Commit ec8e914

Browse files
Revert
1 parent 791b283 commit ec8e914

File tree

56 files changed

+801
-267
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+801
-267
lines changed

src/Compilers/CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@ public static void ComputeDeclarationsInNode(
4040
}
4141

4242
private static bool InvalidLevel(int? level)
43-
=> level.HasValue && level.Value <= 0;
43+
{
44+
return level.HasValue && level.Value <= 0;
45+
}
4446

4547
private static int? DecrementLevel(int? level)
46-
=> level.HasValue ? level - 1 : level;
48+
{
49+
return level.HasValue ? level - 1 : level;
50+
}
4751

4852
private static void ComputeDeclarations(
4953
SemanticModel model,

src/Compilers/CSharp/Portable/Syntax/LambdaUtilities.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ public static SyntaxNode GetNestedFunctionBody(SyntaxNode nestedFunction)
125125
};
126126

127127
public static bool IsNotLambdaBody(SyntaxNode node)
128-
=> !IsLambdaBody(node);
128+
{
129+
return !IsLambdaBody(node);
130+
}
129131

130132
/// <summary>
131133
/// Returns true if the specified <paramref name="node"/> represents a body of a lambda.
@@ -260,7 +262,9 @@ private static bool IsReducedSelectOrGroupByClause(SelectOrGroupClauseSyntax sel
260262
/// We define this function to minimize differences between C# and VB implementation.
261263
/// </remarks>
262264
public static bool IsLambdaBodyStatementOrExpression(SyntaxNode node)
263-
=> IsLambdaBody(node);
265+
{
266+
return IsLambdaBody(node);
267+
}
264268

265269
public static bool IsLambdaBodyStatementOrExpression(SyntaxNode node, out SyntaxNode lambdaBody)
266270
{
@@ -469,6 +473,8 @@ internal static int GetDeclaratorPosition(SyntaxNode node)
469473
}
470474

471475
private static SyntaxNode GetLocalFunctionBody(LocalFunctionStatementSyntax localFunctionStatementSyntax)
472-
=> (SyntaxNode)localFunctionStatementSyntax.Body ?? localFunctionStatementSyntax.ExpressionBody?.Expression;
476+
{
477+
return (SyntaxNode)localFunctionStatementSyntax.Body ?? localFunctionStatementSyntax.ExpressionBody?.Expression;
478+
}
473479
}
474480
}

src/Compilers/Core/AnalyzerDriver/DeclarationComputer.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,19 @@ internal static DeclarationInfo GetDeclarationInfo(SemanticModel model, SyntaxNo
2121
}
2222

2323
internal static DeclarationInfo GetDeclarationInfo(SemanticModel model, SyntaxNode node, bool getSymbol, CancellationToken cancellationToken)
24-
=> GetDeclarationInfo(model, node, getSymbol, (IEnumerable<SyntaxNode>)null, cancellationToken);
24+
{
25+
return GetDeclarationInfo(model, node, getSymbol, (IEnumerable<SyntaxNode>)null, cancellationToken);
26+
}
2527

2628
internal static DeclarationInfo GetDeclarationInfo(SemanticModel model, SyntaxNode node, bool getSymbol, SyntaxNode executableCodeBlock, CancellationToken cancellationToken)
27-
=> GetDeclarationInfo(model, node, getSymbol, SpecializedCollections.SingletonEnumerable(executableCodeBlock), cancellationToken);
29+
{
30+
return GetDeclarationInfo(model, node, getSymbol, SpecializedCollections.SingletonEnumerable(executableCodeBlock), cancellationToken);
31+
}
2832

2933
internal static DeclarationInfo GetDeclarationInfo(SemanticModel model, SyntaxNode node, bool getSymbol, CancellationToken cancellationToken, params SyntaxNode[] executableCodeBlocks)
30-
=> GetDeclarationInfo(model, node, getSymbol, executableCodeBlocks.AsEnumerable(), cancellationToken);
34+
{
35+
return GetDeclarationInfo(model, node, getSymbol, executableCodeBlocks.AsEnumerable(), cancellationToken);
36+
}
3137

3238
private static ISymbol GetDeclaredSymbol(SemanticModel model, SyntaxNode node, bool getSymbol, CancellationToken cancellationToken)
3339
{

src/Compilers/Core/Portable/Collections/ArrayBuilderExtensions.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ public static void AddOptional<T>(this ArrayBuilder<T> builder, T? item)
151151
// Note that the order of an IEnumerable from a List is from bottom to top of stack. An IEnumerable
152152
// from the framework Stack is from top to bottom.
153153
public static void Push<T>(this ArrayBuilder<T> builder, T e)
154-
=> builder.Add(e);
154+
{
155+
builder.Add(e);
156+
}
155157

156158
public static T Pop<T>(this ArrayBuilder<T> builder)
157159
{
@@ -161,10 +163,14 @@ public static T Pop<T>(this ArrayBuilder<T> builder)
161163
}
162164

163165
public static T Peek<T>(this ArrayBuilder<T> builder)
164-
=> builder[builder.Count - 1];
166+
{
167+
return builder[builder.Count - 1];
168+
}
165169

166170
public static ImmutableArray<T> ToImmutableOrEmptyAndFree<T>(this ArrayBuilder<T>? builder)
167-
=> builder?.ToImmutableAndFree() ?? ImmutableArray<T>.Empty;
171+
{
172+
return builder?.ToImmutableAndFree() ?? ImmutableArray<T>.Empty;
173+
}
168174

169175
public static void AddIfNotNull<T>(this ArrayBuilder<T> builder, T? value)
170176
where T : struct

src/Compilers/Core/Portable/Collections/BitVector.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,19 @@ public bool Equals(BitVector other)
5050
}
5151

5252
public override bool Equals(object? obj)
53-
=> obj is BitVector other && Equals(other);
53+
{
54+
return obj is BitVector other && Equals(other);
55+
}
5456

5557
public static bool operator ==(BitVector left, BitVector right)
56-
=> left.Equals(right);
58+
{
59+
return left.Equals(right);
60+
}
5761

5862
public static bool operator !=(BitVector left, BitVector right)
59-
=> !left.Equals(right);
63+
{
64+
return !left.Equals(right);
65+
}
6066

6167
public override int GetHashCode()
6268
{
@@ -84,7 +90,9 @@ private static int WordsForCapacity(int capacity)
8490

8591
[Conditional("DEBUG_BITARRAY")]
8692
private void Check()
87-
=> Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length);
93+
{
94+
Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length);
95+
}
8896

8997
public void EnsureCapacity(int newCapacity)
9098
{

src/Compilers/Core/Portable/Collections/Boxes.cs

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,29 @@ internal static class Boxes
2828
private static readonly object?[] s_boxedAsciiChars = new object?[128];
2929

3030
public static object Box(bool b)
31-
=> b ? BoxedTrue : BoxedFalse;
31+
{
32+
return b ? BoxedTrue : BoxedFalse;
33+
}
3234

3335
public static object Box(byte b)
34-
=> b == 0 ? BoxedByteZero : b;
36+
{
37+
return b == 0 ? BoxedByteZero : b;
38+
}
3539

3640
public static object Box(sbyte sb)
37-
=> sb == 0 ? BoxedSByteZero : sb;
41+
{
42+
return sb == 0 ? BoxedSByteZero : sb;
43+
}
3844

3945
public static object Box(short s)
40-
=> s == 0 ? BoxedInt16Zero : s;
46+
{
47+
return s == 0 ? BoxedInt16Zero : s;
48+
}
4149

4250
public static object Box(ushort us)
43-
=> us == 0 ? BoxedUInt16Zero : us;
51+
{
52+
return us == 0 ? BoxedUInt16Zero : us;
53+
}
4454

4555
public static object Box(int i)
4656
{
@@ -53,13 +63,19 @@ public static object Box(int i)
5363
}
5464

5565
public static object Box(uint u)
56-
=> u == 0 ? BoxedUInt32Zero : u;
66+
{
67+
return u == 0 ? BoxedUInt32Zero : u;
68+
}
5769

5870
public static object Box(long l)
59-
=> l == 0 ? BoxedInt64Zero : l;
71+
{
72+
return l == 0 ? BoxedInt64Zero : l;
73+
}
6074

6175
public static object Box(ulong ul)
62-
=> ul == 0 ? BoxedUInt64Zero : ul;
76+
{
77+
return ul == 0 ? BoxedUInt64Zero : ul;
78+
}
6379

6480
public static unsafe object Box(float f)
6581
{

src/Compilers/Core/Portable/Collections/ImmutableArrayExtensions.cs

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ internal static class ImmutableArrayExtensions
3232
/// <exception cref="ArgumentNullException">If items is null (default)</exception>
3333
/// <remarks>If the sequence is null, this will throw <see cref="ArgumentNullException"/></remarks>
3434
public static ImmutableArray<T> AsImmutable<T>(this IEnumerable<T> items)
35-
=> ImmutableArray.CreateRange<T>(items);
35+
{
36+
return ImmutableArray.CreateRange<T>(items);
37+
}
3638

3739
/// <summary>
3840
/// Converts a sequence to an immutable array.
@@ -119,7 +121,9 @@ public static ImmutableArray<T> AsImmutableOrEmpty<T>(this T[]? items)
119121
/// <param name="stream">The stream.</param>
120122
/// <returns>Read-only content of the stream.</returns>
121123
public static ImmutableArray<byte> ToImmutable(this MemoryStream stream)
122-
=> ImmutableArray.Create<byte>(stream.ToArray());
124+
{
125+
return ImmutableArray.Create<byte>(stream.ToArray());
126+
}
123127

124128
/// <summary>
125129
/// Maps an immutable array to another immutable array.
@@ -130,7 +134,9 @@ public static ImmutableArray<byte> ToImmutable(this MemoryStream stream)
130134
/// <param name="map">The mapping delegate</param>
131135
/// <returns>If the items's length is 0, this will return an empty immutable array</returns>
132136
public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this ImmutableArray<TItem> items, Func<TItem, TResult> map)
133-
=> ImmutableArray.CreateRange(items, map);
137+
{
138+
return ImmutableArray.CreateRange(items, map);
139+
}
134140

135141
/// <summary>
136142
/// Maps an immutable array to another immutable array.
@@ -143,7 +149,9 @@ public static ImmutableArray<TResult> SelectAsArray<TItem, TResult>(this Immutab
143149
/// <param name="arg">The extra input used by mapping delegate</param>
144150
/// <returns>If the items's length is 0, this will return an empty immutable array.</returns>
145151
public static ImmutableArray<TResult> SelectAsArray<TItem, TArg, TResult>(this ImmutableArray<TItem> items, Func<TItem, TArg, TResult> map, TArg arg)
146-
=> ImmutableArray.CreateRange(items, map, arg);
152+
{
153+
return ImmutableArray.CreateRange(items, map, arg);
154+
}
147155

148156
/// <summary>
149157
/// Maps an immutable array to another immutable array.
@@ -393,7 +401,9 @@ public static bool SetEquals<T>(this ImmutableArray<T> array1, ImmutableArray<T>
393401
/// Returns an empty array if the input array is null (default)
394402
/// </summary>
395403
public static ImmutableArray<T> NullToEmpty<T>(this ImmutableArray<T> array)
396-
=> array.IsDefault ? ImmutableArray<T>.Empty : array;
404+
{
405+
return array.IsDefault ? ImmutableArray<T>.Empty : array;
406+
}
397407

398408
/// <summary>
399409
/// Returns an array of distinct elements, preserving the order in the original array.
@@ -481,10 +491,14 @@ internal static ImmutableArray<TValue> Flatten<TKey, TValue>(
481491
}
482492

483493
internal static ImmutableArray<T> Concat<T>(this ImmutableArray<T> first, ImmutableArray<T> second)
484-
=> first.AddRange(second);
494+
{
495+
return first.AddRange(second);
496+
}
485497

486498
internal static ImmutableArray<T> Concat<T>(this ImmutableArray<T> first, T second)
487-
=> first.Add(second);
499+
{
500+
return first.Add(second);
501+
}
488502

489503
internal static bool HasDuplicates<T>(this ImmutableArray<T> array, IEqualityComparer<T> comparer)
490504
{
@@ -595,7 +609,9 @@ internal static Dictionary<K, ImmutableArray<T>> ToDictionary<K, T>(this Immutab
595609
}
596610

597611
internal static Location FirstOrNone(this ImmutableArray<Location> items)
598-
=> items.IsEmpty ? Location.None : items[0];
612+
{
613+
return items.IsEmpty ? Location.None : items[0];
614+
}
599615

600616
internal static bool SequenceEqual<TElement, TArg>(this ImmutableArray<TElement> array1, ImmutableArray<TElement> array2, TArg arg, Func<TElement, TElement, TArg, bool> predicate)
601617
{

src/Compilers/Core/Portable/Collections/OrderPreservingMultiDictionary.cs

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ internal sealed class OrderPreservingMultiDictionary<K, V> :
3232
private readonly ObjectPool<OrderPreservingMultiDictionary<K, V>>? _pool;
3333

3434
private OrderPreservingMultiDictionary(ObjectPool<OrderPreservingMultiDictionary<K, V>> pool)
35-
=> _pool = pool;
35+
{
36+
_pool = pool;
37+
}
3638

3739
public void Free()
3840
{
@@ -84,7 +86,9 @@ public OrderPreservingMultiDictionary()
8486
}
8587

8688
private void EnsureDictionary()
87-
=> _dictionary ??= PooledDictionary<K, ValueSet>.GetInstance();
89+
{
90+
_dictionary ??= PooledDictionary<K, ValueSet>.GetInstance();
91+
}
8892

8993
public bool IsEmpty => _dictionary == null;
9094

@@ -108,13 +112,19 @@ public void Add(K k, V v)
108112
}
109113

110114
public Dictionary<K, ValueSet>.Enumerator GetEnumerator()
111-
=> _dictionary is null ? s_emptyDictionary.GetEnumerator() : _dictionary.GetEnumerator();
115+
{
116+
return _dictionary is null ? s_emptyDictionary.GetEnumerator() : _dictionary.GetEnumerator();
117+
}
112118

113119
IEnumerator<KeyValuePair<K, ValueSet>> IEnumerable<KeyValuePair<K, ValueSet>>.GetEnumerator()
114-
=> GetEnumerator();
120+
{
121+
return GetEnumerator();
122+
}
115123

116124
IEnumerator IEnumerable.GetEnumerator()
117-
=> GetEnumerator();
125+
{
126+
return GetEnumerator();
127+
}
118128

119129
/// <summary>
120130
/// Get all values associated with K, in the order they were added.
@@ -158,10 +168,14 @@ public struct ValueSet : IEnumerable<V>
158168
private readonly object _value;
159169

160170
internal ValueSet(V value)
161-
=> _value = value;
171+
{
172+
_value = value;
173+
}
162174

163175
internal ValueSet(ArrayBuilder<V> values)
164-
=> _value = values;
176+
{
177+
_value = values;
178+
}
165179

166180
internal void Free()
167181
{
@@ -226,13 +240,19 @@ internal ImmutableArray<V> Items
226240
internal int Count => (_value as ArrayBuilder<V>)?.Count ?? 1;
227241

228242
IEnumerator IEnumerable.GetEnumerator()
229-
=> GetEnumerator();
243+
{
244+
return GetEnumerator();
245+
}
230246

231247
IEnumerator<V> IEnumerable<V>.GetEnumerator()
232-
=> GetEnumerator();
248+
{
249+
return GetEnumerator();
250+
}
233251

234252
public Enumerator GetEnumerator()
235-
=> new Enumerator(this);
253+
{
254+
return new Enumerator(this);
255+
}
236256

237257
internal ValueSet WithAddedItem(V item)
238258
{
@@ -285,7 +305,9 @@ public bool MoveNext()
285305
}
286306

287307
public void Reset()
288-
=> _index = -1;
308+
{
309+
_index = -1;
310+
}
289311

290312
public void Dispose()
291313
{

src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerAssemblyLoader.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public Assembly LoadFromPath(string fullPath)
5353
#endregion
5454

5555
private Assembly LoadFromPathUnchecked(string fullPath)
56-
=> LoadFromPathUncheckedCore(fullPath);
56+
{
57+
return LoadFromPathUncheckedCore(fullPath);
58+
}
5759

5860
private Assembly LoadFromPathUncheckedCore(string fullPath, AssemblyIdentity identity = null)
5961
{

0 commit comments

Comments
 (0)