Skip to content

Commit

Permalink
Dealing with an edge case for conditional access
Browse files Browse the repository at this point in the history
closes #603
  • Loading branch information
belav committed Apr 4, 2022
1 parent f1a0b03 commit 1fe14a9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,5 +234,13 @@ class ClassName
longParameter_______________________________________
)
.CallMethod__________________();

someThing_______________________.Property
.CallMethod__________________()
.CallMethod__________________();

someThing_______________________?.Property
.CallMethod__________________()
.CallMethod__________________();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,23 @@ List<PrintedNode> printedNodes
{
for (; index + 1 < printedNodes.Count; ++index)
{
/* this handles the special case where we want ?.Property on the same line
someThing_______________________?.Property
.CallMethod__________________()
.CallMethod__________________();
*/
if (
printedNodes[index].Node is ConditionalAccessExpressionSyntax
&& printedNodes[index + 1].Node
is MemberBindingExpressionSyntax { Parent: MemberAccessExpressionSyntax }
)
{
currentGroup.Add(printedNodes[index]);
currentGroup.Add(printedNodes[index + 1]);
index++;
continue;
}

if (
(
IsMemberish(printedNodes[index].Node)
Expand Down

0 comments on commit 1fe14a9

Please sign in to comment.