예제 #1
0
        /// <summary>
        /// Gets a local variable reference used in an instruction starting at the given offset, to a variable with given index in the stack frame.
        /// </summary>
        private LocalVariableReference GetLocalVariable(int instructionOffset, int index, string name, TypeReference type)
        {
            foreach (var entry in localVariableMap)
            {
                if (/*entry.Item1.IsValidForOffset(instructionOffset) &&*/ (entry.Item1.Index == index))
                {
                    return entry.Item2;
                }
            }

            // Not found, create a new one
            var v = new LocalVariable(0, code.Length, name, type, index);
            var varRef = new LocalVariableReference(method, index);
            localVariableMap.Add(Tuple.Create(v, varRef));
            return varRef;
        }
예제 #2
0
 /// <summary>
 /// Default ctor
 /// </summary>
 private ParameterWrapper(LocalVariableReference parameter)
 {
     this.parameter = parameter;
     name = "P" + parameter.Index;
 }