本文整理汇总了C#中Evaluator.FindLineNumberInCallStack方法的典型用法代码示例。如果您正苦于以下问题:C# Evaluator.FindLineNumberInCallStack方法的具体用法?C# Evaluator.FindLineNumberInCallStack怎么用?C# Evaluator.FindLineNumberInCallStack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Evaluator
的用法示例。
在下文中一共展示了Evaluator.FindLineNumberInCallStack方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ArgCountError
/// <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);
}