Class ScopedExpressionVisitor<TState, TExpression, TLambdaExpression, TParameterExpression, TNewExpression, TElementInit, TMemberBinding, TMemberAssignment, TMemberListBinding, TMemberMemberBinding, TCatchBlock, TSwitchCase, TLabelTarget>
Expression visitor with scope tracking for ParameterExpression nodes.
Inheritance
Inherited Members
Namespace: System.Linq.CompilerServices
Assembly: Nuqleon.Linq.CompilerServices.dll
Syntax
public abstract class ScopedExpressionVisitor<TState, TExpression, TLambdaExpression, TParameterExpression, TNewExpression, TElementInit, TMemberBinding, TMemberAssignment, TMemberListBinding, TMemberMemberBinding, TCatchBlock, TSwitchCase, TLabelTarget> : ScopedExpressionVisitorBase<TExpression, TLambdaExpression, TParameterExpression, TNewExpression, TElementInit, TMemberBinding, TMemberAssignment, TMemberListBinding, TMemberMemberBinding, TCatchBlock, TSwitchCase, TLabelTarget> where TLambdaExpression : TExpression where TParameterExpression : TExpression where TNewExpression : TExpression where TMemberAssignment : TMemberBinding where TMemberListBinding : TMemberBinding where TMemberMemberBinding : TMemberBinding
Type Parameters
Name | Description |
---|---|
TState | Type of the state objects that will be associated with parameter expressions during the expression tree visit. |
TExpression | Target type for expressions. |
TLambdaExpression | Target type for lambda expressions. This type has to derive from TExpression. |
TParameterExpression | Target type for parameter expressions. This type has to derive from TExpression. |
TNewExpression | Target type for new expressions. This type has to derive from TExpression. |
TElementInit | Target type for element initializers. |
TMemberBinding | Target type for member bindings. |
TMemberAssignment | Target type for member assignments. This type has to derive from TMemberBinding. |
TMemberListBinding | Target type for member list bindings. This type has to derive from TMemberBinding. |
TMemberMemberBinding | Target type for member member bindings. This type has to derive from TMemberBinding. |
TCatchBlock | Target type for catch blocks. |
TSwitchCase | Target type for switch cases. |
TLabelTarget | Target type for label targets. |
Constructors
ScopedExpressionVisitor()
Creates a new expression visitor with scope tracking facilities.
Declaration
protected ScopedExpressionVisitor()
Properties
GlobalScope
Gets the global scope's symbol table which can be used to track unbound parameters.
Declaration
public SymbolTable<ParameterExpression, TState> GlobalScope { get; }
Property Value
Type | Description |
---|---|
SymbolTable<System.Linq.Expressions.ParameterExpression, TState> |
Methods
GetState(ParameterExpression)
Maps the specified parameter on state tracked in the scoped symbol table. This method gets called for each declaration site of a variable.
Declaration
protected abstract TState GetState(ParameterExpression parameter)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.ParameterExpression | parameter | Parameter expression that's being declared. |
Returns
Type | Description |
---|---|
TState | State to associate with the given parameter. |
Pop()
Pops a scope from the symbol table.
Declaration
protected override void Pop()
Overrides
Push(IEnumerable<KeyValuePair<ParameterExpression, TState>>)
Pushes a new scope in the symbol table.
Declaration
protected virtual void Push(IEnumerable<KeyValuePair<ParameterExpression, TState>> scope)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.Linq.Expressions.ParameterExpression, TState>> | scope | New scope to push in the symbol table. |
Push(IEnumerable<ParameterExpression>)
Pushes the parameters of a new declaration site into a new scope in the symbol table.
Declaration
protected override void Push(IEnumerable<ParameterExpression> parameters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Linq.Expressions.ParameterExpression> | parameters | Parameters of the declaration site. |
Overrides
TryLookup(ParameterExpression, out TState)
Looks up the state associated with the specified parameter expression by scanning the scoped symbol table, starting from the current scope.
Declaration
protected bool TryLookup(ParameterExpression parameter, out TState state)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.ParameterExpression | parameter | Parameter expression to look up. |
TState | state | State associated with the specified parameter expression. |
Returns
Type | Description |
---|---|
System.Boolean | true if the symbol was found; otherwise, false. |