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); }
public void CleanUpUnusedDeclarations() { V_1 = this.referenceToDeclarationStatementMap.GetEnumerator(); try { while (V_1.MoveNext()) { V_2 = V_1.get_Current(); V_3 = V_2.get_Key(); this.context.get_MethodContext().RemoveVariable(V_3); V_4 = V_2.get_Value(); V_5 = V_4.get_Parent() as BlockStatement; if (!this.IsOptimisableAssignment(V_4)) { V_6 = (V_4.get_Expression() as BinaryExpression).get_Right(); if (!this.CanExistInStatement(V_6)) { continue; } if (V_6.get_CodeNodeType() == 87) { V_6 = (V_6 as ParenthesesExpression).get_Expression(); } V_7 = new ExpressionStatement(V_6); V_8 = V_5.get_Statements().IndexOf(V_4); V_5.AddStatementAt(V_8 + 1, V_7); this.TransferLabel(V_4); V_5.get_Statements().RemoveAt(V_8); } else { this.TransferLabel(V_4); dummyVar0 = V_5.get_Statements().Remove(V_4); } } } finally { ((IDisposable)V_1).Dispose(); } V_0 = new HashSet <VariableDefinition>(); V_9 = this.context.get_MethodContext().get_Variables().GetEnumerator(); try { while (V_9.MoveNext()) { V_10 = V_9.get_Current(); if (this.bannedVariables.Contains(V_10)) { continue; } dummyVar1 = V_0.Add(V_10); } } finally { V_9.Dispose(); } V_11 = V_0.GetEnumerator(); try { while (V_11.MoveNext()) { V_12 = V_11.get_Current(); this.context.get_MethodContext().RemoveVariable(V_12); } } finally { ((IDisposable)V_11).Dispose(); } return; }
private void ProcessBlock(BlockStatement node) { V_0 = 0; while (V_0 < node.get_Statements().get_Count() - 1) { V_1 = null; V_2 = new List <VariableReference>(); V_3 = node.get_Statements().get_Item(V_0); V_1 = this.GetFixedStatement(V_3, V_2); if (V_1 != null) { V_7 = V_2.GetEnumerator(); try { while (V_7.MoveNext()) { V_8 = V_7.get_Current(); this.methodContext.RemoveVariable(V_8); } } finally { ((IDisposable)V_7).Dispose(); } node.get_Statements().RemoveAt(V_0); node.AddStatementAt(V_0, V_1); V_4 = node.get_Statements().get_Item(V_0 + 1) as ExpressionStatement; V_5 = node.get_Statements().get_Count(); V_6 = null; stackVariable47 = new RebuildFixedStatements.VariableReferenceVisitor(); stackVariable47.Visit(V_1.get_Expression()); V_6 = stackVariable47.get_Variable(); V_9 = V_0 + 1; while (V_9 < V_5) { stackVariable56 = new RebuildFixedStatements.VariableReferenceVisitor(); stackVariable56.Visit(node.get_Statements().get_Item(V_9)); V_10 = stackVariable56.get_Variable(); if (V_10 != null && !this.variables.Contains(V_10)) { this.variables.Add(V_10); } if (node.get_Statements().get_Item(V_9).get_CodeNodeType() == 5) { V_4 = node.get_Statements().get_Item(V_9) as ExpressionStatement; if (V_10 != null && (object)V_10 == (object)V_6 && V_4.get_Expression().get_CodeNodeType() == 24 && (V_4.get_Expression() as BinaryExpression).get_IsAssignmentExpression() && (V_4.get_Expression() as BinaryExpression).get_Right().get_CodeNodeType() == 22 && ((V_4.get_Expression() as BinaryExpression).get_Right() as LiteralExpression).get_Value() == null) { node.get_Statements().RemoveAt(V_9); V_9 = V_9 - 1; V_5 = V_5 - 1; break; } } V_1.get_Body().AddStatement(node.get_Statements().get_Item(V_9)); node.get_Statements().RemoveAt(V_9); V_9 = V_9 - 1; V_5 = V_5 - 1; V_9 = V_9 + 1; } this.ProcessBlock(V_1.get_Body()); return; } V_0 = V_0 + 1; } return; }