예제 #1
0
		public override ICodeNode VisitMethodInvocationExpression (MethodInvocationExpression node)
		{
			var method_ref = node.Method as MethodReferenceExpression;
			if (method_ref == null)
				return base.VisitMethodInvocationExpression (node);

			//var method = method_ref.Method.Resolve ();
			var method = method_ref.Method as MethodDefinition;
			if (method == null)
				return base.VisitMethodInvocationExpression (node);

			if (method.IsGetter)
				return ProcessGetter (method_ref, method);
			else if (method.IsSetter)
				return ProcessSetter (node, method_ref, method);
			else
				return base.VisitMethodInvocationExpression (node);
		}
예제 #2
0
파일: OperatorStep.cs 프로젝트: chkn/cecil
		public override ICodeNode VisitMethodInvocationExpression (MethodInvocationExpression node)
		{
			var method_reference = node.Method as MethodReferenceExpression;
			if (method_reference == null)
				goto skip;

			var method = method_reference.Method;

			BinaryOperator binary_operator;
			if (binary_operators.TryGetValue (method.Name, out binary_operator))
				return BuildBinaryExpression (binary_operator, node.Arguments [0], node.Arguments [1]);

			UnaryOperator unary_operator;
			if (unary_operators.TryGetValue (method.Name, out unary_operator))
				return BuildUnaryExpression (unary_operator, node.Arguments [0]);

		skip:
			return base.VisitMethodInvocationExpression (node);
		}
예제 #3
0
파일: TypeOfStep.cs 프로젝트: chkn/cecil
		public override ICodeNode VisitMethodInvocationExpression (MethodInvocationExpression node)
		{
			var method_ref = node.Method as MethodReferenceExpression;
			if (method_ref == null)
				goto skip;

			var method = method_ref.Method;
			if (method.DeclaringType.FullName != "System.Type" || method.Name != "GetTypeFromHandle")
				goto skip;

			if (node.Arguments.Count != 1)
				goto skip;

			var type_ref = node.Arguments [0] as TypeReferenceExpression;
			if (type_ref == null)
				goto skip;

			return new TypeOfExpression (type_ref.Type);

		skip:
			return base.VisitMethodInvocationExpression (node);
		}
예제 #4
0
		public override ICodeNode VisitMethodInvocationExpression (MethodInvocationExpression node)
		{
			var method_ref = node.Method as MethodReferenceExpression;
			if (method_ref == null)
				goto skip;
			
			var method = method_ref.Method;
			if (method.Name != "Invoke")
				goto skip;
			
			if (!method.DeclaringType.Resolve ().IsDelegate ())
				goto skip;

			var invoke = new DelegateInvocationExpression (method_ref.Target);
			
			invoke.Arguments = node.Arguments;
			
			return invoke;

		skip:
			return base.VisitMethodInvocationExpression (node);
		}
예제 #5
0
        public override ICodeNode VisitMethodInvocationExpression(MethodInvocationExpression node)
        {
            try
            {
                var method_reference = node.Method as MethodReferenceExpression;
                if (method_reference == null)
                    return base.VisitMethodInvocationExpression(node);

                BinaryOperator binary_operator;
                if (binary_operators.TryGetValue(method_reference.Method.Name, out binary_operator))
                    return BuildBinaryExpression(binary_operator, node.Arguments[0], node.Arguments[1]);

                UnaryOperator unary_operator;
                if (unary_operators.TryGetValue(method_reference.Method.Name, out unary_operator))
                    return BuildUnaryExpression(unary_operator, node.Arguments[0]);

                return base.VisitMethodInvocationExpression(node);
            }
            catch (System.Exception ex)
            {
                return null;
            }
        }
		public override void VisitMethodInvocationExpression (MethodInvocationExpression node)
		{
			Visit (node.Method);
			WriteToken ("(");
			VisitList (node.Arguments);
			WriteToken (")");
		}
예제 #7
0
		public virtual void VisitMethodInvocationExpression (MethodInvocationExpression node)
		{
			Visit (node.Method);
			Visit (node.Arguments);
		}
예제 #8
0
		static AssignExpression ProcessSetter (MethodInvocationExpression invoke, MethodReferenceExpression method_ref, MethodDefinition method)
		{
			return new AssignExpression (
				CreatePropertyReferenceFromMethod (method_ref, method),
				invoke.Arguments [0]);
		}
예제 #9
0
 public virtual void VisitMethodInvocationExpression(MethodInvocationExpression node)
 {
     Visit(node.Method);
     Visit(node.Arguments);
 }
예제 #10
0
 public virtual ICodeNode VisitMethodInvocationExpression(MethodInvocationExpression node)
 {
     node.Method    = (Expression)Visit(node.Method);
     node.Arguments = (ExpressionCollection)Visit(node.Arguments);
     return(node);
 }