Skip to content

Commit 5f83a27

Browse files
committed
Removing unreachable code
1 parent 58d0891 commit 5f83a27

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

AgileMapper/ObjectPopulation/DerivedComplexTypeMappingsFactory.cs

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,10 @@ public static Expression CreateFor(IObjectMappingData declaredTypeMappingData)
3737

3838
var derivedTypeMappings = new List<Expression>();
3939

40-
bool declaredTypeHasUnconditionalTypePair;
41-
4240
AddDeclaredSourceTypeMappings(
4341
derivedTypePairs,
4442
declaredTypeMappingData,
45-
derivedTypeMappings,
46-
out declaredTypeHasUnconditionalTypePair);
47-
48-
if (declaredTypeHasUnconditionalTypePair)
49-
{
50-
return derivedTypeMappings.First();
51-
}
43+
derivedTypeMappings);
5244

5345
var typedObjectVariables = new List<ParameterExpression>();
5446

@@ -64,8 +56,7 @@ public static Expression CreateFor(IObjectMappingData declaredTypeMappingData)
6456
private static void AddDeclaredSourceTypeMappings(
6557
IEnumerable<DerivedTypePair> derivedTypePairs,
6658
IObjectMappingData declaredTypeMappingData,
67-
ICollection<Expression> derivedTypeMappings,
68-
out bool declaredTypeHasUnconditionalTypePair)
59+
ICollection<Expression> derivedTypeMappings)
6960
{
7061
var declaredTypeMapperData = declaredTypeMappingData.MapperData;
7162

@@ -79,20 +70,11 @@ private static void AddDeclaredSourceTypeMappings(
7970
derivedTypePair.DerivedTargetType);
8071

8172
var returnMappingResult = Expression.Return(declaredTypeMapperData.ReturnLabelTarget, derivedTypeMapping);
82-
declaredTypeHasUnconditionalTypePair = (condition == null);
83-
84-
if (declaredTypeHasUnconditionalTypePair)
85-
{
86-
derivedTypeMappings.Add(returnMappingResult);
87-
return;
88-
}
8973

9074
var ifConditionThenMap = Expression.IfThen(condition, returnMappingResult);
9175

9276
derivedTypeMappings.Add(ifConditionThenMap);
9377
}
94-
95-
declaredTypeHasUnconditionalTypePair = false;
9678
}
9779

9880
private static Expression GetTypePairCondition(DerivedTypePair derivedTypePair, IMemberMapperData mapperData)

0 commit comments

Comments
 (0)