Permalink
Browse files

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

  • Loading branch information...
1 parent a6ae2e4 commit 866451e08c46823c3fd3fa3ea30b5cfd41bf97d2 @siegfriedpammer siegfriedpammer committed Jun 3, 2016
Showing with 21 additions and 19 deletions.
  1. +17 −15 ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs
  2. +4 −4 Rebracer.xml
@@ -754,26 +754,28 @@ AstNode TransformByteCode(ILExpression byteCode)
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);
}
View
@@ -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>

0 comments on commit 866451e

Please sign in to comment.