Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. /// <summary>
  2. /// Gets a previously declared function by name and number of parameters.
  3. /// </summary>
  4. private ScriptMemberFunction getFunction(string name, int paramCount)
  5. {
  6.     ScriptMemberFunction result = null;
  7.  
  8.     foreach (ScriptMemberFunction func in declaredFunctions)
  9.     {
  10.         if (name == func.FunctionName)
  11.         {
  12.             // AutoIt does not do function overloading
  13.             if (paramCount >= func.MinParams && paramCount <= func.MaxParams)
  14.             {
  15.                 result = func;
  16.             }
  17.             else
  18.             {
  19.                 throw new AutoItException("Incorrect number of parameters in function call");
  20.             }
  21.         }
  22.     }
  23.     if (result == null)
  24.     {
  25.         throw new AutoItException("Unknown function name.");
  26.     }
  27.     return result;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement