public static IEnumerable <IFSharpPattern> GetPartialDeclarations([NotNull] this IFSharpPattern fsPattern)
        {
            if (!(fsPattern is INamedPat namedPattern))
            {
                return new[] { fsPattern }
            }
            ;

            var canBePartial = false;

            while (fsPattern.Parent is IFSharpPattern parent)
            {
                fsPattern = parent;

                if (parent is IOrPat || parent is IAndsPat)
                {
                    canBePartial = true;
                }
            }

            if (!canBePartial)
            {
                return new[] { namedPattern }
            }
            ;

            return(fsPattern.NestedPatterns.Where(pattern =>
                                                  pattern is INamedPat namedPat && namedPat.SourceName == namedPattern.SourceName && pattern.IsDeclaration));
        }
    }
}
예제 #2
0
 public static IBinding GetByHeadPattern([CanBeNull] IFSharpPattern param) =>
 (IBinding)BindingImplementationNavigator.GetByHeadPattern(param) ??
 BindingSignatureNavigator.GetByHeadPattern(param as IReferencePat);