Esempio n. 1
0
 internal LocalVariable AddClosureVariable(ParameterExpression variable)
 {
     if (this._closureVariables == null)
     {
         this._closureVariables = new Dictionary<ParameterExpression, LocalVariable>();
     }
     LocalVariable variable2 = new LocalVariable(this._closureVariables.Count, true, false);
     this._closureVariables.Add(variable, variable2);
     return variable2;
 }
Esempio n. 2
0
 public LocalDefinition DefineLocal(ParameterExpression variable, int start)
 {
     VariableScope scope;
     VariableScope scope2;
     LocalVariable variable2 = new LocalVariable(this._localCount++, false, false);
     this._maxLocalCount = Math.Max(this._localCount, this._maxLocalCount);
     if (this._variables.TryGetValue(variable, out scope))
     {
         scope2 = new VariableScope(variable2, start, scope);
         if (scope.ChildScopes == null)
         {
             scope.ChildScopes = new List<VariableScope>();
         }
         scope.ChildScopes.Add(scope2);
     }
     else
     {
         scope2 = new VariableScope(variable2, start, null);
     }
     this._variables[variable] = scope2;
     return new LocalDefinition(variable2.Index, variable);
 }
Esempio n. 3
0
 public VariableScope(LocalVariable variable, int start, VariableScope parent)
 {
     Variable = variable;
     Start    = start;
     Parent   = parent;
 }
Esempio n. 4
0
 public VariableScope(LocalVariable variable, int start, LocalVariables.VariableScope parent)
 {
     this.Variable = variable;
     this.Start = start;
     this.Parent = parent;
 }
Esempio n. 5
0
 public bool TryGetLocalOrClosure(ParameterExpression var, out LocalVariable local)
 {
     VariableScope scope;
     if (this._variables.TryGetValue(var, out scope))
     {
         local = scope.Variable;
         return true;
     }
     if ((this._closureVariables != null) && this._closureVariables.TryGetValue(var, out local))
     {
         return true;
     }
     local = null;
     return false;
 }
Esempio n. 6
0
 public VariableScope(LocalVariable variable, int start, LocalVariables.VariableScope parent)
 {
     this.Variable = variable;
     this.Start    = start;
     this.Parent   = parent;
 }
Esempio n. 7
0
 public VariableScope(LocalVariable variable, int start, VariableScope parent)
 {
     Variable = variable;
     Start = start;
     Parent = parent;
 }
Esempio n. 8
0
 internal LocalVariable AddClosureVariable(ParameterExpression variable)
 {
     if (_closureVariables == null)
     {
         _closureVariables = new Dictionary<ParameterExpression, LocalVariable>();
     }
     LocalVariable result = new LocalVariable(_closureVariables.Count, true, false);
     _closureVariables.Add(variable, result);
     return result;
 }
Esempio n. 9
0
        public LocalDefinition DefineLocal(ParameterExpression variable, int start)
        {
            //ContractUtils.RequiresNotNull(variable, "variable");
            //ContractUtils.Requires(start >= 0, "start", "start must be positive");

            LocalVariable result = new LocalVariable(_localCount++, false, false);
            _maxLocalCount = System.Math.Max(_localCount, _maxLocalCount);

            VariableScope existing, newScope;
            if (_variables.TryGetValue(variable, out existing))
            {
                newScope = new VariableScope(result, start, existing);
                if (existing.ChildScopes == null)
                {
                    existing.ChildScopes = new List<VariableScope>();
                }
                existing.ChildScopes.Add(newScope);
            }
            else
            {
                newScope = new VariableScope(result, start, null);
            }

            _variables[variable] = newScope;
            return new LocalDefinition(result.Index, variable);
        }