Class ScopedExpressionVisitor<TState>
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> : ScopedExpressionVisitorBase
Type Parameters
| Name | Description |
|---|---|
| TState | Type of the state objects that will be associated with parameter expressions during the expression tree visit. |
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. |