Skip to content

Commit

Permalink
Fixing issue with implicit object creation breaking weird (#366)
Browse files Browse the repository at this point in the history
closes #302
  • Loading branch information
belav committed Jul 20, 2021
1 parent c8d640e commit 2d76bc5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,10 @@ class ClassName
},
};
}

private SomeObject someObject =
new(someLongParameter___________________)
{
SomeProperty = someLongValue____________________________
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static Doc Print(ImplicitObjectCreationExpressionSyntax node)
Token.Print(node.NewKeyword),
ArgumentList.Print(node.ArgumentList),
node.Initializer != null
? Doc.Concat(Doc.Line, Node.Print(node.Initializer))
? Doc.Concat(Doc.Line, InitializerExpression.Print(node.Initializer))
: Doc.Null
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public static Doc Print(InitializerExpressionSyntax node)
return node.Parent
is not (ObjectCreationExpressionSyntax
or ArrayCreationExpressionSyntax
or ImplicitArrayCreationExpressionSyntax)
or ImplicitArrayCreationExpressionSyntax
or ImplicitObjectCreationExpressionSyntax)
&& node.Kind() is not SyntaxKind.WithInitializerExpression ? Doc.Group(result) : result;
}
}
Expand Down

0 comments on commit 2d76bc5

Please sign in to comment.