From 866451e08c46823c3fd3fa3ea30b5cfd41bf97d2 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 4 Jun 2016 00:01:08 +0900 Subject: [PATCH] fix #614 - Keyword "ref" used instead of "out" --- .../Ast/AstMethodBodyBuilder.cs | 32 ++++++++++--------- Rebracer.xml | 8 ++--- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs b/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs index b5b7d57ff..a0bb65095 100644 --- a/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs +++ b/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs @@ -754,26 +754,28 @@ namespace ICSharpCode.Decompiler.Ast return ace; } } - if (declaringType.IsAnonymousType()) { - MethodDefinition ctor = ((MethodReference)operand).Resolve(); - if (methodDef != null) { - AnonymousTypeCreateExpression atce = new AnonymousTypeCreateExpression(); - if (CanInferAnonymousTypePropertyNamesFromArguments(args, ctor.Parameters)) { - atce.Initializers.AddRange(args); - } else { - for (int i = 0; i < args.Count; i++) { - atce.Initializers.Add( - new NamedExpression { - Name = ctor.Parameters[i].Name, - Expression = args[i] - }); - } + MethodDefinition ctor = ((MethodReference)operand).Resolve(); + if (declaringType.IsAnonymousType() && methodDef != null) { + AnonymousTypeCreateExpression atce = new AnonymousTypeCreateExpression(); + if (CanInferAnonymousTypePropertyNamesFromArguments(args, ctor.Parameters)) { + atce.Initializers.AddRange(args); + } else { + for (int i = 0; i < args.Count; i++) { + atce.Initializers.Add( + new NamedExpression { + Name = ctor.Parameters[i].Name, + Expression = args[i] + }); } - return atce; } + return atce; } var oce = new Ast.ObjectCreateExpression(); oce.Type = AstBuilder.ConvertType(declaringType); + // seems like IsIn/IsOut information for parameters is only correct on the ctor's MethodDefinition + if (ctor != null) { + AdjustArgumentsForMethodCall(ctor, args); + } oce.Arguments.AddRange(args); return oce.WithAnnotation(operand); } diff --git a/Rebracer.xml b/Rebracer.xml index 643796212..f0cfda200 100644 --- a/Rebracer.xml +++ b/Rebracer.xml @@ -10,13 +10,13 @@ - TODO:2 - HACK:2 + HACK:2 + TODO:2 UNDONE:2 UnresolvedMergeConflict:3 - true - true + false + false false