Skip to content

Commit d8cfae9

Browse files
committed
wip
1 parent ef2d673 commit d8cfae9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

ReSharper.FSharp/src/FSharp.Psi/src/Resolve/FSharpParameterUtil.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,19 @@ public static IEnumerable<IEnumerable<string>> GetParameterNames(this ITypeUsage
145145
ITupleTypeUsage tuplePat => tuplePat.Items.SelectMany(GetParameterNames),
146146
_ => EmptyList<IEnumerable<string>>.Enumerable
147147
};
148+
149+
public static IReadOnlyList<IReadOnlyList<string>> GetParametersGroups(this IBinding binding)
150+
{
151+
var parameters = binding.ParameterPatterns.Select(GetParameterNames);
152+
var bodyExpr = binding.Expression;
153+
154+
while (bodyExpr.IgnoreInnerParens() is ILambdaExpr lambdaExpr)
155+
{
156+
parameters = parameters.Union(lambdaExpr.Patterns.Select(GetParameterNames));
157+
bodyExpr = lambdaExpr.Expression;
158+
}
159+
160+
return parameters.Select(t => t.ToIReadOnlyList()).ToIReadOnlyList();
161+
}
148162
}
149163
}

0 commit comments

Comments
 (0)