Beispiel #1
0
        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--;
        }
Beispiel #2
0
 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;
 }
Beispiel #3
0
 private void CompileBlockEnd(LocalDefinition[] locals)
 {
     foreach (LocalDefinition definition in locals)
     {
         this._locals.UndefineLocal(definition, this._instructions.Count);
     }
 }
Beispiel #4
0
 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--;
 }