|
|
|
@ -124,19 +124,24 @@ namespace ICSharpCode.Decompiler.ILAst
@@ -124,19 +124,24 @@ namespace ICSharpCode.Decompiler.ILAst
|
|
|
|
|
MethodReference methodRef; |
|
|
|
|
ILExpression methodArg1; |
|
|
|
|
ILExpression methodArg2; |
|
|
|
|
FieldDefinition field; |
|
|
|
|
FieldReference fieldRef; |
|
|
|
|
if (body.ElementAtOrDefault(pos).Match(ILCode.Call, out methodRef, out methodArg1, out methodArg2) && |
|
|
|
|
methodRef.DeclaringType.FullName == "System.Runtime.CompilerServices.RuntimeHelpers" && |
|
|
|
|
methodRef.Name == "InitializeArray" && |
|
|
|
|
methodArg1.Match(ILCode.Ldloc, out v2) && |
|
|
|
|
array == v2 && |
|
|
|
|
methodArg2.Match(ILCode.Ldtoken, out field) && |
|
|
|
|
field != null && field.InitialValue != null) { |
|
|
|
|
ILExpression[] newArr = new ILExpression[arrayLength]; |
|
|
|
|
if (DecodeArrayInitializer(TypeAnalysis.GetTypeCode(arrayType.GetElementType()), field.InitialValue, newArr)) { |
|
|
|
|
values = newArr; |
|
|
|
|
foundPos = pos; |
|
|
|
|
return true; |
|
|
|
|
methodArg2.Match(ILCode.Ldtoken, out fieldRef)) |
|
|
|
|
{ |
|
|
|
|
FieldDefinition fieldDef = fieldRef.ResolveWithinSameModule(); |
|
|
|
|
if (fieldDef != null && fieldDef.InitialValue != null) { |
|
|
|
|
ILExpression[] newArr = new ILExpression[arrayLength]; |
|
|
|
|
if (DecodeArrayInitializer(TypeAnalysis.GetTypeCode(arrayType.GetElementType()), |
|
|
|
|
fieldDef.InitialValue, newArr)) |
|
|
|
|
{ |
|
|
|
|
values = newArr; |
|
|
|
|
foundPos = pos; |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
values = null; |
|
|
|
|