public void UndefineLocal(LocalDefinition definition, int end) { var scope = _variables[definition.Parameter]; scope.Stop = end; if (scope.Parent != null) { _variables[definition.Parameter] = scope.Parent; } else { _variables.Remove(definition.Parameter); } _localCount--; }
private LocalDefinition[] CompileBlockStart(BlockExpression node) { LocalDefinition[] emptyLocals; int count = this._instructions.Count; ReadOnlyCollection<ParameterExpression> variables = node.Variables; if (variables.Count != 0) { emptyLocals = new LocalDefinition[variables.Count]; int num2 = 0; foreach (ParameterExpression expression in variables) { LocalDefinition definition = this._locals.DefineLocal(expression, count); emptyLocals[num2++] = definition; this._instructions.EmitInitializeLocal(definition.Index, expression.Type); } } else { emptyLocals = EmptyLocals; } for (int i = 0; i < (node.Expressions.Count - 1); i++) { this.CompileAsVoid(node.Expressions[i]); } return emptyLocals; }
private void CompileBlockEnd(LocalDefinition[] locals) { foreach (LocalDefinition definition in locals) { this._locals.UndefineLocal(definition, this._instructions.Count); } }
public void UndefineLocal(LocalDefinition definition, int end) { VariableScope scope = this._variables[definition.Parameter]; scope.Stop = end; if (scope.Parent != null) { this._variables[definition.Parameter] = scope.Parent; } else { this._variables.Remove(definition.Parameter); } this._localCount--; }