private List <IntervalConstruct> SortIntervalList(List <IntervalConstruct> intervals) { V_0 = new IntervalConstruct(intervals.get_Item(0)); V_2 = intervals.GetEnumerator(); try { while (V_2.MoveNext()) { V_3 = V_2.get_Current(); dummyVar0 = V_0.get_Children().Add(V_3); } } finally { ((IDisposable)V_2).Dispose(); } stackVariable15 = DFSTBuilder.BuildTree(V_0); V_1 = new List <IntervalConstruct>(); V_4 = stackVariable15.get_ReversePostOrder().GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); V_1.Add(V_5.get_Construct() as IntervalConstruct); } } finally { ((IDisposable)V_4).Dispose(); } return(V_1); }
private void CastMethodArguments(MethodReference method, ExpressionCollection arguments) { V_0 = 0; while (V_0 < arguments.get_Count()) { V_1 = arguments.get_Item(V_0); V_2 = method.get_Parameters().get_Item(V_0).ResolveParameterType(method); if (V_1.get_HasType() && V_2 != null && V_1 as LiteralExpression == null) { V_3 = V_1.get_ExpressionType(); if (this.IsUnsignedIntegerType(V_3) && this.IsSignedIntegerType(V_2) || this.IsSignedIntegerType(V_3) && this.IsUnsignedIntegerType(V_2)) { V_4 = V_1; if (V_1 as ExplicitCastExpression != null) { V_5 = V_1 as ExplicitCastExpression; if (this.IsIntegerType(V_5.get_TargetType())) { V_4 = V_5.get_Expression(); } } arguments.set_Item(V_0, new ExplicitCastExpression(V_4, V_2, null)); } } V_0 = V_0 + 1; } return; }
private CFGBlockLogicalConstruct GetStateBeginBlockConstruct(HashSet <int> tryStates) { V_0 = 0; while (V_0 < this.orderedCFGNodes.get_Count()) { V_1 = this.orderedCFGNodes.get_Item(V_0); V_2 = V_1.get_LogicalConstructExpressions(); V_3 = 0; while (V_3 < V_2.get_Count()) { if (this.TryGetStateAssignValue(V_2.get_Item(V_3), out V_4) && tryStates.Contains(V_4)) { if (V_3 == 0) { return(V_1); } V_5 = LogicalFlowUtilities.SplitCFGBlockAt(this.logicalContext, V_1, V_3); this.orderedCFGNodes.set_Item(V_0, V_5.get_Key()); this.orderedCFGNodes.Insert(V_0 + 1, V_5.get_Value()); return(V_5.get_Value()); } V_3 = V_3 + 1; } V_0 = V_0 + 1; } throw new Exception("Invalid state value"); }
private void MapBlocks() { V_0 = this.logicalBuilderContext.get_CFG().get_Blocks(); V_1 = 0; while (V_1 < (int)V_0.Length) { V_2 = V_0[V_1]; V_3 = V_2.get_First().get_Offset(); stackVariable17 = this.logicalBuilderContext.get_CFGBlockToLogicalConstructMap(); stackVariable20 = new CFGBlockLogicalConstruct[1]; stackVariable20[0] = new CFGBlockLogicalConstruct(V_2, this.methodContext.get_Expressions().get_BlockExpressions().get_Item(V_3)); stackVariable17.Add(V_2, stackVariable20); V_1 = V_1 + 1; } V_0 = this.logicalBuilderContext.get_CFG().get_Blocks(); V_1 = 0; while (V_1 < (int)V_0.Length) { V_4 = V_0[V_1]; V_5 = this.logicalBuilderContext.get_CFGBlockToLogicalConstructMap().get_Item(V_4)[0]; V_6 = V_4.get_Successors(); V_7 = 0; while (V_7 < (int)V_6.Length) { V_8 = V_6[V_7]; V_9 = this.logicalBuilderContext.get_CFGBlockToLogicalConstructMap().get_Item(V_8)[0]; V_5.AddToSuccessors(V_9); V_9.AddToPredecessors(V_5); V_7 = V_7 + 1; } V_1 = V_1 + 1; } return; }
private bool GetYieldExceptionData() { if ((int)this.theDisposeCFG.get_Blocks().Length == 1) { return(true); } V_0 = this.theDisposeCFG.get_OffsetToInstruction().get_Item(0); if (V_0.get_OpCode().get_Code() != 2) { return(false); } V_0 = this.theDisposeCFG.get_OffsetToInstruction().get_Item(1); if (V_0.get_OpCode().get_Code() != 120 || V_0.get_Operand() as FieldReference == null || !this.CheckAndSaveStateField(V_0.get_Operand() as FieldReference)) { return(false); } V_2 = this.theDisposeCFG.get_SwitchBlocksInformation().get_Values().GetEnumerator(); try { while (V_2.MoveNext()) { V_3 = V_2.get_Current(); if (this.DetermineExceptionHandlingStatesFromSwitchData(V_3)) { continue; } V_4 = false; goto Label0; } } finally { ((IDisposable)V_2).Dispose(); } this.DetermineExceptionHandlingStatesFromCFGBlocks(); V_5 = this.handlerToStatesMap.GetEnumerator(); try { while (V_5.MoveNext()) { V_6 = V_5.get_Current(); if (this.TryCreateYieldExceptionHandler(V_6.get_Value(), V_6.get_Key())) { continue; } V_4 = false; goto Label0; } goto Label1; } finally { ((IDisposable)V_5).Dispose(); } Label0: return(V_4); Label1: return(true); }
private void EliminateViaIf(IfStatement gotoStatement, Statement labeledStatement) { V_0 = labeledStatement.get_Parent() as BlockStatement; V_1 = V_0.get_Statements().IndexOf(gotoStatement); V_2 = V_0.get_Statements().IndexOf(labeledStatement); if (V_1 == V_2 - 1) { V_0.get_Statements().RemoveAt(V_1); return; } V_3 = this.CollectStatements(V_1 + 1, V_2, V_0); V_4 = Negator.Negate(gotoStatement.get_Condition(), this.typeSystem); while (V_3.get_Statements().get_Item(0) as IfStatement != null) { V_5 = V_3.get_Statements().get_Item(0) as IfStatement; if (!this.AreEqual(V_5.get_Condition(), V_4) || V_5.get_Else() != null) { break; } V_3.get_Statements().RemoveAt(0); V_6 = 0; while (V_6 < V_5.get_Then().get_Statements().get_Count()) { V_3.AddStatement(V_5.get_Then().get_Statements().get_Item(V_6)); V_6 = V_6 + 1; } } gotoStatement.set_Then(V_3); gotoStatement.set_Condition(V_4); return; }
private void ProcessCtorInvocation() { V_3 = this.GetStatementsForInvocation(out V_1, out V_0, out V_2); if (V_3 == null) { return; } this.patternsContext = new CodePatternsContext(V_3); stackVariable10 = new ICodePattern[5]; stackVariable10[0] = new NullCoalescingPattern(this.patternsContext, this.methodContext); stackVariable10[1] = new TernaryConditionPatternAgressive(this.patternsContext, this.typeSystem); stackVariable10[2] = new ArrayInitialisationPattern(this.patternsContext, this.typeSystem); stackVariable10[3] = new VariableInliningPatternAggressive(this.patternsContext, this.methodContext, this.context.get_Language().get_VariablesToNotInlineFinder()); stackVariable10[4] = new MultiAssignPattern(this.patternsContext, this.methodContext); V_4 = new List <ICodePattern>(stackVariable10); if (V_2) { V_4.Add(new InitializationPattern(this.patternsContext, this.context)); } if (!this.ProcessStatementCollection(V_3, V_4)) { return; } if (V_3.get_Item(0).get_CodeNodeType() != 5) { return; } V_5 = (V_3.get_Item(0) as ExpressionStatement).get_Expression() as MethodInvocationExpression; if (V_5.get_CodeNodeType() != 52 && V_5.get_CodeNodeType() != 53) { return; } this.methodContext.set_CtorInvokeExpression(V_5); return; }
public static ICollection <ImplementedMember> GetImplementedProperties(this PropertyReference self) { V_0 = new List <ImplementedMember>(); V_1 = self.Resolve(); if (V_1 == null) { return(V_0); } if (V_1.get_GetMethod() != null) { V_2 = V_1.get_GetMethod().GetImplementedMethods().GetEnumerator(); try { while (V_2.MoveNext()) { V_3 = V_2.get_Current(); V_4 = PropertyDefinitionExtensions.GetMethodDeclaringProperty(V_3.get_Member() as MethodReference); if (V_4 == null) { continue; } V_0.Add(new ImplementedMember(V_3.get_DeclaringType(), V_4)); } } finally { if (V_2 != null) { V_2.Dispose(); } } return(V_0); } if (V_1.get_SetMethod() == null) { return(V_0); } V_2 = V_1.get_SetMethod().GetImplementedMethods().GetEnumerator(); try { while (V_2.MoveNext()) { V_5 = V_2.get_Current(); V_6 = PropertyDefinitionExtensions.GetMethodDeclaringProperty(V_5.get_Member() as MethodReference); if (V_6 == null) { continue; } V_0.Add(new ImplementedMember(V_5.get_DeclaringType(), V_6)); } } finally { if (V_2 != null) { V_2.Dispose(); } } return(V_0); }
private LetClause GenerateLetClause(Dictionary <PropertyDefinition, Expression> propertyToValueMap, VariableReference oldIdentifier) { V_0 = null; V_1 = null; V_4 = propertyToValueMap.GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); if (!String.op_Equality(V_5.get_Key().get_Name(), oldIdentifier.get_Name()) || V_5.get_Value().get_CodeNodeType() != 26 || (object)(V_5.get_Value() as VariableReferenceExpression).get_Variable() != (object)oldIdentifier) { V_1 = V_5.get_Key(); } else { V_0 = V_5.get_Key(); } } } finally { ((IDisposable)V_4).Dispose(); } if (V_0 == null || V_1 == null) { return(null); } V_2 = propertyToValueMap.get_Item(V_1); V_3 = new LetClause(new VariableReferenceExpression(this.CreateNewIdentifier(V_1.get_Name(), V_2.get_ExpressionType()), null), V_2, null); propertyToValueMap.set_Item(V_1, V_3.get_Identifier()); return(V_3); }
private bool TryMatchArrayAssignmentInternal(StatementCollection statements) { if (statements.get_Count() < 2) { return(false); } V_0 = statements.get_Item(0) as ExpressionStatement; if (V_0 == null) { return(false); } V_1 = V_0.get_Expression() as BinaryExpression; if (V_1 == null || !this.IsAssignToVariableExpression(V_1, out V_2)) { return(false); } V_3 = V_1.get_Right(); V_4 = statements.get_Item(1) as ExpressionStatement; if (V_4 == null) { return(false); } if (!this.IsFieldAssignment(V_4, out V_5, out V_6) && !this.IsAutoPropertyAssignment(V_4, out V_5, out V_6)) { return(false); } if (V_5.get_CodeNodeType() != 26 || (object)(V_5 as VariableReferenceExpression).get_Variable() != (object)V_2) { return(false); } return(this.MapAssignmentIntoContext(V_6, V_3)); }
public override RepositoryResponse<bool> SaveSubModels(MixPage parent, MixCmsContext _context = null, IDbContextTransaction _transaction = null) { stackVariable0 = new RepositoryResponse<bool>(); stackVariable0.set_IsSucceed(true); V_0 = stackVariable0; ViewModelHelper.HandleResult<Mix.Cms.Lib.ViewModels.MixTemplates.UpdateViewModel>(this.get_View().SaveModel(true, _context, _transaction), ref V_0); if (V_0.get_IsSucceed() && this.get_Master() != null) { ViewModelHelper.HandleResult<Mix.Cms.Lib.ViewModels.MixTemplates.UpdateViewModel>(this.get_Master().SaveModel(true, _context, _transaction), ref V_0); } if (V_0.get_IsSucceed() && this.get_UrlAliases() != null) { V_1 = this.get_UrlAliases().GetEnumerator(); try { while (V_1.MoveNext()) { V_2 = V_1.get_Current(); if (!V_0.get_IsSucceed()) { break; } V_2.set_SourceId(parent.get_Id().ToString()); V_2.set_Type(0); V_2.set_Specificulture(this.get_Specificulture()); ViewModelHelper.HandleResult<Mix.Cms.Lib.ViewModels.MixUrlAliases.UpdateViewModel>(V_2.SaveModel(false, _context, _transaction), ref V_0); } } finally { ((IDisposable)V_1).Dispose(); } } if (V_0.get_IsSucceed()) { V_4 = this.get_ModuleNavs().GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); V_5.set_PageId(parent.get_Id()); if (!V_5.get_IsActived()) { ViewModelHelper.HandleResult<MixPageModule>(V_5.RemoveModel(false, _context, _transaction), ref V_0); } else { ViewModelHelper.HandleResult<Mix.Cms.Lib.ViewModels.MixPageModules.ReadMvcViewModel>(V_5.SaveModel(false, _context, _transaction), ref V_0); } } } finally { ((IDisposable)V_4).Dispose(); } } return V_0; }
public static TypeReference ResolveParameterType(this ParameterReference param, MethodReference method) { V_0 = param.get_ParameterType(); V_1 = V_0 as GenericParameter; V_2 = false; V_3 = false; if (V_0.get_IsByReference()) { V_1 = V_0.GetElementType() as GenericParameter; V_2 = true; } if (V_0.get_IsArray()) { V_1 = V_0.GetElementType() as GenericParameter; V_3 = true; } if (V_1 == null) { return(V_0); } V_4 = V_1.get_Position(); if (V_1.get_Owner() as MethodReference == null || !method.get_IsGenericInstance()) { if (V_1.get_Owner() as TypeReference != null && method.get_DeclaringType().get_IsGenericInstance()) { V_6 = method.get_DeclaringType() as GenericInstanceType; if (V_4 >= 0 && V_4 < V_6.get_GenericArguments().get_Count()) { V_0 = V_6.get_GenericArguments().get_Item(V_4); if (V_6.get_PostionToArgument().ContainsKey(V_4)) { V_0 = V_6.get_PostionToArgument().get_Item(V_4); } } } } else { V_5 = method as GenericInstanceMethod; if (V_4 >= 0 && V_4 < V_5.get_GenericArguments().get_Count()) { V_0 = V_5.get_GenericArguments().get_Item(V_4); if (V_5.get_PostionToArgument().ContainsKey(V_4)) { V_0 = V_5.get_PostionToArgument().get_Item(V_4); } } } if (V_2) { return(new ByReferenceType(V_0)); } if (!V_3) { return(V_0); } return(new ArrayType(V_0)); }
public List <FileViewModel> GetFilesWithContent(string fullPath) { this.CreateDirectoryIfNotExist(fullPath); V_0 = new List <FileViewModel>(); V_1 = Directory.GetDirectories(fullPath, "*", 1); V_2 = 0; while (V_2 < (int)V_1.Length) { stackVariable15 = new DirectoryInfo(V_1[V_2]); V_3 = stackVariable15.get_Name(); stackVariable17 = stackVariable15.GetFiles(); stackVariable18 = FileRepository.u003cu003ec.u003cu003e9__29_0; if (stackVariable18 == null) { dummyVar0 = stackVariable18; stackVariable18 = new Func <FileInfo, DateTime>(FileRepository.u003cu003ec.u003cu003e9.u003cGetFilesWithContentu003eb__29_0); FileRepository.u003cu003ec.u003cu003e9__29_0 = stackVariable18; } V_4 = ((IEnumerable <FileInfo>)stackVariable17).OrderByDescending <FileInfo, DateTime>(stackVariable18).GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); V_6 = V_5.OpenText(); try { V_7 = new FileViewModel(); V_7.set_FolderName(V_3); stackVariable33 = new string[2]; stackVariable33[0] = fullPath; stackVariable33[1] = V_3; V_7.set_FileFolder(CommonHelper.GetFullPath(stackVariable33)); V_7.set_Filename(V_5.get_Name().Substring(0, V_5.get_Name().LastIndexOf('.'))); V_7.set_Extension(V_5.get_Extension()); V_7.set_Content(V_6.ReadToEnd()); V_0.Add(V_7); } finally { if (V_6 != null) { ((IDisposable)V_6).Dispose(); } } } } finally { if (V_4 != null) { V_4.Dispose(); } } V_2 = V_2 + 1; } return(V_0); }
public void InferTypes() { V_0 = (new GreedyTypeInferer(this.context, this.offsetToExpression)).InferTypes(); V_1 = new ClassHierarchyBuilder(this.offsetToExpression, this.context.get_MethodContext().get_ControlFlowGraph().get_OffsetToInstruction(), this.context); this.inferenceGraph = V_1.BuildHierarchy(V_0); this.MergeConnectedComponents(); this.RemoveTransitiveEdges(); this.ProcessSingleConstraints(); V_2 = null; V_4 = this.inferenceGraph.GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); if (!V_5.get_IsHardNode() || !String.op_Equality(V_5.get_NodeType().get_FullName(), "System.Object")) { continue; } V_2 = V_5; goto Label0; } } finally { if (V_4 != null) { V_4.Dispose(); } } Label0: V_3 = new List <ClassHierarchyNode>(); V_3.Add(V_2); V_4 = this.inferenceGraph.GetEnumerator(); try { while (V_4.MoveNext()) { V_6 = V_4.get_Current(); if (V_6.get_IsHardNode()) { continue; } V_3.Add(V_6); } } finally { if (V_4 != null) { V_4.Dispose(); } } this.MergeNodes(V_3); this.InferIntegerTypes(V_0); this.AddCasts(); return; }
private int CountInstructions(IEnumerable <ILogicalConstruct> trueSuccessor) { V_0 = 0; V_1 = trueSuccessor.GetEnumerator(); try { while (V_1.MoveNext()) { V_2 = V_1.get_Current().get_CFGBlocks().GetEnumerator(); try { while (V_2.MoveNext()) { V_3 = V_2.get_Current(); V_4 = 0; if (!this.blockToInstructionsCount.ContainsKey(V_3.get_TheBlock().get_First().get_Offset())) { V_5 = V_3.get_TheBlock().GetEnumerator(); try { while (V_5.MoveNext()) { dummyVar0 = V_5.get_Current(); V_4 = V_4 + 1; } } finally { if (V_5 != null) { V_5.Dispose(); } } this.blockToInstructionsCount.Add(V_3.get_TheBlock().get_First().get_Offset(), V_4); } else { V_4 = this.blockToInstructionsCount.get_Item(V_3.get_TheBlock().get_First().get_Offset()); } V_0 = V_0 + V_4; } } finally { ((IDisposable)V_2).Dispose(); } } } finally { if (V_1 != null) { V_1.Dispose(); } } return(V_0); }
private void MergeWithSingleChild() { V_0 = false; do { V_1 = null; V_2 = this.inferenceGraph.GetEnumerator(); try { while (V_2.MoveNext()) { V_3 = V_2.get_Current(); if (V_3.get_IsHardNode() || V_3.get_CanAssignTo().get_Count() != 1 || V_3.get_SubTypes().get_Count() != 0) { continue; } V_4 = null; V_5 = V_3.get_CanAssignTo().GetEnumerator(); try { if (V_5.MoveNext()) { V_4 = V_5.get_Current(); } } finally { if (V_5 != null) { V_5.Dispose(); } } stackVariable27 = new ClassHierarchyNode[2]; stackVariable27[0] = V_3; stackVariable27[1] = V_4; V_1 = (ICollection <ClassHierarchyNode>)stackVariable27; V_0 = true; goto Label0; } } finally { if (V_2 != null) { V_2.Dispose(); } } Label0: if (!V_0) { continue; } this.MergeNodes(V_1); }while (V_0); return; }
private bool TryMatchInternal(StatementCollection statements, int startIndex, out Statement result, out int replacedStatementsCount, out VariableDefinition xVariableDef) { result = null; replacedStatementsCount = 0; xVariableDef = null; if (statements.get_Count() < 1 || statements.get_Item(startIndex).get_CodeNodeType() != 5) { return(false); } V_2 = (statements.get_Item(startIndex) as ExpressionStatement).get_Expression() as BinaryExpression; if (!this.IsAssignToVariableExpression(V_2, out V_0) || !this.methodContext.get_StackData().get_VariableToDefineUseInfo().ContainsKey(V_0.Resolve())) { return(false); } V_1 = V_2.get_Right(); V_3 = startIndex + 1; while (V_3 < statements.get_Count()) { V_5 = statements.get_Item(V_3); if (V_5.get_CodeNodeType() != 5 || !String.IsNullOrEmpty(V_5.get_Label())) { break; } V_6 = (V_5 as ExpressionStatement).get_Expression() as BinaryExpression; if (V_6 == null || !V_6.get_IsAssignmentExpression() || V_6.get_Right().get_CodeNodeType() != 26 || (object)(V_6.get_Right() as VariableReferenceExpression).get_Variable() != (object)V_0) { break; } if (V_6.get_Left().get_CodeNodeType() == 30) { return(false); } if (V_6.get_Left().get_CodeNodeType() == 26) { V_7 = (V_6.get_Left() as VariableReferenceExpression).get_Variable().Resolve(); if (V_7 == V_0) { return(false); } dummyVar0 = this.variablesToRemove.Add(V_7); } V_1 = new BinaryExpression(26, V_6.get_Left(), V_1, this.typeSystem, null, false); V_3 = V_3 + 1; } replacedStatementsCount = V_3 - startIndex; if (replacedStatementsCount == 1) { return(false); } V_4 = new BinaryExpression(26, new VariableReferenceExpression(V_0, null), V_1, this.typeSystem, null, false); stackVariable66 = new ExpressionStatement(V_4); stackVariable66.set_Parent(statements.get_Item(startIndex).get_Parent()); result = stackVariable66; xVariableDef = V_0.Resolve(); return(true); }
private bool RemoveStateSavingBlocks() { V_0 = this.theCFG.get_Blocks()[(int)this.theCFG.get_Blocks().Length - 1]; V_1 = V_0.get_First(); while (V_1.get_OpCode().get_Code() == null && (object)V_1 != (object)V_0.get_Last()) { V_1 = V_1.get_Next(); } if (V_1.get_OpCode().get_Code() != 41) { return(false); } V_2 = 0; V_4 = (new HashSet <InstructionBlock>(V_0.get_Predecessors())).GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); if ((int)V_5.get_Successors().Length <= 1) { if (V_5.get_Predecessors().get_Count() != 1 || !InstructionBlock.op_Inequality(this.theCFG.get_Blocks()[(int)this.theCFG.get_Blocks().Length - 2], V_5)) { V_5.set_Successors(new InstructionBlock[0]); V_2 = V_2 + 1; } else { if (this.CheckForStateFieldSet(V_5) && this.TryRemoveStateSavingBlock(V_5)) { continue; } V_6 = false; goto Label1; } } else { V_6 = false; goto Label1; } } goto Label0; } finally { ((IDisposable)V_4).Dispose(); } Label1: return(V_6); Label0: dummyVar0 = this.toBeRemoved.Add(V_0); return(V_2 == 2); }
public void MergeNodes(HashSet <ISingleEntrySubGraph> constructs, ISingleEntrySubGraph originalEntry, ISingleEntrySubGraph newConstruct) { V_0 = this.constructToNodeMap.get_Item(originalEntry); stackVariable5 = new DTNode(newConstruct); stackVariable5.set_Predecessor(V_0.get_Predecessor()); V_1 = stackVariable5; V_1.get_DominanceFrontier().UnionWith(V_0.get_DominanceFrontier()); dummyVar0 = V_1.get_DominanceFrontier().Remove(V_0); if (V_1.get_Predecessor() != null) { dummyVar1 = V_1.get_Predecessor().get_TreeEdgeSuccessors().Remove(V_0); dummyVar2 = V_1.get_Predecessor().get_TreeEdgeSuccessors().Add(V_1); } V_2 = constructs.GetEnumerator(); try { while (V_2.MoveNext()) { V_3 = V_2.get_Current(); dummyVar3 = this.constructToNodeMap.Remove(V_3); } } finally { ((IDisposable)V_2).Dispose(); } V_4 = this.constructToNodeMap.GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); if (V_5.get_Value().get_Predecessor() != null && constructs.Contains(V_5.get_Value().get_Predecessor().get_Construct())) { V_5.get_Value().set_Predecessor(V_1); dummyVar4 = V_1.get_TreeEdgeSuccessors().Add(V_5.get_Value()); } if (!V_5.get_Value().get_DominanceFrontier().Remove(V_0)) { continue; } dummyVar5 = V_5.get_Value().get_DominanceFrontier().Add(V_1); } } finally { ((IDisposable)V_4).Dispose(); } if (this.get_RootConstruct() == originalEntry) { this.set_RootConstruct(newConstruct); } this.constructToNodeMap.Add(newConstruct, V_1); return; }
public int WriteParameterAttributes(ParameterDefinition parameter, bool isWinRTMethodImplementation) { if (isWinRTMethodImplementation) { stackVariable1 = null; } else { stackVariable1 = this.GetInAttribute(parameter); } V_0 = stackVariable1; if (isWinRTMethodImplementation) { stackVariable3 = null; } else { stackVariable3 = this.GetOutAttribute(parameter); } V_1 = stackVariable3; V_2 = new List <CustomAttribute>(); if (V_0 != null) { V_2.Add(V_0); } if (V_1 != null) { V_2.Add(V_1); } V_2.AddRange(parameter.get_CustomAttributes()); V_3 = 0; V_4 = V_2.GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); if (this.attributesNotToShow.Contains(V_5.get_AttributeType().get_FullName())) { continue; } if (V_3 != 0) { this.genericWriter.Write(this.get_ParameterAttributeSeparator()); } this.WriteAttribute(V_5, true, false); V_3 = V_3 + 1; } } finally { ((IDisposable)V_4).Dispose(); } return(V_3); }
public bool TryMatch(StatementCollection statements, out int startIndex, out Statement result, out int replacedStatementsCount) { replacedStatementsCount = 0; startIndex = -1; result = null; V_0 = false; if (statements.get_Count() == 0) { return(false); } V_1 = new HashSet <VariableDefinition>(); V_2 = this.GetStatementsToInline(statements); V_3 = V_2.get_Count() - 1; while (V_3 >= 0) { V_4 = V_2.get_Item(V_3); V_5 = statements.get_Item(V_4) as ExpressionStatement; V_6 = ((V_5.get_Expression() as BinaryExpression).get_Left() as VariableReferenceExpression).get_Variable().Resolve(); if (V_4 == statements.get_Count() - 1 || !String.IsNullOrEmpty(V_5.get_Label())) { dummyVar0 = V_1.Add(V_6); } else { V_7 = new List <Instruction>(V_5.get_Expression().get_MappedInstructions()); V_7.AddRange((V_5.get_Expression() as BinaryExpression).get_Left().get_UnderlyingSameMethodInstructions()); V_8 = (V_5.get_Expression() as BinaryExpression).get_Right().CloneAndAttachInstructions(V_7); if (this.inliner.TryInlineVariable(V_6, V_8, statements.get_Item(V_4 + 1), this.ShouldInlineAggressively(V_6), out V_9)) { statements.RemoveAt(V_4); V_0 = true; dummyVar1 = V_1.Add(V_6); this.methodContext.RemoveVariable(V_6); statements.set_Item(V_4, (Statement)this.dereferencer.Visit(statements.get_Item(V_4))); } } V_3 = V_3 - 1; } V_10 = V_1.GetEnumerator(); try { while (V_10.MoveNext()) { V_11 = V_10.get_Current(); dummyVar2 = this.patternsContext.get_VariableToSingleAssignmentMap().Remove(V_11); dummyVar3 = this.patternsContext.get_VariableToDefineUseCountContext().Remove(V_11); } } finally { ((IDisposable)V_10).Dispose(); } return(V_0); }
protected override string ToString(string constructName, HashSet <CFGBlockLogicalConstruct> printedCFGBlocks, LogicalFlowBuilderContext context) { V_0 = new StringBuilder(this.GetType().get_Name()); dummyVar0 = V_0.AppendLine(); dummyVar1 = V_0.AppendLine("{"); this.IndentAndAppendString(V_0, (this.get_Entry() as LogicalConstructBase).ToString(context)); dummyVar2 = V_0.AppendLine(); if (this.get_DefaultCase() != null) { this.IndentAndAppendString(V_0, this.get_DefaultCase().ToString(context)); } V_1 = this.get_ConditionCases(); V_2 = 0; while (V_2 < (int)V_1.Length) { this.IndentAndAppendString(V_0, V_1[V_2].ToString(context)); V_2 = V_2 + 1; } V_4 = this.get_NonDominatedCFGSuccessors().GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); dummyVar3 = V_0.Append("\tCase"); V_6 = V_5.get_Key().GetEnumerator(); try { while (V_6.MoveNext()) { V_7 = V_6.get_Current(); dummyVar4 = V_0.Append(" ").Append(V_7); } } finally { ((IDisposable)V_6).Dispose(); } dummyVar5 = V_0.Append(": ").AppendLine(this.NodeILOffset(context, V_5.get_Value())); } } finally { ((IDisposable)V_4).Dispose(); } if (this.get_DefaultCase() == null) { dummyVar6 = V_0.Append("\tDefault: ").AppendLine(this.NodeILOffset(context, this.get_DefaultCFGSuccessor())); } dummyVar7 = V_0.Append("\tFollowNode: ").AppendLine(this.NodeILOffset(context, this.get_CFGFollowNode())); dummyVar8 = V_0.AppendLine("}"); printedCFGBlocks.UnionWith(this.get_CFGBlocks()); return(V_0.ToString()); }
private Statement FixSwitchingStatement(Statement statement) { if (statement as SwitchStatement == null) { if (statement as IfElseIfStatement != null) { V_4 = (statement as IfElseIfStatement).get_ConditionBlocks().GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); this.FixConditionExpression(V_5.get_Key() as BinaryExpression); } } finally { ((IDisposable)V_4).Dispose(); } } } else { V_0 = statement as SwitchStatement; if (V_0.get_Condition().Equals(this.theIntVariable)) { V_0.set_Condition(this.theStringVariable.CloneExpressionOnly()); } V_1 = V_0.get_Cases().GetEnumerator(); try { while (V_1.MoveNext()) { V_2 = V_1.get_Current(); if (V_2 as ConditionCase == null) { continue; } stackVariable34 = V_2 as ConditionCase; V_3 = (Int32)(stackVariable34.get_Condition() as LiteralExpression).get_Value(); stackVariable34.set_Condition(new LiteralExpression(this.valueDictionary.get_Item(V_3), this.theTypeSystem, null)); } } finally { if (V_1 != null) { V_1.Dispose(); } } } return(statement); }
private void MarkOptimizationAndCaseBlocks(InstructionBlock block, RemoveCompilerOptimizationsStep.SwitchData data) { V_0 = new Queue <InstructionBlock>(); V_1 = new HashSet <int>(); V_2 = block.get_Successors(); V_3 = 0; while (V_3 < (int)V_2.Length) { V_0.Enqueue(V_2[V_3]); V_3 = V_3 + 1; } while (V_0.get_Count() > 0) { V_5 = V_0.Dequeue(); dummyVar0 = V_1.Add(V_5.get_First().get_Offset()); if (!this.IsOptimizationBlock(this.blockExpressions.get_Item(V_5.get_First().get_Offset()), data.get_OptimizationVariable())) { if (!this.IsCaseBlock(this.blockExpressions.get_Item(V_5.get_First().get_Offset()), data.get_SwitchExpression()) && !this.IsNullCaseBlock(this.blockExpressions.get_Item(V_5.get_First().get_Offset()), data.get_SwitchExpression())) { continue; } this.switchBlocksToCasesMap.get_Item(block.get_First().get_Offset()).Add(V_5.get_First().get_Offset()); V_8 = V_5.get_Successors()[1]; if (this.IsEmptyStringCaseBlock(this.blockExpressions.get_Item(V_8.get_First().get_Offset()), data.get_SwitchExpression())) { V_5.set_Last(V_8.get_Last()); V_5.set_Successors(V_8.get_Successors()); V_9 = this.blockExpressions.get_Item(V_5.get_First().get_Offset()).get_Item(0) as BinaryExpression; V_9.set_Right(new LiteralExpression("", this.methodContext.get_Method().get_Module().get_TypeSystem(), null)); V_10 = this.blockExpressions.get_Item(V_8.get_First().get_Offset()).get_Item(0).get_UnderlyingSameMethodInstructions(); V_9 = V_9.CloneAndAttachInstructions(V_10) as BinaryExpression; this.blockExpressions.get_Item(V_5.get_First().get_Offset()).set_Item(0, new UnaryExpression(11, V_9, null)); this.blocksToBeRemoved.Add(V_8.get_First().get_Offset()); } dummyVar1 = this.MarkSecondSuccessorForRemovalIfItIsUnconditionalJump(V_5); } else { V_6 = V_5.get_Successors()[0]; if (!V_1.Contains(V_6.get_First().get_Offset())) { V_0.Enqueue(V_6); } V_7 = this.MarkSecondSuccessorForRemovalIfItIsUnconditionalJump(V_5); if (!V_1.Contains(V_7.get_First().get_Offset()) && this.IsOptimizationBlock(this.blockExpressions.get_Item(V_5.get_First().get_Offset()), data.get_OptimizationVariable())) { V_0.Enqueue(V_7); } this.blocksToBeRemoved.Add(V_5.get_First().get_Offset()); } } return; }
private bool SubtreeEndsInInstructionCode(InstructionBlock entryBlock, IEnumerable <Code> operationCodes) { V_0 = true; V_1 = new Queue <InstructionBlock>(); V_2 = new HashSet <int>(); V_1.Enqueue(entryBlock); while (V_1.get_Count() > 0 & V_0) { V_3 = V_1.Dequeue(); if (V_2.Contains(V_3.get_First().get_Offset())) { continue; } dummyVar0 = V_2.Add(V_3.get_First().get_Offset()); if (V_3.get_Successors().Length != 0) { V_8 = V_3.get_Successors(); V_9 = 0; while (V_9 < (int)V_8.Length) { V_1.Enqueue(V_8[V_9]); V_9 = V_9 + 1; } } else { V_4 = false; V_5 = operationCodes.GetEnumerator(); try { while (V_5.MoveNext()) { V_6 = V_5.get_Current(); V_7 = V_3.get_Last().get_OpCode(); V_4 = V_4 | V_7.get_Code() == V_6; } } finally { if (V_5 != null) { V_5.Dispose(); } } V_0 = V_0 & V_4; } } return(V_0); }
private void AddCasts() { V_0 = this.context.get_MethodContext().get_StackData().get_VariableToDefineUseInfo().GetEnumerator(); try { while (V_0.MoveNext()) { V_1 = V_0.get_Current(); V_2 = V_1.get_Value().get_UsedAt().GetEnumerator(); try { while (V_2.MoveNext()) { V_3 = V_2.get_Current(); if (!this.offsetToExpression.TryGetValue(V_3, out V_4)) { continue; } this.AddCastIfNeeded(V_4, V_1.get_Key()); } } finally { ((IDisposable)V_2).Dispose(); } V_5 = V_1.get_Value().get_DefinedAt().GetEnumerator(); try { while (V_5.MoveNext()) { V_6 = V_5.get_Current(); V_7 = this.offsetToExpression.get_Item(V_6); V_8 = this.GetInstructionBlock(V_6); V_9 = this.context.get_MethodContext().get_Expressions().get_BlockExpressions().get_Item(V_8.get_First().get_Offset()); this.FixAssignmentInList(V_9, V_7); } } finally { ((IDisposable)V_5).Dispose(); } } } finally { ((IDisposable)V_0).Dispose(); } return; }
private List <KeyValuePair <int, int> > MaximumWeightBipartiteGraphMatching() { this.Initialization(); while (true) { this.GenerateExcessMatrixAndEqualitySubgraph(); V_0 = this.FindMaximumCardianlityMatching(); if (V_0.get_Count() == this.size) { break; } V_1 = this.MinimumVertexCover(V_0); V_2 = this.GetMinElement(V_1); V_6 = 0; while (V_6 < this.size) { if (!V_1[V_6]) { stackVariable40 = &this.u[V_6]; stackVariable40 = stackVariable40 - V_2; } if (V_1[V_6 + this.size]) { stackVariable33 = &this.v[V_6]; stackVariable33 = stackVariable33 + V_2; } V_6 = V_6 + 1; } } V_3 = new List <KeyValuePair <int, int> >(); V_4 = V_0.GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); if (this.graph[V_5.get_Key(), V_5.get_Value() - this.size] == 0) { continue; } V_3.Add(new KeyValuePair <int, int>(V_5.get_Key(), V_5.get_Value() - this.size)); } } finally { ((IDisposable)V_4).Dispose(); } return(V_3); }
private bool CheckLoopBody(BlockStatement loopBody, VariableReference v0Variable, VariableReference v1Variable, string operationName) { if (loopBody.get_Statements().get_Count() != 3) { return(false); } if (!loopBody.get_Statements().get_Item(0).IsAssignmentStatement()) { return(false); } V_0 = (loopBody.get_Statements().get_Item(0) as ExpressionStatement).get_Expression() as BinaryExpression; if (V_0.get_Left().get_CodeNodeType() != 26 || V_0.get_Right().get_CodeNodeType() != 26 || (object)(V_0.get_Right() as VariableReferenceExpression).get_Variable() != (object)v0Variable) { return(false); } if ((object)(V_0.get_Left() as VariableReferenceExpression).get_Variable() != (object)v1Variable) { return(false); } if (!this.IsDelegateOperationStatement(loopBody.get_Statements().get_Item(1), operationName, out V_1, out V_2) || V_1.get_CodeNodeType() != 26 || V_2.get_CodeNodeType() != 26 || (object)(V_2 as VariableReferenceExpression).get_Variable() != (object)v1Variable) { return(false); } V_3 = (V_1 as VariableReferenceExpression).get_Variable(); if (!loopBody.get_Statements().get_Item(2).IsAssignmentStatement()) { return(false); } V_4 = (loopBody.get_Statements().get_Item(2) as ExpressionStatement).get_Expression() as BinaryExpression; if (V_4.get_Left().get_CodeNodeType() != 26 || (object)(V_4.get_Left() as VariableReferenceExpression).get_Variable() != (object)v0Variable || V_4.get_Right().get_CodeNodeType() != 19) { return(false); } V_5 = V_4.get_Right() as MethodInvocationExpression; if (String.op_Inequality(V_5.get_MethodExpression().get_Method().get_DeclaringType().get_FullName(), "System.Threading.Interlocked") || V_5.get_MethodExpression().get_Method().get_HasThis() || String.op_Inequality(V_5.get_MethodExpression().get_Method().get_Name(), "CompareExchange") || V_5.get_Arguments().get_Count() != 3 || V_5.get_Arguments().get_Item(0).get_CodeNodeType() != 23) { return(false); } V_6 = V_5.get_Arguments().get_Item(0) as UnaryExpression; if (V_6.get_Operator() != 7 || V_6.get_Operand().get_CodeNodeType() != 30 || (object)(V_6.get_Operand() as FieldReferenceExpression).get_Field().Resolve() != (object)this.eventField) { return(false); } if (V_5.get_Arguments().get_Item(1).get_CodeNodeType() == 26 && (object)(V_5.get_Arguments().get_Item(1) as VariableReferenceExpression).get_Variable() == (object)V_3 && V_5.get_Arguments().get_Item(2).get_CodeNodeType() == 26 && (object)(V_5.get_Arguments().get_Item(2) as VariableReferenceExpression).get_Variable() == (object)v1Variable) { return(true); } return(false); }
private void InitApp(IApi api) { if (!App._isInitialized) { V_0 = App._mutex; V_1 = false; try { Monitor.Enter(V_0, ref V_1); if (!App._isInitialized) { stackVariable7 = this._pageTypes; V_2 = api.get_PageTypes().GetAllAsync().GetAwaiter(); stackVariable7.Init(V_2.GetResult()); stackVariable15 = this._postTypes; V_3 = api.get_PostTypes().GetAllAsync().GetAwaiter(); stackVariable15.Init(V_3.GetResult()); stackVariable23 = this._siteTypes; V_4 = api.get_SiteTypes().GetAllAsync().GetAwaiter(); stackVariable23.Init(V_4.GetResult()); V_5 = this._modules.GetEnumerator(); try { while (V_5.MoveNext()) { V_5.get_Current().get_Instance().Init(); } } finally { if (V_5 != null) { V_5.Dispose(); } } App._isInitialized = true; } } finally { if (V_1) { Monitor.Exit(V_0); } } } return; }
private void ProcessPages(MixCmsContext context, IDbContextTransaction transaction) { V_0 = this.get_Pages().GetEnumerator(); try { while (V_0.MoveNext()) { V_1 = V_0.get_Current(); if (!V_1.get_IsExportData()) { continue; } V_1.set_ModuleNavs(V_1.GetModuleNavs(context, transaction)); V_2 = V_1.get_ModuleNavs().GetEnumerator(); try { while (V_2.MoveNext()) { V_3 = new SiteStructureViewModel.u003cu003ec__DisplayClass49_0(); V_3.u003cu003e4__this = this; V_3.nav = V_2.get_Current(); V_4 = this.get_Modules().FirstOrDefault<Mix.Cms.Lib.ViewModels.MixModules.ImportViewModel>(new Func<Mix.Cms.Lib.ViewModels.MixModules.ImportViewModel, bool>(V_3.u003cProcessPagesu003eb__0)); if (V_4 == null) { V_3.nav.get_Module().set_IsExportData(true); } else { dummyVar0 = this.get_Modules().Remove(V_4); } this.ProcessModuleData(V_3.nav.get_Module(), context, transaction); } } finally { ((IDisposable)V_2).Dispose(); } V_1.set_UrlAliases(V_1.GetAliases(context, transaction)); V_5 = V_1.get_Id(); this.GetAdditionalData(V_5.ToString(), 3, context, transaction); } } finally { ((IDisposable)V_0).Dispose(); } return; }