private ToTemp ( Expression expression, Expression &save, bool byRef ) : ParameterExpression | ||
expression | Expression | The expression to store in a temporary variable. |
save | Expression | An expression that assigns the |
byRef | bool | Indicates whether the |
Résultat | ParameterExpression |
/// <summary> /// Called after all child expressions have been added using <see cref="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 <see cref="RewriteAction.SpillStack"/>. /// </summary> /// <example> /// When stack spilling the following expression: /// <c> /// bar.Foo(try { 42 } finally { ; }) /// </c> /// this method will populate the comma with the rewritten child expressions: /// <c> /// $temp$0 = bar /// $temp$1 = try { 42 } finally { ; } /// </c> /// The final expression evaluating <c>bar.Foo(...)</c> will get added by the /// <see cref="Finish"/> method prior to wrapping the comma in a block /// expression. /// </example> private void EnsureDone() { // Done adding child expressions, build the comma if necessary. if (!_done) { _done = true; if (_action == RewriteAction.SpillStack) { Expression[] clone = _expressions; int count = _lastSpillIndex + 1; List <Expression> comma = new List <Expression>(count + 1); for (int i = 0; i < count; i++) { Expression current = clone[i]; if (ShouldSaveToTemp(current)) { Expression temp; clone[i] = _self.ToTemp(current, out temp, _byRefs?[i] ?? false); comma.Add(temp); } } comma.Capacity = comma.Count + 1; _comma = comma; } } }
private void EnsureDone() { // done adding arguments, build the comma if necessary if (!_done) { _done = true; if (_action == RewriteAction.SpillStack) { Expression[] clone = _expressions; int count = clone.Length; List <Expression> comma = new List <Expression>(count + 1); for (int i = 0; i < count; i++) { if (clone[i] != null) { Expression temp; clone[i] = _self.ToTemp(clone[i], out temp); comma.Add(temp); } } comma.Capacity = comma.Count + 1; _comma = comma; } } }
private void EnsureDone() { // Done adding child expressions, build the comma if necessary. if (_done) { return; } _done = true; if (Action != RewriteAction.SpillStack) { return; } var clone = _expressions; var count = _lastSpillIndex + 1; var comma = new List <Expression>(count + 1); for (var index = 0; index < count; index++) { var current = clone[index]; if (current == null || !ShouldSaveToTemp(current)) { continue; } clone[index] = _self.ToTemp(current, out var temp, _byRefs?[index] ?? false); comma.Add(temp); } comma.Capacity = comma.Count + 1; _comma = comma; }