Пример #1
0
 public static StackPushInformation CreateFromArgument(string stackName, ArgumentInformation argument, bool isReference = false)
 {
     return(new StackPushInformation(stackName)
     {
         FromArgument = argument, IsReference = isReference
     });
 }
Пример #2
0
        private bool LdArgTransactions(Node node, IList <StackPushInformation> stackTransactions)
        {
            // Get argument index
            int argumentIndex = node.OpCode.GetArgumentIndex(node.Operand);

            if (node.Block.Method.Definition.HasThis)
            {
                // Handle this argument
                if (argumentIndex == 0)
                {
                    stackTransactions.Add(
                        StackPushInformation.CreateFromThisArgument(node.PushStackNames.Single(), node.Block.Method.Definition.DeclaringType));
                    return(true);
                }

                // Decrement with 1 to get correct argument
                argumentIndex--;
            }

            // Get argument
            ArgumentInformation argument = _argumentInformations[argumentIndex];
            bool isReference             = node.OpCode.Code == Code.Ldarga || node.OpCode.Code == Code.Ldarga_S;

            stackTransactions.Add(StackPushInformation.CreateFromArgument(node.PushStackNames.Single(), argument, isReference));
            return(true);
        }