Пример #1
0
 /// <summary>
 /// Generate an error when the argument count check fails.
 /// This is also called by CLR procedures, which check their arguments differently.
 /// </summary>
 /// <param name="numArgs">The actual number of arguments.</param>
 /// <param name="expectedArgs">The expected number of arguments.</param>
 /// <param name="args">The arguments actually passed.</param>
 /// <param name="evaluatorName">The name of the evaluator that is checking the count.</param>
 /// <param name="caller">The calling evaluator.</param>
 protected void ArgCountError(int numArgs, int expectedArgs, SchemeObject args, string evaluatorName, Evaluator caller)
 {
     string msg = numArgs < expectedArgs ? "few" : "many";
         int lineNumber = caller.FindLineNumberInCallStack();
         string lineMsg = lineNumber == 0 ? string.Empty : " at line: " + lineNumber;
         ErrorHandlers.SemanticError(
             string.Format(
                 @"""{0}"" too {1} args ({2}) for {3}: ""{4}""{5}",
                 evaluatorName,
                 msg,
                 numArgs,
                 this.ProcedureName,
                 args,
                 lineMsg),
             null);
 }