Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
wwh1004 committed Jan 30, 2021
1 parent 4d3040c commit 30152ba
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions ICSharpCode.Decompiler/IL/Transforms/TransformExpressionTrees.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,15 +515,16 @@ ILInstruction Convert()
Arguments = { left(), right() }
}, method.ReturnType);
case 4:
if (!invocation.Arguments[2].MatchLdcI4(out var isLifted))
if (!invocation.Arguments[2].MatchLdcI4(out var isLiftedToNull))
return (null, SpecialType.UnknownType);
if (!MatchGetMethodFromHandle(invocation.Arguments[3], out method))
return (null, SpecialType.UnknownType);
if (isLifted != 0)
bool isLifted = NullableType.IsNullable(leftType);
if (isLifted)
method = CSharpOperators.LiftUserDefinedOperator((IMethod)method);
return (() => new Call((IMethod)method) {
Arguments = { left(), right() }
}, method.ReturnType);
}, isLiftedToNull == 0 ? method.ReturnType : NullableType.Create(method.Compilation, method.ReturnType));
default:
return (null, SpecialType.UnknownType);
}
Expand Down Expand Up @@ -729,13 +730,12 @@ Func<ILInstruction>[] ConvertCallArguments(IList<ILInstruction> arguments, IMeth
var (right, rightType) = ConvertInstruction(invocation.Arguments[1]);
if (right == null)
return (null, SpecialType.UnknownType);
if (invocation.Arguments.Count == 4 && invocation.Arguments[2].MatchLdcI4(out var isLifted) && MatchGetMethodFromHandle(invocation.Arguments[3], out var method))
if (invocation.Arguments.Count == 4 && invocation.Arguments[2].MatchLdcI4(out var isLiftedToNull) && MatchGetMethodFromHandle(invocation.Arguments[3], out var method))
{
if (isLifted != 0)
{
bool isLifted = NullableType.IsNullable(leftType);
if (isLifted)
method = CSharpOperators.LiftUserDefinedOperator((IMethod)method);
}
return (() => new Call((IMethod)method) { Arguments = { left(), right() } }, method.ReturnType);
return (() => new Call((IMethod)method) { Arguments = { left(), right() } }, isLiftedToNull == 0 ? method.ReturnType : NullableType.Create(method.Compilation, method.ReturnType));
}
var rr = resolver.ResolveBinaryOperator(kind.ToBinaryOperatorType(), new ResolveResult(leftType), new ResolveResult(rightType)) as OperatorResolveResult;
if (rr != null && !rr.IsError && rr.UserDefinedOperatorMethod != null)
Expand Down Expand Up @@ -979,15 +979,16 @@ Block BuildBlock()
Arguments = { left(), right() }
}, method.ReturnType);
case 4:
if (!invocation.Arguments[2].MatchLdcI4(out var isLifted))
if (!invocation.Arguments[2].MatchLdcI4(out var isLiftedToNull))
return (null, SpecialType.UnknownType);
if (!MatchGetMethodFromHandle(invocation.Arguments[3], out method))
return (null, SpecialType.UnknownType);
if (isLifted != 0)
bool isLifted = NullableType.IsNullable(leftType);
if (isLifted)
method = CSharpOperators.LiftUserDefinedOperator((IMethod)method);
return (() => new Call((IMethod)method) {
Arguments = { left(), right() }
}, method.ReturnType);
}, isLiftedToNull == 0 ? method.ReturnType : NullableType.Create(method.Compilation, method.ReturnType));
default:
return (null, SpecialType.UnknownType);
}
Expand Down

0 comments on commit 30152ba

Please sign in to comment.