internal HoistedLocals(HoistedLocals parent, ReadOnlyCollection <ParameterExpression> vars) { if (parent != null) { // Add the parent locals array as the 0th element in the array vars = new TrueReadOnlyCollection <ParameterExpression>(vars.AddFirst(parent.SelfVariable)); } Dictionary <Expression, int> indexes = new Dictionary <Expression, int>(vars.Count); for (int i = 0; i < vars.Count; i++) { indexes.Add(vars[i], i); } SelfVariable = Expression.Variable(typeof(object[]), null); Parent = parent; Variables = vars; Indexes = new System.Dynamic.Utils.ReadOnlyDictionary <Expression, int>(indexes); }
internal HoistedLocals(HoistedLocals parent, ReadOnlyCollection<ParameterExpression> vars) { if (parent != null) { // Add the parent locals array as the 0th element in the array vars = new TrueReadOnlyCollection<ParameterExpression>(vars.AddFirst(parent.SelfVariable)); } Dictionary<Expression, int> indexes = new Dictionary<Expression, int>(vars.Count); for (int i = 0; i < vars.Count; i++) { indexes.Add(vars[i], i); } SelfVariable = Expression.Variable(typeof(object[]), null); Parent = parent; Variables = vars; Indexes = new System.Dynamic.Utils.ReadOnlyDictionary<Expression, int>(indexes); }