示例#1
0
        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);
        }
示例#2
0
 public SyntaxPattern(IFunctionDeclaration declaration)
 {
     MinArgumentCount = declaration.MandatoryRightArgumentCount();
     MaxArgumentCount = declaration.MaxRightArgumentCount();
     Members.Add(declaration);
 }