本文整理匯總了C#中PHP.Core.ScriptContext.DisableErrorReporting方法的典型用法代碼示例。如果您正苦於以下問題:C# ScriptContext.DisableErrorReporting方法的具體用法?C# ScriptContext.DisableErrorReporting怎麽用?C# ScriptContext.DisableErrorReporting使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHP.Core.ScriptContext
的用法示例。
在下文中一共展示了ScriptContext.DisableErrorReporting方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: PreAssert
public static bool PreAssert(ScriptContext context)
{
if (!context.Config.Assertion.Active) return false;
// disables error reporting if eval should be quite:
if (context.Config.Assertion.Quiet) context.DisableErrorReporting();
return true;
}
示例2: Assert
public static bool Assert(
object assertion,
ScriptContext context,
Dictionary<string, object> definedVariables,
DObject self,
DTypeDesc includer,
string containingSourcePath,
int line,
int column,
int containerId,
NamingContext namingContext)
{
object result;
string code;
// skips asserts if not active:
if (!context.Config.Assertion.Active) return true;
if ((code = PhpVariable.AsString(assertion)) != null)
{
// disables error reporting if eval should be quite:
if (context.Config.Assertion.Quiet) context.DisableErrorReporting();
SourceCodeDescriptor descriptor = new SourceCodeDescriptor(containingSourcePath, containerId, line, column);
// evaluates the expression:
result = EvalInternal("return ", code, ";", EvalKinds.Assert, context, definedVariables, self, includer, descriptor, false, namingContext);
// restores error reporting if eval have been quite:
if (context.Config.Assertion.Quiet) context.EnableErrorReporting();
}
else
{
result = assertion;
}
// checks the result of assertion:
return CheckAssertion(result, code, context, containingSourcePath, line, column, namingContext);
}