public override ICodeNode VisitMethodInvocationExpression(MethodInvocationExpression node) { Expression methodTarget = node.GetTarget(); if (methodTarget != null) { if (methodTarget.CodeNodeType == CodeNodeType.VariableReferenceExpression) { VariableReference variable = (methodTarget as VariableReferenceExpression).Variable; if (this.variableToReplacingExpressionMap.ContainsKey(variable)) { this.variablesToNotInline.Add(variable); } } else if (methodTarget.CodeNodeType == CodeNodeType.FieldReferenceExpression) { FieldDefinition field = (methodTarget as FieldReferenceExpression).Field.Resolve(); if (this.fieldToReplacingExpressionMap.ContainsKey(field)) { VariableReference variableToNotInline = (this.fieldToReplacingExpressionMap[field] as VariableReferenceExpression).Variable; this.variablesToNotInline.Add(variableToNotInline); } } } return(base.VisitMethodInvocationExpression(node)); }
public override ICodeNode VisitMethodInvocationExpression(MethodInvocationExpression node) { V_0 = node.GetTarget(); if (V_0 != null) { if (V_0.get_CodeNodeType() != 26) { if (V_0.get_CodeNodeType() == 30) { V_2 = (V_0 as FieldReferenceExpression).get_Field().Resolve(); if (this.fieldToReplacingExpressionMap.ContainsKey(V_2)) { V_3 = (this.fieldToReplacingExpressionMap.get_Item(V_2) as VariableReferenceExpression).get_Variable(); dummyVar1 = this.variablesToNotInline.Add(V_3); } } } else { V_1 = (V_0 as VariableReferenceExpression).get_Variable(); if (this.variableToReplacingExpressionMap.ContainsKey(V_1)) { dummyVar0 = this.variablesToNotInline.Add(V_1); } } } return(this.VisitMethodInvocationExpression(node)); }
private void ProcessMethodInvocation(MethodInvocationExpression methodInvocationExpression) { Expression methodTarget = methodInvocationExpression.GetTarget(); if (methodTarget == null) { return; } VariableReferenceExpression variableReference; if (methodTarget.CodeNodeType == CodeNodeType.VariableReferenceExpression) { variableReference = methodTarget as VariableReferenceExpression; } // This handles the case where an method is called on a primitive type. else if (methodTarget.CodeNodeType == CodeNodeType.UnaryExpression) { UnaryExpression outerUnary = methodTarget as UnaryExpression; if (outerUnary.Operator != UnaryOperator.AddressDereference || outerUnary.Operand.CodeNodeType != CodeNodeType.UnaryExpression) { return; } UnaryExpression innerUnary = outerUnary.Operand as UnaryExpression; if (innerUnary.Operator != UnaryOperator.AddressReference || innerUnary.Operand.CodeNodeType != CodeNodeType.VariableReferenceExpression) { return; } variableReference = innerUnary.Operand as VariableReferenceExpression; } else { return; } ProcessVariableReferenceExpression(variableReference); }