diff --git a/bin/Debug/output.cs b/bin/Debug/output.cs index f2ed4a1d3..3e83bef29 100644 --- a/bin/Debug/output.cs +++ b/bin/Debug/output.cs @@ -26,11 +26,11 @@ namespace Reversi private void InitializeComponent() { System.Resources.ResourceManager V_0 = (IL__newobj(.ctor(), Type.GetTypeFromHandle((IL__ldtoken(Reversi.AboutDialog))))); - IL__stfld(iconPictureBox, @this, (IL__newobj(.ctor()))); - IL__stfld(titleLabel, @this, (IL__newobj(.ctor()))); - IL__stfld(versionLabel, @this, (IL__newobj(.ctor()))); - IL__stfld(okButton, @this, (IL__newobj(.ctor()))); - IL__stfld(copyrightLabel, @this, (IL__newobj(.ctor()))); + @this.iconPictureBox = (IL__newobj(.ctor())); + @this.titleLabel = (IL__newobj(.ctor())); + @this.versionLabel = (IL__newobj(.ctor())); + @this.okButton = (IL__newobj(.ctor())); + @this.copyrightLabel = (IL__newobj(.ctor())); @this.SuspendLayout(); (@this.iconPictureBox).set_Location((IL__newobj(.ctor(), 77, 56))); (@this.iconPictureBox).set_Name("iconPictureBox"); diff --git a/src/AstMetodBodyBuilder.cs b/src/AstMetodBodyBuilder.cs index bf33799eb..b736fee03 100644 --- a/src/AstMetodBodyBuilder.cs +++ b/src/AstMetodBodyBuilder.cs @@ -409,7 +409,36 @@ namespace Decompiler case Code.Ldc_I8: case Code.Ldc_R4: case Code.Ldc_R8: return new Ast.PrimitiveExpression(operand, null); - case Code.Ldfld: return new Ast.MemberReferenceExpression(arg1, ((FieldDefinition)operand).Name); + case Code.Ldfld: { + FieldDefinition field = (FieldDefinition) operand; + if (field.IsStatic) { + return new Ast.MemberReferenceExpression( + new Ast.IdentifierExpression(field.DeclaringType.FullName), + field.Name + ); + } else { + return new Ast.MemberReferenceExpression(arg1, field.Name); + } + } + case Code.Stfld: { + FieldDefinition field = (FieldDefinition) operand; + if (field.IsStatic) { + return new AssignmentExpression( + new Ast.MemberReferenceExpression( + new Ast.IdentifierExpression(field.DeclaringType.FullName), + field.Name + ), + AssignmentOperatorType.Assign, + arg1 + ); + } else { + return new AssignmentExpression( + new Ast.MemberReferenceExpression(arg1, field.Name), + AssignmentOperatorType.Assign, + arg2 + ); + } + } case Code.Ldflda: throw new NotImplementedException(); case Code.Ldftn: throw new NotImplementedException(); case Code.Ldloc: return new Ast.IdentifierExpression(((VariableDefinition)operand).Name); @@ -436,7 +465,6 @@ namespace Decompiler case Code.Rethrow: throw new NotImplementedException(); case Code.Sizeof: throw new NotImplementedException(); case Code.Starg: throw new NotImplementedException(); - case Code.Stfld: throw new NotImplementedException(); case Code.Stloc: string name = ((VariableDefinition)operand).Name; if (localVarDefined[name]) {