GetNumberOfFormalParameters() private method

private GetNumberOfFormalParameters ( ) : int
return int
コード例 #1
0
ファイル: regexpreplace.cs プロジェクト: ydunk/masters
        internal ReplaceUsingFunction(Regex regex, ScriptFunction function, String source)
        {
            this.function = function;
            this.cArgs    = function.GetNumberOfFormalParameters();
            bool hasArgumentsObject = (function is Closure) && ((Closure)function).func.hasArgumentsObject;

            this.groupNumbers = null;
            this.source       = source;
            if (this.cArgs > 1 || hasArgumentsObject)
            {
                String[] groupNames    = regex.GetGroupNames();
                int      cGroupNumbers = groupNames.Length - 1;
                if (hasArgumentsObject)
                {
                    this.cArgs = cGroupNumbers + 3;
                }
                if (cGroupNumbers > 0)
                {
                    if (cGroupNumbers > this.cArgs - 1)
                    {
                        cGroupNumbers = this.cArgs - 1;
                    }
                    this.groupNumbers = new int[cGroupNumbers];
                    for (int i = 0; i < cGroupNumbers; i++)
                    {
                        this.groupNumbers[i] = regex.GroupNumberFromName(groupNames[i + 1]);
                    }
                }
            }
        }
コード例 #2
0
        internal ReplaceUsingFunction(Regex regex, ScriptFunction function, string source)
        {
            this.function = function;
            this.cArgs    = function.GetNumberOfFormalParameters();
            bool flag = (function is Closure) && ((Closure)function).func.hasArgumentsObject;

            this.groupNumbers = null;
            this.source       = source;
            if ((this.cArgs > 1) || flag)
            {
                string[] groupNames = regex.GetGroupNames();
                int      num        = groupNames.Length - 1;
                if (flag)
                {
                    this.cArgs = num + 3;
                }
                if (num > 0)
                {
                    if (num > (this.cArgs - 1))
                    {
                        num = this.cArgs - 1;
                    }
                    this.groupNumbers = new int[num];
                    for (int i = 0; i < num; i++)
                    {
                        this.groupNumbers[i] = regex.GroupNumberFromName(groupNames[i + 1]);
                    }
                }
            }
        }
 internal ReplaceUsingFunction(Regex regex, ScriptFunction function, string source)
 {
     this.function = function;
     this.cArgs = function.GetNumberOfFormalParameters();
     bool flag = (function is Closure) && ((Closure) function).func.hasArgumentsObject;
     this.groupNumbers = null;
     this.source = source;
     if ((this.cArgs > 1) || flag)
     {
         string[] groupNames = regex.GetGroupNames();
         int num = groupNames.Length - 1;
         if (flag)
         {
             this.cArgs = num + 3;
         }
         if (num > 0)
         {
             if (num > (this.cArgs - 1))
             {
                 num = this.cArgs - 1;
             }
             this.groupNumbers = new int[num];
             for (int i = 0; i < num; i++)
             {
                 this.groupNumbers[i] = regex.GroupNumberFromName(groupNames[i + 1]);
             }
         }
     }
 }
コード例 #4
0
ファイル: regexpreplace.cs プロジェクト: ArildF/masters
 internal ReplaceUsingFunction(Regex regex, ScriptFunction function, String source) {
   this.function = function;
   this.cArgs = function.GetNumberOfFormalParameters();
   bool hasArgumentsObject = (function is Closure) && ((Closure)function).func.hasArgumentsObject;
   this.groupNumbers = null;
   this.source = source;
   if (this.cArgs > 1 || hasArgumentsObject) {
     String[] groupNames = regex.GetGroupNames();
     int cGroupNumbers = groupNames.Length - 1;
     if (hasArgumentsObject) this.cArgs = cGroupNumbers+3;
     if (cGroupNumbers > 0) {
       if (cGroupNumbers > this.cArgs - 1)
         cGroupNumbers = this.cArgs - 1;
       this.groupNumbers = new int[cGroupNumbers];
       for (int i = 0; i < cGroupNumbers; i++)
         this.groupNumbers[i] = regex.GroupNumberFromName(groupNames[i+1]);
     }
   }
 }