public WithCheckForOverflow ( bool checkForOverflow ) : CSharpResolver | ||
checkForOverflow | bool | |
Résultat | CSharpResolver |
public CSharpResolver WithCheckForOverflow(bool checkForOverflow)
{
if (checkForOverflow == this.checkForOverflow)
return this;
return new CSharpResolver(compilation, conversions, context, checkForOverflow, isWithinLambdaExpression, currentTypeDefinitionCache, localVariableStack, objectInitializerStack);
}
public void AdditionWithOverflow() { AssertConstant(int.MinValue, resolver.WithCheckForOverflow(false).ResolveBinaryOperator( BinaryOperatorType.Add, MakeConstant(int.MaxValue), MakeConstant(1))); AssertError(typeof(int), resolver.WithCheckForOverflow(true).ResolveBinaryOperator( BinaryOperatorType.Add, MakeConstant(int.MaxValue), MakeConstant(1))); }