Ejemplo n.º 1
0
        public InsnMatcher <T> Arg <T2>(out T2 operand, [CanBeNull] ArgPredicate <T2> argPredicate = null)
            where T2 : class, IOperand
        {
            operand = null;

            if (!_matcher.Matches)
            {
                return(this);
            }

            if (_instruction == null)
            {
                throw new NullReferenceException("Matcher matches, but instruction is null");
            }

            if (++_argIndex > _instruction.Operands.Length)
            {
                _matcher.Matches = false;
            }

            if (!_matcher.Matches)
            {
                return(this);
            }

            operand = _instruction.Operands[_argIndex - 1] as T2;
            if (operand == null)
            {
                _matcher.Matches = false;
            }

            if (operand != null && argPredicate != null && _matcher.Matches)
            {
                _matcher.Matches = argPredicate(_instruction, operand);
            }

            if (!_matcher.Matches)
            {
                operand = null;
            }

            return(this);
        }
Ejemplo n.º 2
0
 public InsnMatcher <T> Arg <T2>([CanBeNull] ArgPredicate <T2> argPredicate = null) where T2 : class, IOperand
 {
     return(Arg(out _, argPredicate));
 }