Show / Hide Table of Contents

Class ExpressionMemberAllowListScannerBase

Base class for expression visitors used to check uses of type members against a list of allowed members.

Inheritance
System.Object
ExpressionMemberAllowListScannerBase
ExpressionMemberAllowListScanner
Namespace: System.Linq.CompilerServices
Assembly: Nuqleon.Linq.CompilerServices.dll
Syntax
public abstract class ExpressionMemberAllowListScannerBase : ExpressionVisitor

Constructors

ExpressionMemberAllowListScannerBase()

Declaration
protected ExpressionMemberAllowListScannerBase()

Methods

Check(MemberInfo)

Checks whether the specified member is supported.

Declaration
protected abstract bool Check(MemberInfo member)
Parameters
Type Name Description
System.Reflection.MemberInfo member

Member to check.

Returns
Type Description
System.Boolean

true if the member is supported; otherwise, false.

CheckElementInit(ElementInit, Func<ElementInit, ElementInit>)

Checks whether the add method used in an element initializer is on the list of allowed members.

Declaration
protected virtual ElementInit CheckElementInit(ElementInit initializer, Func<ElementInit, ElementInit> visit)
Parameters
Type Name Description
System.Linq.Expressions.ElementInit initializer

Element initializer to check.

System.Func<System.Linq.Expressions.ElementInit, System.Linq.Expressions.ElementInit> visit

Function to continue the visit of the node.

Returns
Type Description
System.Linq.Expressions.ElementInit

The original node if the element initializer was accepted by the checker; otherwise, a rewritten result or an exception.

CheckExpression<T>(T, MemberInfo, Func<T, Expression>)

Checks whether a member used in an expression is on the list of allowed members.

Declaration
protected virtual Expression CheckExpression<T>(T expression, MemberInfo member, Func<T, Expression> visit)
    where T : Expression
Parameters
Type Name Description
T expression

Expression to check.

System.Reflection.MemberInfo member

Member used by the expression.

System.Func<T, System.Linq.Expressions.Expression> visit

Function to continue the visit of the node.

Returns
Type Description
System.Linq.Expressions.Expression

The original node if the expression was accepted by the checker; otherwise, a rewritten result or an exception.

Type Parameters
Name Description
T

Type of the expression to check.

CheckMemberBinding<T>(T, Func<T, MemberBinding>)

Checks whether the member used in a member binding is on the list of allowed members.

Declaration
protected virtual MemberBinding CheckMemberBinding<T>(T memberBinding, Func<T, MemberBinding> visit)
    where T : MemberBinding
Parameters
Type Name Description
T memberBinding

Member binding to check.

System.Func<T, System.Linq.Expressions.MemberBinding> visit

Function to continue the visit of the node.

Returns
Type Description
System.Linq.Expressions.MemberBinding

The original node if the member binding was accepted by the checker; otherwise, a rewritten result or an exception.

Type Parameters
Name Description
T

Type of the member binding to check.

ResolveElementInit(ElementInit, Func<ElementInit, ElementInit>)

Resolves an element initializer whose add method was rejected by the checker.

Declaration
protected virtual ElementInit ResolveElementInit(ElementInit initializer, Func<ElementInit, ElementInit> visit)
Parameters
Type Name Description
System.Linq.Expressions.ElementInit initializer

Element initializer to resolve.

System.Func<System.Linq.Expressions.ElementInit, System.Linq.Expressions.ElementInit> visit

Function to continue the visit of the node.

Returns
Type Description
System.Linq.Expressions.ElementInit

Resolved element initializer, or an exception. By default, the method throws a NotSupportedException.

Exceptions
Type Condition
System.NotSupportedException

The specified element initializer was rejected.

ResolveExpression<T>(T, MemberInfo, Func<T, Expression>)

Resolves an expression whose member was rejected by the checker.

Declaration
protected virtual Expression ResolveExpression<T>(T expression, MemberInfo member, Func<T, Expression> visit)
    where T : Expression
Parameters
Type Name Description
T expression

Expression to resolve.

System.Reflection.MemberInfo member

Member that was rejected.

System.Func<T, System.Linq.Expressions.Expression> visit

Function to continue the visit of the node.

Returns
Type Description
System.Linq.Expressions.Expression

Resolved expression, or an exception. By default, the method throws a NotSupportedException.

Type Parameters
Name Description
T

Type the expression to resolve.

Exceptions
Type Condition
System.NotSupportedException

The specified expression was rejected.

ResolveMemberBinding<T>(T, Func<T, MemberBinding>)

Resolves a member binding whose member was rejected by the checker.

Declaration
protected virtual MemberBinding ResolveMemberBinding<T>(T binding, Func<T, MemberBinding> visit)
    where T : MemberBinding
Parameters
Type Name Description
T binding

Binding to resolve.

System.Func<T, System.Linq.Expressions.MemberBinding> visit

Function to continue the visit of the node.

Returns
Type Description
System.Linq.Expressions.MemberBinding

Resolved member binding, or an exception. By default, the method throws a NotSupportedException.

Type Parameters
Name Description
T

Type of the member binding to resolve.

Exceptions
Type Condition
System.NotSupportedException

The specified member binding was rejected.

VisitBinary(BinaryExpression)

Checks whether the binary expression node's method, if any, is on the list of allowed members.

Declaration
protected override Expression VisitBinary(BinaryExpression node)
Parameters
Type Name Description
System.Linq.Expressions.BinaryExpression node

Node to check.

Returns
Type Description
System.Linq.Expressions.Expression

The original node if the expression was accepted by the checker; otherwise, a rewritten result or an exception.

VisitElementInit(ElementInit)

Checks whether the element initializer node's add method is on the list of allowed members.

Declaration
protected override ElementInit VisitElementInit(ElementInit node)
Parameters
Type Name Description
System.Linq.Expressions.ElementInit node

Node to check.

Returns
Type Description
System.Linq.Expressions.ElementInit

The original node if the expression was accepted by the checker; otherwise, a rewritten result or an exception.

VisitIndex(IndexExpression)

Checks whether the index expression node's indexer is on the list of allowed members.

Declaration
protected override Expression VisitIndex(IndexExpression node)
Parameters
Type Name Description
System.Linq.Expressions.IndexExpression node

Node to check.

Returns
Type Description
System.Linq.Expressions.Expression

The original node if the expression was accepted by the checker; otherwise, a rewritten result or an exception.

VisitMember(MemberExpression)

Checks whether the member expression node's member is on the list of allowed members.

Declaration
protected override Expression VisitMember(MemberExpression node)
Parameters
Type Name Description
System.Linq.Expressions.MemberExpression node

Node to check.

Returns
Type Description
System.Linq.Expressions.Expression

The original node if the expression was accepted by the checker; otherwise, a rewritten result or an exception.

VisitMemberBinding(MemberBinding)

Checks whether the member binding node's member is on the list of allowed members.

Declaration
protected override MemberBinding VisitMemberBinding(MemberBinding node)
Parameters
Type Name Description
System.Linq.Expressions.MemberBinding node

Node to check.

Returns
Type Description
System.Linq.Expressions.MemberBinding

The original node if the expression was accepted by the checker; otherwise, a rewritten result or an exception.

VisitMethodCall(MethodCallExpression)

Checks whether the method call expression node's method is on the list of allowed members.

Declaration
protected override Expression VisitMethodCall(MethodCallExpression node)
Parameters
Type Name Description
System.Linq.Expressions.MethodCallExpression node

Node to check.

Returns
Type Description
System.Linq.Expressions.Expression

The original node if the expression was accepted by the checker; otherwise, a rewritten result or an exception.

VisitNew(NewExpression)

Checks whether the new expression node's constructor is on the list of allowed members.

Declaration
protected override Expression VisitNew(NewExpression node)
Parameters
Type Name Description
System.Linq.Expressions.NewExpression node

Node to check.

Returns
Type Description
System.Linq.Expressions.Expression

The original node if the expression was accepted by the checker; otherwise, a rewritten result or an exception.

VisitUnary(UnaryExpression)

Checks whether the unary expression node's method, if any, is on the list of allowed members.

Declaration
protected override Expression VisitUnary(UnaryExpression node)
Parameters
Type Name Description
System.Linq.Expressions.UnaryExpression node

Node to check.

Returns
Type Description
System.Linq.Expressions.Expression

The original node if the expression was accepted by the checker; otherwise, a rewritten result or an exception.

In This Article
Back to top Generated by DocFX