|
|
|
@ -1,4 +1,4 @@
@@ -1,4 +1,4 @@
|
|
|
|
|
// Copyright (c) 2015 Siegfried Pammer
|
|
|
|
|
// Copyright (c) 2015 Siegfried Pammer
|
|
|
|
|
//
|
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
|
|
|
|
// software and associated documentation files (the "Software"), to deal in the Software
|
|
|
|
@ -620,16 +620,21 @@ namespace ICSharpCode.Decompiler.IL.Transforms
@@ -620,16 +620,21 @@ namespace ICSharpCode.Decompiler.IL.Transforms
|
|
|
|
|
var block = new Block(BlockKind.ArrayInitializer); |
|
|
|
|
block.Instructions.Add(new StLoc(v, new NewArr(elementType, arrayLength.Select(l => new LdcI4(l)).ToArray()))); |
|
|
|
|
int step = arrayLength.Length + 1; |
|
|
|
|
|
|
|
|
|
var indices = new List<ILInstruction>(); |
|
|
|
|
for (int i = 0; i < values.Length / step; i++) |
|
|
|
|
{ |
|
|
|
|
// values array is filled backwards
|
|
|
|
|
var value = values[step * i]; |
|
|
|
|
var indices = new List<ILInstruction>(); |
|
|
|
|
|
|
|
|
|
indices.EnsureCapacity(step - 1); |
|
|
|
|
for (int j = step - 1; j >= 1; j--) |
|
|
|
|
{ |
|
|
|
|
indices.Add(values[step * i + j]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
block.Instructions.Add(StElem(new LdLoc(v), indices.ToArray(), value, elementType)); |
|
|
|
|
indices.Clear(); |
|
|
|
|
} |
|
|
|
|
block.FinalInstruction = new LdLoc(v); |
|
|
|
|
return block; |
|
|
|
@ -774,6 +779,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms
@@ -774,6 +779,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms
|
|
|
|
|
if (initialValue.RemainingBytes < (totalLength * elementSize)) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
output.EnsureCapacity(totalLength + totalLength * arrayLength.Length); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < totalLength; i++) |
|
|
|
|
{ |
|
|
|
|
output.Add(decoder(ref initialValue)); |
|
|
|
|