本文整理匯總了C#中PHP.Core.ScriptContext.ClearCapturedSourceCodeDescriptor方法的典型用法代碼示例。如果您正苦於以下問題:C# ScriptContext.ClearCapturedSourceCodeDescriptor方法的具體用法?C# ScriptContext.ClearCapturedSourceCodeDescriptor怎麽用?C# ScriptContext.ClearCapturedSourceCodeDescriptor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHP.Core.ScriptContext
的用法示例。
在下文中一共展示了ScriptContext.ClearCapturedSourceCodeDescriptor方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CreateLambdaFunction
/// <summary>
/// Compiles a function with a specified parameters and body and adds it to dynamic module.
/// </summary>
/// <param name="parameters">The function's parameters (e.g. <c>"$x, $y = 1, &$z"</c>).</param>
/// <param name="body">The function's body.</param>
/// <param name="context">A script context.</param>
/// <param name="descriptor"></param>
/// <returns>A name of the created function.</returns>
/// <exception cref="ArgumentNullException">Any parameter is a <B>null</B> reference.</exception>
public static string CreateLambdaFunction(string/*!*/ parameters, string/*!*/ body, ScriptContext/*!*/ context,
SourceCodeDescriptor descriptor)
{
if (parameters == null)
throw new ArgumentNullException("parameters");
if (body == null)
throw new ArgumentNullException("body");
if (context == null)
throw new ArgumentNullException("context");
string name = GenerateLambdaName(parameters, body);
if (context.DeclaredFunctions != null && context.DeclaredFunctions.ContainsKey(name))
return name;
string prefix1, prefix2;
GetLamdaFunctionCodePrefixes(name, parameters, out prefix1, out prefix2);
context.ClearCapturedSourceCodeDescriptor();
EvalInternal(prefix2, body, "}", EvalKinds.LambdaFunction, context, null, null, null, descriptor, false, null); // TODO: naming context in lambda function??
return name;
}