Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
DedSec256 committed Aug 30, 2022
1 parent ef2d673 commit d8cfae9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ReSharper.FSharp/src/FSharp.Psi/src/Resolve/FSharpParameterUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,19 @@ public static IEnumerable<IEnumerable<string>> GetParameterNames(this ITypeUsage
ITupleTypeUsage tuplePat => tuplePat.Items.SelectMany(GetParameterNames),
_ => EmptyList<IEnumerable<string>>.Enumerable
};

public static IReadOnlyList<IReadOnlyList<string>> GetParametersGroups(this IBinding binding)
{
var parameters = binding.ParameterPatterns.Select(GetParameterNames);
var bodyExpr = binding.Expression;

while (bodyExpr.IgnoreInnerParens() is ILambdaExpr lambdaExpr)
{
parameters = parameters.Union(lambdaExpr.Patterns.Select(GetParameterNames));
bodyExpr = lambdaExpr.Expression;
}

return parameters.Select(t => t.ToIReadOnlyList()).ToIReadOnlyList();
}
}
}

0 comments on commit d8cfae9

Please sign in to comment.