public override void VisitBinaryExpression(BinaryExpression node) { V_0 = this.GetExpressionTypeName(node.get_Left()); V_1 = this.GetExpressionTypeName(node.get_Right()); this.VisitBinaryExpression(node); if (String.op_Inequality(this.GetExpressionTypeName(node.get_Left()), V_0)) { stackVariable16 = true; } else { stackVariable16 = String.op_Inequality(this.GetExpressionTypeName(node.get_Right()), V_1); } V_2 = stackVariable16; if (node.get_IsAssignmentExpression() || node.get_IsSelfAssign() && !node.get_IsEventHandlerAddOrRemove()) { V_3 = node.get_Left(); V_4 = node.get_Right(); if (V_4.get_HasType() && V_3.get_HasType()) { V_5 = V_3.get_ExpressionType(); V_6 = V_4.get_ExpressionType().Resolve(); if (this.ShouldAddCast(V_6, V_5)) { node.set_Right(new ExplicitCastExpression(V_4, V_5, null)); V_2 = true; } V_7 = V_5.Resolve(); if (V_7 != null && V_6 != null && V_7.get_IsEnum() && V_6.get_IsValueType() && String.op_Inequality(V_7.get_FullName(), V_6.get_FullName())) { node.set_Right(new ExplicitCastExpression(V_4, V_5, null)); V_2 = true; } } } else { if (!this.IsArithmeticOperator(node.get_Operator())) { if (this.IsBitwiseOperator(node.get_Operator()) || node.get_IsComparisonExpression()) { V_10 = node.get_Left(); V_11 = node.get_Right(); if (V_11.get_HasType() && V_10.get_HasType()) { V_12 = V_10.get_ExpressionType(); V_13 = V_11.get_ExpressionType().Resolve(); if (this.ShouldAddCast(V_13, V_12)) { node.set_Right(new ExplicitCastExpression(V_11, V_12, null)); V_2 = true; } V_14 = V_11.get_ExpressionType(); V_15 = V_10.get_ExpressionType().Resolve(); if (this.ShouldAddCast(V_15, V_14)) { node.set_Left(new ExplicitCastExpression(V_10, V_14, null)); V_2 = true; } if (V_15 != null && V_15.get_IsEnum() && V_13 != null && V_13.get_IsEnum() && String.op_Inequality(V_15.get_FullName(), V_13.get_FullName())) { node.set_Left(new ExplicitCastExpression(V_10, this.GetEnumUnderlyingType(V_15), null)); node.set_Right(new ExplicitCastExpression(V_11, this.GetEnumUnderlyingType(V_15), null)); V_2 = true; } } } else { if (this.IsShiftOperator(node.get_Operator())) { if (node.get_Left().get_HasType()) { V_16 = node.get_Left().get_ExpressionType().Resolve(); if (V_16 != null && V_16.get_IsEnum()) { node.set_Left(new ExplicitCastExpression(node.get_Left(), this.GetEnumUnderlyingType(V_16), null)); V_2 = true; } } if (node.get_Right().get_HasType()) { V_17 = node.get_Right().get_ExpressionType().Resolve(); if (V_17 != null && V_17.get_IsEnum()) { node.set_Right(new ExplicitCastExpression(node.get_Right(), this.GetEnumUnderlyingType(V_17), null)); V_2 = true; } } } } } else { if (node.get_Left().get_HasType()) { V_8 = node.get_Left().get_ExpressionType().Resolve(); if (V_8 != null && V_8.get_IsEnum()) { node.set_Left(new ExplicitCastExpression(node.get_Left(), this.GetEnumUnderlyingType(V_8), null)); V_2 = true; } } if (node.get_Right().get_HasType()) { V_9 = node.get_Right().get_ExpressionType().Resolve(); if (V_9 != null && V_9.get_IsEnum()) { node.set_Right(new ExplicitCastExpression(node.get_Right(), this.GetEnumUnderlyingType(V_9), null)); V_2 = true; } } } } if (V_2) { node.UpdateType(); } return; }
public static bool TryMatch(BlockStatement filter, out VariableDeclarationExpression variableDeclaration, out Expression filterExpression) { variableDeclaration = null; filterExpression = null; if (!CatchClausesFilterPattern.TryMatchVariableDeclaration(filter, out variableDeclaration)) { return(false); } if (filter.get_Statements().get_Count() != 3) { return(false); } V_0 = filter.get_Statements().get_Item(1) as IfStatement; if (V_0 == null) { return(false); } V_1 = null; V_2 = null; if ((V_0.get_Condition() as BinaryExpression).get_Operator() != 10) { V_1 = V_0.get_Else(); V_2 = V_0.get_Then(); } else { V_1 = V_0.get_Then(); V_2 = V_0.get_Else(); } V_3 = null; V_4 = null; if (V_1.get_Statements().get_Count() != 1 && V_1.get_Statements().get_Count() != 2 && V_1.get_Statements().get_Count() != 3 || V_2.get_Statements().get_Count() != 1) { return(false); } if (V_1.get_Statements().get_Count() != 2) { if (V_1.get_Statements().get_Count() == 3) { V_8 = V_1.get_Statements().get_Item(0) as ExpressionStatement; V_9 = V_1.get_Statements().get_Item(1) as ExpressionStatement; if (V_8 == null || V_9 == null) { return(false); } if (V_8.get_Expression().get_CodeNodeType() != 24 || V_9.get_Expression().get_CodeNodeType() != 19) { if (V_8.get_Expression().get_CodeNodeType() != 19 || V_9.get_Expression().get_CodeNodeType() != 24) { return(false); } V_4 = V_8; V_3 = V_9; } else { V_3 = V_8; V_4 = V_9; } } } else { V_7 = V_1.get_Statements().get_Item(0) as ExpressionStatement; if (V_7 == null) { return(false); } if (V_7.get_Expression().get_CodeNodeType() != 24) { if (V_7.get_Expression().get_CodeNodeType() != 19) { return(false); } V_4 = V_7; } else { V_3 = V_7; } } if (V_3 != null) { V_10 = V_3.get_Expression() as BinaryExpression; if (V_10 == null || !V_10.get_IsAssignmentExpression() || String.op_Inequality(V_10.get_ExpressionType().get_FullName(), variableDeclaration.get_ExpressionType().get_FullName())) { return(false); } stackVariable98 = V_10.get_Left() as VariableReferenceExpression; V_11 = V_10.get_Right() as VariableReferenceExpression; if (stackVariable98 == null || V_11 == null) { return(false); } } if (V_4 != null) { V_12 = V_4.get_Expression() as MethodInvocationExpression; if (V_12 == null || String.op_Inequality(V_12.get_MethodExpression().get_Method().get_FullName(), "System.Void Microsoft.VisualBasic.CompilerServices.ProjectData::SetProjectError(System.Exception)")) { return(false); } } V_5 = filter.get_Statements().get_Item(2) as ExpressionStatement; if (V_5 == null) { return(false); } V_6 = V_5.get_Expression() as VariableReferenceExpression; if (V_6 == null) { return(false); } if (!CatchClausesFilterPattern.TryMatchFilterExpression(V_0, variableDeclaration.get_Variable().get_VariableType(), V_6, out filterExpression)) { return(false); } return(true); }