C# Класс System.Linq.Expressions.Compiler.StackSpiller.ChildRewriter

Rewrites child expressions, spilling them into temps if needed. The stack starts in the inital state, and after the first subexpression is added it is change to non-empty. This behavior can be overridden by setting the stack manually between adds. When all children have been added, the caller should rewrite the node if Rewrite is true. Then, it should call Finish with etiher the orignal expression or the rewritten expression. Finish will call Expression.Comma if necessary and return a new Result.
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
Add void
Add void
AddArguments void
ChildRewriter System.Collections.Generic
EnsureDone void
Finish System.Result
MarkRef void
MarkRefArgs void
MarkRefInstance void
ShouldSaveToTemp bool
this Expression
this Expression[]

Приватные методы

Метод Описание
Add ( Expression expression ) : void

Adds a child expression to the rewriter, causing it to be rewritten using the parent stack spiller, and the evaluation stack state and rewrite action to be updated accordingly.

Add ( ReadOnlyCollection expressions ) : void

Adds child expressions to the rewriter, causing them to be rewritten using the parent stack spiller, and the evaluation stack state and rewrite action to be updated accordingly.

AddArguments ( IArgumentProvider expressions ) : void

Adds child expressions provided through an argument provider to the rewriter, causing them to be rewritten using the parent stack spiller, and the evaluation stack state and rewrite action to be updated accordingly.

ChildRewriter ( StackSpiller self, Stack stack, int count ) : System.Collections.Generic

Creates a new child rewriter instance using the specified initial evaluation stack state and the number of child expressions specified in count.

EnsureDone ( ) : void

Called after all child expressions have been added using Add invocations, causing the comma to be populated with the rewritten child expressions and necessary assignments to temporary variables. A comma is only built when the rewrite action is RewriteAction.SpillStack.

Finish ( Expression expression ) : System.Result

Rewrites the parent expression where any stack spilled child expressions have been substituted for temporary variables, and returns the rewrite result to the caller.

MarkRef ( int index ) : void

Marks the child expression in at the specified index as having a ByRef value.

MarkRefArgs ( MethodBase method, int startIndex ) : void

Marks child expressions representing arguments bound to parameters of the specified method as ByRef values if needed.

MarkRefInstance ( Expression expr ) : void

Marks the child expression representing the instance as a ByRef value.

ShouldSaveToTemp ( Expression expression ) : bool

Checks whether the given expression representing a child expression should be saved in a temporary variable upon spilling the stack. If the expression has no have side-effects, the introduction of a temporary variable can be avoided, reducing the number of locals.

this ( int index ) : Expression

Gets the rewritten child expression at the specified index, used to rewrite the parent expression. In case stack spilling has taken place, the returned expression will be a temporary variable.

this ( int first, int last ) : Expression[]

Gets the rewritten child expressions between the specified first and last (inclusive) indexes, used to rewrite the parent expression. In case stack spilling has taken place, the returned expressions will contain temporary variables.