|
|
|
@ -1987,7 +1987,7 @@ namespace ICSharpCode.Decompiler.CSharp |
|
|
|
break; |
|
|
|
break; |
|
|
|
case IL.Transforms.AccessPathKind.Setter: |
|
|
|
case IL.Transforms.AccessPathKind.Setter: |
|
|
|
if (lastElement.Indices?.Length > 0) { |
|
|
|
if (lastElement.Indices?.Length > 0) { |
|
|
|
var indexer = new IndexerExpression(null, lastElement.Indices.SelectArray(i => Translate(i is LdLoc ld ? indexVariables[ld.Variable] : i).Expression)) |
|
|
|
var indexer = new IndexerExpression(null, lastElement.Indices.SelectArray(i => TranslateInitializerIndexerValue(i, indexVariables))) |
|
|
|
.WithILInstruction(inst).WithRR(memberRR); |
|
|
|
.WithILInstruction(inst).WithRR(memberRR); |
|
|
|
elementsStack.Peek().Add(Assignment(indexer, Translate(info.Values.Single(), typeHint: indexer.Type))); |
|
|
|
elementsStack.Peek().Add(Assignment(indexer, Translate(info.Values.Single(), typeHint: indexer.Type))); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
@ -2009,6 +2009,14 @@ namespace ICSharpCode.Decompiler.CSharp |
|
|
|
return expr.WithILInstruction(block); |
|
|
|
return expr.WithILInstruction(block); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Expression TranslateInitializerIndexerValue(ILInstruction inst, Dictionary<ILVariable, ILInstruction> indexVariables) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (inst is LdLoc ld && indexVariables.TryGetValue(ld.Variable, out var newInst)) { |
|
|
|
|
|
|
|
inst = newInst; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return Translate(inst).Expression; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Expression MakeInitializerAssignment(IMember method, IL.Transforms.AccessPathElement member, List<Expression> values, Dictionary<ILVariable, ILInstruction> indexVariables) |
|
|
|
Expression MakeInitializerAssignment(IMember method, IL.Transforms.AccessPathElement member, List<Expression> values, Dictionary<ILVariable, ILInstruction> indexVariables) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Expression value; |
|
|
|
Expression value; |
|
|
|
|