Show / Hide Table of Contents

Interface ISemanticProvider

Interface representing a provider of semantic information about expressions and reflection objects.

Namespace: System.Linq.Expressions
Assembly: Nuqleon.Linq.Expressions.Optimizers.dll
Syntax
public interface ISemanticProvider

Methods

AllBitsOne(Expression)

Checks if the specified expression represents a value where all bits are one (1).

Declaration
bool AllBitsOne(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

The expression to check.

Returns
Type Description
System.Boolean

true if the specified expression represents a value where all bits are one (1); otherwise, false.

AllBitsZero(Expression)

Checks if the specified expression represents a value where all bits are zero (0).

Declaration
bool AllBitsZero(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

The expression to check.

Returns
Type Description
System.Boolean

true if the specified expression represents a value where all bits are zero (0); otherwise, false.

AlwaysThrows(Expression)

Checks if the specified expression represents an unconditional throw of an exception with no other side-effects.

Declaration
bool AlwaysThrows(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

The expression to check.

Returns
Type Description
System.Boolean

true if the specified expression represents an unconditional throw; otherwise, false.

GetConstantValue(Expression)

Gets the constant value represented by the specified expression.

Declaration
object GetConstantValue(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

The expression to get a constant value for.

Returns
Type Description
System.Object

The constant value represented by the specified expression.

HasConstantValue(Expression)

Checks if the specified expression represents a constant value.

Declaration
bool HasConstantValue(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression
Returns
Type Description
System.Boolean

true if the specified expression represents a constant value; otherwise, false.

Remarks

If this method returns true for a given expression, a subsequent call to GetConstantValue(Expression) should be able to obtain the constant value that's represented by the expression.

IsAlwaysNull(Expression)

Checks if the specified expression represents a null reference.

Declaration
bool IsAlwaysNull(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

The expression to check.

Returns
Type Description
System.Boolean

true if the specified expression represents a null reference; otherwise, false.

IsConst(ParameterInfo)

Checks if the specified parameter uses the argument in a const (readonly) fashion, i.e. it doesn't cause any mutation to the argument passed to it.

Declaration
bool IsConst(ParameterInfo parameter)
Parameters
Type Name Description
System.Reflection.ParameterInfo parameter

The parameter to check.

Returns
Type Description
System.Boolean

true if the specified parameter has const behavior; otherwise, false.

IsFalse(Expression)

Checks if the specified expression represents a false value.

Declaration
bool IsFalse(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

The expression to check.

Returns
Type Description
System.Boolean

true if the specified expression represents a false value; otherwise, false.

IsIdentityFunction(Expression)

Checks if the specified expression represents an identity function.

Declaration
bool IsIdentityFunction(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

The expression to check.

Returns
Type Description
System.Boolean

true if the specified expression represents an identity function; otherwise, false.

IsImmutable(Type)

Checks if instances of the specified type are immutable.

Declaration
bool IsImmutable(Type type)
Parameters
Type Name Description
System.Type type

The type to check.

Returns
Type Description
System.Boolean

true if the specified type is immutable; otherwise, false.

IsMaxValue(Expression)

Checks if the specified expression represents a maximum value, such as System.Int32.MaxValue.

Declaration
bool IsMaxValue(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

The expression to check.

Returns
Type Description
System.Boolean

true if the specified expression represents a maximum value; otherwise, false.

IsMinValue(Expression)

Checks if the specified expression represents a minimum value, such as System.Int32.MinValue.

Declaration
bool IsMinValue(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

The expression to check.

Returns
Type Description
System.Boolean

true if the specified expression represents a minimum value; otherwise, false.

IsNeverNull(Expression)

Checks if the specified expression is guaranteed to evaluate to a non-null value.

Declaration
bool IsNeverNull(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

The expression to check.

Returns
Type Description
System.Boolean

true if the specified expression cannot evaluate to null; otherwise, false.

Remarks

Note that this method can return true even if the specified expression may throw an exception.

IsOne(Expression)

Checks if the specified expression represents a one (1) value.

Declaration
bool IsOne(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

The expression to check.

Returns
Type Description
System.Boolean

true if the specified expression represents a one (1) value; otherwise, false.

IsPure(Expression)

Checks if the specified expression does not have any side-effects for evaluation.

Declaration
bool IsPure(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

The expression to check.

Returns
Type Description
System.Boolean

true if the specified expression is considered pure; otherwise, false.

Remarks

Any node for which this method returns true is not allowed to throw a synchronous exception.

IsPure(MemberInfo)

Checks if the specified member is pure and doesn't have any side-effects for evaluation.

Declaration
bool IsPure(MemberInfo member)
Parameters
Type Name Description
System.Reflection.MemberInfo member

The member to check.

Returns
Type Description
System.Boolean

true if the specified member is considered pure; otherwise, false.

Remarks

Pure members can be evaluated at compile time if all operands passed to them are constant values that can be obtained at runtime. The member is allowed to throw an exception (provided this behavior is deterministic), causing the expression optimizer to either suppress optimizing the node or to replace the subexpression with a System.Linq.Expressions.ExpressionType.Throw node.

Note that members should not be reported as pure if their result is a mutable object. All evaluations of the optimized tree containing such a member would share the resulting object.

IsTrue(Expression)

Checks if the specified expression represents a true value.

Declaration
bool IsTrue(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

The expression to check.

Returns
Type Description
System.Boolean

true if the specified expression represents a true value; otherwise, false.

IsZero(Expression)

Checks if the specified expression represents a zero (0) value.

Declaration
bool IsZero(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

The expression to check.

Returns
Type Description
System.Boolean

true if the specified expression represents a zero (0) value; otherwise, false.

NeverThrows(Expression)

Checks if the specified expression can never throw.

Declaration
bool NeverThrows(Expression expression)
Parameters
Type Name Description
System.Linq.Expressions.Expression expression

The expression to check.

Returns
Type Description
System.Boolean

true if the specified expression can never throw an exception; otherwise, false.

NeverThrows(MemberInfo)

Checks if the specified member can never throw.

Declaration
bool NeverThrows(MemberInfo member)
Parameters
Type Name Description
System.Reflection.MemberInfo member

The member to check.

Returns
Type Description
System.Boolean

true if the specified member can never throw an exception; otherwise, false.

In This Article
Back to top Generated by DocFX