Ejemplo n.º 1
0
 private Instruction GetLoadField(FieldInfo field)
 {
     lock (s_loadFields)
     {
         Instruction instruction;
         if (!s_loadFields.TryGetValue(field, out instruction))
         {
             if (field.IsStatic)
             {
                 instruction = new LoadStaticFieldInstruction(field);
             }
             else
             {
                 instruction = new LoadFieldInstruction(field);
             }
             s_loadFields.Add(field, instruction);
         }
         return(instruction);
     }
 }
Ejemplo n.º 2
0
        private Instruction GetLoadField(FieldInfo field)
        {
            Instruction loadFieldInstruction = null;
            Instruction instruction;

            lock (InstructionList._loadFields)
            {
                if (!InstructionList._loadFields.TryGetValue(field, out loadFieldInstruction))
                {
                    if (!field.IsStatic)
                    {
                        loadFieldInstruction = new LoadFieldInstruction(field);
                    }
                    else
                    {
                        loadFieldInstruction = new LoadStaticFieldInstruction(field);
                    }
                    InstructionList._loadFields.Add(field, loadFieldInstruction);
                }
                instruction = loadFieldInstruction;
            }
            return(instruction);
        }