Skip to content

Commit 95b5fb0

Browse files
address review comment
1 parent 9e281c5 commit 95b5fb0

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

ICSharpCode.Decompiler/CSharp/StatementBuilder.cs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,21 @@ protected internal override TranslatedStatement VisitLeave(Leave inst)
382382
.WithRR(new ConversionResolveResult(currentResultType, expr.ResolveResult, Conversion.IdentityConversion)).WithoutILInstruction();
383383
}
384384
return new ReturnStatement(expr).WithILInstruction(inst);
385+
386+
static bool IsPossibleLossOfTypeInformation(IType givenType, IType expectedType)
387+
{
388+
if (expectedType.ContainsAnonymousType())
389+
return false;
390+
if (NormalizeTypeVisitor.IgnoreNullability.EquivalentTypes(givenType, expectedType))
391+
return false;
392+
if (expectedType is TupleType { ElementNames.IsEmpty: false })
393+
return true;
394+
if (expectedType == SpecialType.Dynamic)
395+
return true;
396+
if (givenType == SpecialType.NullType)
397+
return true;
398+
return false;
399+
}
385400
}
386401
else
387402
return new ReturnStatement().WithILInstruction(inst);
@@ -403,19 +418,6 @@ protected internal override TranslatedStatement VisitLeave(Leave inst)
403418
return new GotoStatement(label).WithILInstruction(inst);
404419
}
405420

406-
private bool IsPossibleLossOfTypeInformation(IType givenType, IType expectedType)
407-
{
408-
if (NormalizeTypeVisitor.IgnoreNullability.EquivalentTypes(givenType, expectedType))
409-
return false;
410-
if (expectedType is TupleType { ElementNames.IsEmpty: false })
411-
return true;
412-
if (expectedType == SpecialType.Dynamic)
413-
return true;
414-
if (givenType == SpecialType.NullType)
415-
return !expectedType.ContainsAnonymousType();
416-
return false;
417-
}
418-
419421
protected internal override TranslatedStatement VisitThrow(Throw inst)
420422
{
421423
return new ThrowStatement(exprBuilder.Translate(inst.Argument)).WithILInstruction(inst);

0 commit comments

Comments
 (0)