static void MergeDeclaration(SyntaxPattern syntaxPattern, IFunctionDeclaration declaration) { if (syntaxPattern.Members.Contains(declaration)) { return; } syntaxPattern.MinArgumentCount = Math.Min(syntaxPattern.MinArgumentCount, declaration.MandatoryRightArgumentCount()); if (syntaxPattern.MaxArgumentCount.HasValue) { var max = declaration.MaxRightArgumentCount(); syntaxPattern.MaxArgumentCount = !max.HasValue ? null : (int?)Math.Max(syntaxPattern.MaxArgumentCount.Value, max.Value); } syntaxPattern.Members.Add(declaration); }
public SyntaxPattern(IFunctionDeclaration declaration) { MinArgumentCount = declaration.MandatoryRightArgumentCount(); MaxArgumentCount = declaration.MaxRightArgumentCount(); Members.Add(declaration); }