コード例 #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
ファイル: DelegateInvokeStep.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.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
ファイル: RebuildOperators.cs プロジェクト: pusp/o2platform
        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;
            }
        }
コード例 #6
0
		public override void VisitMethodInvocationExpression (MethodInvocationExpression node)
		{
			Visit (node.Method);
			WriteToken ("(");
			VisitList (node.Arguments);
			WriteToken (")");
		}
コード例 #7
0
ファイル: BaseCodeVisitor.cs プロジェクト: chkn/cecil
		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);
 }