Browse Source

fix #614 - Keyword "ref" used instead of "out"

pull/724/head
Siegfried Pammer 9 years ago
parent
commit
866451e08c
  1. 32
      ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs
  2. 8
      Rebracer.xml

32
ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs

@ -754,26 +754,28 @@ namespace ICSharpCode.Decompiler.Ast @@ -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);
}

8
Rebracer.xml

@ -10,13 +10,13 @@ @@ -10,13 +10,13 @@
<ToolsOptionsCategory name="Environment">
<ToolsOptionsSubCategory name="TaskList">
<PropertyValue name="CommentTokens" ArrayType="VT_VARIANT" ArrayElementCount="4">
<PropertyValue name="0">TODO:2</PropertyValue>
<PropertyValue name="1">HACK:2</PropertyValue>
<PropertyValue name="0">HACK:2</PropertyValue>
<PropertyValue name="1">TODO:2</PropertyValue>
<PropertyValue name="2">UNDONE:2</PropertyValue>
<PropertyValue name="3">UnresolvedMergeConflict:3</PropertyValue>
</PropertyValue>
<PropertyValue name="ConfirmTaskDeletion">true</PropertyValue>
<PropertyValue name="DontShowFilePaths">true</PropertyValue>
<PropertyValue name="ConfirmTaskDeletion">false</PropertyValue>
<PropertyValue name="DontShowFilePaths">false</PropertyValue>
<PropertyValue name="WarnOnAddingHiddenItem">false</PropertyValue>
</ToolsOptionsSubCategory>
</ToolsOptionsCategory>

Loading…
Cancel
Save