Ejemplo n.º 1
0
        private static bool HandleStores(string opcodeStr, Instruction instruction,
                                         MetaMidRepresentationOperationFactory operationFactory)
        {
            if (opcodeStr == "stloc.s" || opcodeStr == "stloc")
            {
                operationFactory.CopyStackIntoLocalVariable(instruction.GetIntOperand());
                return(true);
            }
            if (opcodeStr.StartsWith("stloc."))
            {
                var pushedIntValue = opcodeStr.Remove(0, "stloc.".Length).ToInt();
                operationFactory.CopyStackIntoLocalVariable(pushedIntValue);
                return(true);
            }

            if (opcodeStr.StartsWith("starg."))
            {
                var parameter      = (ParameterInfo)instruction.Operand;
                var pushedIntValue = parameter.Position;
                operationFactory.CopyStackIntoArgument(pushedIntValue);
                return(true);
            }

            if (opcodeStr == "stfld")
            {
                var fieldInfo = (FieldInfo)instruction.Operand;
                operationFactory.StoreField(fieldInfo);
                return(true);
            }
            return(false);
        }