예제 #1
0
 public VariableScope(LocalVariable variable, int start, VariableScope parent)
 {
     Variable = variable;
     Start = start;
     Parent = parent;
 }
예제 #2
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;
 }
예제 #3
0
        public bool TryGetLocalOrClosure(ParameterExpression var, out LocalVariable local)
        {
            VariableScope scope;
            if (_variables.TryGetValue(var, out scope))
            {
                local = scope.Variable;
                return true;
            }
            if (_closureVariables != null && _closureVariables.TryGetValue(var, out local))
            {
                return true;
            }

            local = null;
            return false;
        }
예제 #4
0
        public LocalDefinition DefineLocal(ParameterExpression variable, int start)
        {
            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);
        }
예제 #5
0
 public VariableScope(LocalVariable variable, int start, VariableScope?parent)
 {
     Variable = variable;
     Start    = start;
     Parent   = parent;
 }
예제 #6
0
 public ParameterByRefUpdater(LocalVariable parameter, int argumentIndex)
     : base(argumentIndex)
 {
     _parameter = parameter;
 }