Skip to content

Commit 2142d98

Browse files
committed
Deleted more TypeInfo stuff that's not needed for ReadOnly.
1 parent a7a8cc4 commit 2142d98

1 file changed

Lines changed: 9 additions & 26 deletions

File tree

Schema/src/util/types/TypeInfo.cs

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public ParseStatus ParseTypeSymbol(
9898
ITypeSymbol typeSymbol,
9999
bool isReadonly,
100100
out ITypeInfo typeInfo) {
101-
this.ParseNullable_(ref typeSymbol, out var isNullable);
101+
this.ParseNullable_(ref typeSymbol);
102102

103103
if (typeSymbol.IsPrimitive(out var primitiveType)) {
104104
switch (primitiveType) {
@@ -147,7 +147,7 @@ public ParseStatus ParseTypeSymbol(
147147
var elementParseStatus = this.ParseTypeSymbol(
148148
elementTypeV2,
149149
sequenceType.IsReadOnly(),
150-
out var elementTypeInfo);
150+
out _);
151151
if (elementParseStatus != ParseStatus.SUCCESS) {
152152
typeInfo = default;
153153
return elementParseStatus;
@@ -165,21 +165,7 @@ public ParseStatus ParseTypeSymbol(
165165
return ParseStatus.SUCCESS;
166166
}
167167

168-
if (typeSymbol.IsGenericTypeParameter(out var typeParameterSymbol)) {
169-
var constraintTypeInfos =
170-
typeParameterSymbol
171-
.ConstraintTypes
172-
.Where(t => t is not IErrorTypeSymbol)
173-
.Select(constraintType => {
174-
var parseStatus = this.ParseTypeSymbol(
175-
constraintType,
176-
isReadonly,
177-
out var constraintTypeInfo);
178-
Asserts.Equal(ParseStatus.SUCCESS, parseStatus);
179-
return constraintTypeInfo;
180-
})
181-
.ToArray();
182-
168+
if (typeSymbol.IsGenericTypeParameter(out _)) {
183169
typeInfo = new GenericTypeInfo();
184170
return ParseStatus.SUCCESS;
185171
}
@@ -221,16 +207,13 @@ private bool GetTypeOfMember_(
221207
}
222208
}
223209

224-
private void ParseNullable_(ref ITypeSymbol typeSymbol,
225-
out bool isNullable) {
226-
isNullable = false;
227-
if (typeSymbol.IsType(typeof(Nullable<>))) {
228-
Asserts.True(typeSymbol.IsGeneric(out _, out var genericArguments));
229-
typeSymbol = genericArguments.ToArray()[0];
230-
isNullable = true;
231-
} else if (typeSymbol.IsNullable(out _)) {
232-
isNullable = true;
210+
private void ParseNullable_(ref ITypeSymbol typeSymbol) {
211+
if (!typeSymbol.IsType(typeof(Nullable<>))) {
212+
return;
233213
}
214+
215+
Asserts.True(typeSymbol.IsGeneric(out _, out var genericArguments));
216+
typeSymbol = genericArguments.ToArray()[0];
234217
}
235218

236219
private record BoolTypeInfo : IBoolTypeInfo;

0 commit comments

Comments
 (0)