Browse Source

Add inlining special cases for dynamic compound assignments

pull/1165/head
Siegfried Pammer 7 years ago
parent
commit
0bf56ce9ca
  1. 18
      ICSharpCode.Decompiler/IL/Transforms/ILInlining.cs

18
ICSharpCode.Decompiler/IL/Transforms/ILInlining.cs

@ -343,11 +343,19 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -343,11 +343,19 @@ namespace ICSharpCode.Decompiler.IL.Transforms
if (parent is ILiftableInstruction liftable && liftable.IsLifted) {
return true; // inline into lifted operators
}
if (parent is NullCoalescingInstruction && NullableType.IsNullable(v.Type)) {
return true; // inline nullables into ?? operator
}
if (parent is NullableUnwrap) {
return true; // inline into ?. operator
switch (parent.OpCode) {
case OpCode.NullCoalescingInstruction:
if (NullableType.IsNullable(v.Type))
return true; // inline nullables into ?? operator
break;
case OpCode.NullableUnwrap:
return true; // inline into ?. operator
case OpCode.DynamicGetMemberInstruction:
case OpCode.DynamicGetIndexInstruction:
case OpCode.LdObj:
if (parent.Parent.OpCode == OpCode.DynamicCompoundAssign)
return true; // inline into dynamic compound assignments
break;
}
// decide based on the target into which we are inlining
switch (next.OpCode) {

Loading…
Cancel
Save