public LoopBuilder(LogicalFlowBuilderContext logicalContext, TypeSystem typeSystem)
 {
     this.removedEdges = new Dictionary <ILogicalConstruct, HashSet <ILogicalConstruct> >();
     base(logicalContext);
     this.typeSystem = typeSystem;
     return;
 }
Beispiel #2
0
 public IfBuilder(LogicalFlowBuilderContext logicalContext, TypeSystem typeSystem)
 {
     this.blockToInstructionsCount = new Dictionary <int, int>();
     base(logicalContext);
     this.typeSystem = typeSystem;
     return;
 }
		public GuardedBlocksBuilder(LogicalFlowBuilderContext Context)
		{
			context = Context;
			sortedBlockStarts = context.InstructionToCFGBlockMapping.Keys.ToList<int>();
			sortedBlockStarts.Sort();
			tryBlocksFound = new Dictionary<BlockRange, ExceptionHandlingLogicalConstruct>();
		}
 public GuardedBlocksBuilder(LogicalFlowBuilderContext Context)
 {
     context           = Context;
     sortedBlockStarts = context.InstructionToCFGBlockMapping.Keys.ToList <int>();
     sortedBlockStarts.Sort();
     tryBlocksFound = new Dictionary <BlockRange, ExceptionHandlingLogicalConstruct>();
 }
        protected override string ToString(string constructName, HashSet<CFGBlockLogicalConstruct> printedBlocks, LogicalFlowBuilderContext context)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("IfLogicalConstruct");
            sb.AppendLine("{");

            StringBuilder childStrings = new StringBuilder();
            childStrings.Append((Entry as ConditionLogicalConstruct).ToString(context));
            childStrings.Append(Then.ToString(context));
            if(Else != null)
            {
                childStrings.Append(Else.ToString(context));
            }

            foreach (string line in childStrings.ToString().Split(new String[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
            {
                sb.AppendLine(string.Format("\t{0}", line));
            }

            string followNodeString = string.Format("\tFollowNode: {0}", NodeILOffset(context, CFGFollowNode));
            sb.AppendLine(followNodeString);
            sb.AppendLine("}");

            printedBlocks.UnionWith(this.CFGBlocks);

            return sb.ToString();
        }
 public ConditionBuilder(LogicalFlowBuilderContext logicalBuilderContext, TypeSystem typeSystem)
 {
     base();
     this.typeSystem            = typeSystem;
     this.logicalBuilderContext = logicalBuilderContext;
     this.booleanTypeReference  = logicalBuilderContext.get_CFG().get_MethodBody().get_Method().get_Module().get_TypeSystem().get_Boolean();
     return;
 }
 public GuardedBlocksBuilder(LogicalFlowBuilderContext Context)
 {
     base();
     this.context           = Context;
     this.sortedBlockStarts = this.context.get_InstructionToCFGBlockMapping().get_Keys().ToList <int>();
     this.sortedBlockStarts.Sort();
     this.tryBlocksFound = new Dictionary <BlockRange, ExceptionHandlingLogicalConstruct>();
     return;
 }
        protected override string ToString(string constructName, HashSet<CFGBlockLogicalConstruct> printedBlocks, LogicalFlowBuilderContext context)
        {
            StringBuilder nameBuilder = new StringBuilder(this.GetType().Name);
            if((this.Parent as SwitchLogicalConstruct).DefaultCase != this)
            {
                foreach (int caseIndex in CaseNumbers)
                {
                    nameBuilder.Append(' ');
                    nameBuilder.Append(caseIndex);
                }
            }
            else
            {
                nameBuilder.Append(" Default");
            }

            return base.ToString(nameBuilder.ToString(), printedBlocks, context);
        }
Beispiel #9
0
 internal MethodSpecificContext(DecompilationAnalysisResults analysisResults, Telerik.JustDecompiler.Decompiler.YieldData yieldData, Telerik.JustDecompiler.Decompiler.AsyncData asyncData, bool isMethodBodyChanged, Dictionary <string, Statement> gotoLabels, List <GotoStatement> gotoStatements, StackUsageData stackData, bool isBaseConstructorInvokingConstructor, bool enableEventAnalysis, MethodBody body, Collection <VariableDefinition> variables, Telerik.JustDecompiler.Cil.ControlFlowGraph controlFlowGraph, ExpressionDecompilerData expressions, BlockLogicalConstruct logicalConstructsTree, LogicalFlowBuilderContext logicalConstructsContext, MethodInvocationExpression ctorInvokeExpression, Dictionary <Statement, ILogicalConstruct> statementToLogicalConstruct, Dictionary <ILogicalConstruct, List <Statement> > logicalConstructToStatements, Dictionary <VariableDefinition, string> variableDefinitionToNameMap, HashSet <string> variableNamesCollection, Dictionary <ParameterDefinition, string> parameterDefinitionToNameMap, HashSet <VariableDefinition> variablesToRename, Dictionary <FieldDefinition, Expression> fieldToExpression, int lambdaVariablesCount, Dictionary <VariableDefinition, AssignmentType> variableAssignmentData, List <ParameterDefinition> outParametersToAssign, bool isDestructor, BlockStatement destructorStatements, HashSet <VariableDefinition> undeclaredLinqVariables, Dictionary <VariableReference, Dictionary <FieldDefinition, Expression> > closureVariableToFieldValue, HashSet <VariableDefinition> variablesToNotDeclare, CompilerOptimizedSwitchByStringData switchByStringData)
 {
     base();
     this.set_AnalysisResults(analysisResults);
     this.set_YieldData(yieldData);
     this.set_AsyncData(asyncData);
     this.set_IsMethodBodyChanged(isMethodBodyChanged);
     this.set_GotoLabels(gotoLabels);
     this.set_GotoStatements(gotoStatements);
     this.set_StackData(stackData);
     this.set_IsBaseConstructorInvokingConstructor(isBaseConstructorInvokingConstructor);
     this.set_EnableEventAnalysis(enableEventAnalysis);
     this.set_Body(body);
     this.set_Variables(variables);
     this.set_ControlFlowGraph(controlFlowGraph);
     this.set_Expressions(expressions);
     this.set_LogicalConstructsTree(logicalConstructsTree);
     this.set_LogicalConstructsContext(logicalConstructsContext);
     this.set_CtorInvokeExpression(ctorInvokeExpression);
     this.set_StatementToLogicalConstruct(statementToLogicalConstruct);
     this.set_LogicalConstructToStatements(logicalConstructToStatements);
     this.set_VariableDefinitionToNameMap(variableDefinitionToNameMap);
     this.set_VariableNamesCollection(variableNamesCollection);
     this.set_ParameterDefinitionToNameMap(parameterDefinitionToNameMap);
     this.set_VariablesToRename(variablesToRename);
     this.set_FieldToExpression(fieldToExpression);
     this.set_LambdaVariablesCount(lambdaVariablesCount);
     this.set_VariableAssignmentData(variableAssignmentData);
     this.set_OutParametersToAssign(outParametersToAssign);
     this.set_IsDestructor(isDestructor);
     this.set_DestructorStatements(destructorStatements);
     this.set_UndeclaredLinqVariables(undeclaredLinqVariables);
     this.set_ClosureVariableToFieldValue(closureVariableToFieldValue);
     this.set_VariablesToNotDeclare(variablesToNotDeclare);
     this.set_SwitchByStringData(switchByStringData);
     return;
 }
Beispiel #10
0
 protected override string ToString(string constructName, HashSet <CFGBlockLogicalConstruct> printedBlocks, LogicalFlowBuilderContext context)
 {
     V_0       = new StringBuilder();
     dummyVar0 = V_0.AppendLine("IfLogicalConstruct");
     dummyVar1 = V_0.AppendLine("{");
     V_1       = new StringBuilder();
     dummyVar2 = V_1.Append((this.get_Entry() as ConditionLogicalConstruct).ToString(context));
     dummyVar3 = V_1.Append(this.get_Then().ToString(context));
     if (this.get_Else() != null)
     {
         dummyVar4 = V_1.Append(this.get_Else().ToString(context));
     }
     stackVariable24    = V_1.ToString();
     stackVariable26    = new String[1];
     stackVariable26[0] = Environment.get_NewLine();
     V_3 = stackVariable24.Split(stackVariable26, 1);
     V_4 = 0;
     while (V_4 < (int)V_3.Length)
     {
         V_5       = V_3[V_4];
         dummyVar5 = V_0.AppendLine(String.Format("\t{0}", V_5));
         V_4       = V_4 + 1;
     }
     V_2       = String.Format("\tFollowNode: {0}", this.NodeILOffset(context, this.get_CFGFollowNode()));
     dummyVar6 = V_0.AppendLine(V_2);
     dummyVar7 = V_0.AppendLine("}");
     printedBlocks.UnionWith(this.get_CFGBlocks());
     return(V_0.ToString());
 }
 public SwitchBuilder(LogicalFlowBuilderContext logicalContext)
 {
     base(logicalContext);
     this.logicalConstructToSwitchBlocksMap = new Dictionary <ILogicalConstruct, List <CFGBlockLogicalConstruct> >();
     return;
 }
 public LoopBuilder(LogicalFlowBuilderContext logicalContext, TypeSystem typeSystem)
     :base(logicalContext)
 {
     this.typeSystem = typeSystem;
 }
        protected override string ToString(string constructName, HashSet<CFGBlockLogicalConstruct> printedBlocks, LogicalFlowBuilderContext context)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(LoopType);
            sb.AppendLine("LogicalConstruct");
            sb.AppendLine("{");
            
            foreach (LogicalConstructBase child in GetSortedArrayFromCollection(this.Children))
            {
                string childString = child.ToString(context);
                foreach (string childStringLine in childString.Split(new String[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
                {
                    sb.Append('\t');
                    sb.AppendLine(childStringLine);
                }
                printedBlocks.UnionWith(child.CFGBlocks);
            }

            string followNodeString = string.Format("\tFollowNode: {0}", NodeILOffset(context, CFGFollowNode));
            sb.AppendLine(followNodeString);
            sb.AppendLine("}");

            return sb.ToString();
        }
 protected override string ToString(string constructName, HashSet <CFGBlockLogicalConstruct> printedBlocks, LogicalFlowBuilderContext context)
 {
     V_0       = new StringBuilder();
     dummyVar0 = V_0.Append(this.get_LoopType());
     dummyVar1 = V_0.AppendLine("LogicalConstruct");
     dummyVar2 = V_0.AppendLine("{");
     V_2       = this.GetSortedArrayFromCollection <ISingleEntrySubGraph>(this.get_Children());
     V_3       = 0;
     while (V_3 < (int)V_2.Length)
     {
         V_4                = (LogicalConstructBase)V_2[V_3];
         stackVariable27    = V_4.ToString(context);
         stackVariable29    = new String[1];
         stackVariable29[0] = Environment.get_NewLine();
         V_5                = stackVariable27.Split(stackVariable29, 1);
         V_6                = 0;
         while (V_6 < (int)V_5.Length)
         {
             V_7       = V_5[V_6];
             dummyVar3 = V_0.Append('\t');
             dummyVar4 = V_0.AppendLine(V_7);
             V_6       = V_6 + 1;
         }
         printedBlocks.UnionWith(V_4.get_CFGBlocks());
         V_3 = V_3 + 1;
     }
     V_1       = String.Format("\tFollowNode: {0}", this.NodeILOffset(context, this.get_CFGFollowNode()));
     dummyVar5 = V_0.AppendLine(V_1);
     dummyVar6 = V_0.AppendLine("}");
     return(V_0.ToString());
 }
Beispiel #15
0
 protected override string ToString(string constructName, HashSet <CFGBlockLogicalConstruct> printedBlocks, LogicalFlowBuilderContext context)
 {
     stackVariable0 = new StringBuilder();
     dummyVar0      = stackVariable0.AppendLine("ConditionLogicalConstruct");
     dummyVar1      = stackVariable0.AppendLine("{");
     dummyVar2      = stackVariable0.Append(String.Format("\t{0}: ", this.NodeILOffset(context, this.get_FirstBlock())));
     dummyVar3      = stackVariable0.AppendLine(this.get_ConditionExpression().ToCodeString());
     dummyVar4      = stackVariable0.AppendLine(String.Format("\tTrueSuccessorBlock: {0}", this.NodeILOffset(context, this.get_TrueCFGSuccessor())));
     dummyVar5      = stackVariable0.AppendLine(String.Format("\tFalseSuccessorBlock: {0}", this.NodeILOffset(context, this.get_FalseCFGSuccessor())));
     V_0            = String.Format("\tFollowNode: {0}", this.NodeILOffset(context, this.get_CFGFollowNode()));
     dummyVar6      = stackVariable0.AppendLine(V_0);
     dummyVar7      = stackVariable0.AppendLine("}");
     printedBlocks.UnionWith(this.get_CFGBlocks());
     return(stackVariable0.ToString());
 }
Beispiel #16
0
 internal MethodSpecificContext(DecompilationAnalysisResults analysisResults, YieldData yieldData, AsyncData asyncData,
                                bool isMethodBodyChanged, Dictionary <string, Statement> gotoLabels, List <GotoStatement> gotoStatements,
                                StackUsageData stackData, bool isBaseConstructorInvokingConstructor, bool enableEventAnalysis,
                                MethodBody body, Collection <VariableDefinition> variables, ControlFlowGraph controlFlowGraph,
                                ExpressionDecompilerData expressions, BlockLogicalConstruct logicalConstructsTree, LogicalFlowBuilderContext logicalConstructsContext,
                                MethodInvocationExpression ctorInvokeExpression, Dictionary <Statement, ILogicalConstruct> statementToLogicalConstruct,
                                Dictionary <ILogicalConstruct, List <Statement> > logicalConstructToStatements, Dictionary <VariableDefinition, string> variableDefinitionToNameMap,
                                HashSet <string> variableNamesCollection, Dictionary <ParameterDefinition, string> parameterDefinitionToNameMap,
                                HashSet <VariableDefinition> variablesToRename, Dictionary <FieldDefinition, Expression> fieldToExpression,
                                int lambdaVariablesCount, Dictionary <VariableDefinition, AssignmentType> variableAssignmentData, List <ParameterDefinition> outParametersToAssign,
                                bool isDestructor, BlockStatement destructorStatements, HashSet <VariableDefinition> undeclaredLinqVariables,
                                Dictionary <VariableReference, Dictionary <FieldDefinition, Expression> > closureVariableToFieldValue,
                                HashSet <VariableDefinition> variablesToNotDeclare)
 {
     this.AnalysisResults     = analysisResults;
     this.YieldData           = yieldData;
     this.AsyncData           = asyncData;
     this.IsMethodBodyChanged = isMethodBodyChanged;
     this.GotoLabels          = gotoLabels;
     this.GotoStatements      = gotoStatements;
     this.StackData           = stackData;
     this.IsBaseConstructorInvokingConstructor = isBaseConstructorInvokingConstructor;
     this.EnableEventAnalysis = enableEventAnalysis;
     this.Body                         = body;
     this.Variables                    = variables;
     this.ControlFlowGraph             = controlFlowGraph;
     this.Expressions                  = expressions;
     this.LogicalConstructsTree        = logicalConstructsTree;
     this.LogicalConstructsContext     = logicalConstructsContext;
     this.CtorInvokeExpression         = ctorInvokeExpression;
     this.StatementToLogicalConstruct  = statementToLogicalConstruct;
     this.LogicalConstructToStatements = logicalConstructToStatements;
     this.VariableDefinitionToNameMap  = variableDefinitionToNameMap;
     this.VariableNamesCollection      = variableNamesCollection;
     this.ParameterDefinitionToNameMap = parameterDefinitionToNameMap;
     this.VariablesToRename            = variablesToRename;
     this.FieldToExpression            = fieldToExpression;
     this.LambdaVariablesCount         = lambdaVariablesCount;
     this.VariableAssignmentData       = variableAssignmentData;
     this.OutParametersToAssign        = outParametersToAssign;
     this.IsDestructor                 = isDestructor;
     this.DestructorStatements         = destructorStatements;
     this.UndeclaredLinqVariables      = undeclaredLinqVariables;
     this.ClosureVariableToFieldValue  = closureVariableToFieldValue;
     this.VariablesToNotDeclare        = variablesToNotDeclare;
 }
        protected override string ToString(string constructName, HashSet <CFGBlockLogicalConstruct> printedBlocks, LogicalFlowBuilderContext context)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("ConditionLogicalConstruct");
            sb.AppendLine("{");
            sb.Append(string.Format("\t{0}: ", NodeILOffset(context, this.FirstBlock)));
            sb.AppendLine(ConditionExpression.ToCodeString());
            sb.AppendLine(string.Format("\tTrueSuccessorBlock: {0}", NodeILOffset(context, TrueCFGSuccessor)));
            sb.AppendLine(string.Format("\tFalseSuccessorBlock: {0}", NodeILOffset(context, FalseCFGSuccessor)));

            string followNodeString = string.Format("\tFollowNode: {0}", NodeILOffset(context, CFGFollowNode));

            sb.AppendLine(followNodeString);
            sb.AppendLine("}");
            printedBlocks.UnionWith(this.CFGBlocks);
            return(sb.ToString());
        }
 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());
 }
 protected override string ToString(string constructName, HashSet <CFGBlockLogicalConstruct> printedBlocks, LogicalFlowBuilderContext context)
 {
     V_0 = new StringBuilder(this.GetType().get_Name());
     if ((this.get_Parent() as SwitchLogicalConstruct).get_DefaultCase() == this)
     {
         dummyVar2 = V_0.Append(" Default");
     }
     else
     {
         V_1 = this.get_CaseNumbers().GetEnumerator();
         try
         {
             while (V_1.MoveNext())
             {
                 V_2       = V_1.get_Current();
                 dummyVar0 = V_0.Append(' ');
                 dummyVar1 = V_0.Append(V_2);
             }
         }
         finally
         {
             ((IDisposable)V_1).Dispose();
         }
     }
     return(this.ToString(V_0.ToString(), printedBlocks, context));
 }
 public ConditionBuilder(LogicalFlowBuilderContext logicalBuilderContext, TypeSystem typeSystem)
 {
     this.typeSystem            = typeSystem;
     this.logicalBuilderContext = logicalBuilderContext;
     this.booleanTypeReference  = logicalBuilderContext.CFG.MethodBody.Method.Module.TypeSystem.Boolean;
 }
        protected override string ToString(string constructName, HashSet<CFGBlockLogicalConstruct> printedCFGBlocks, LogicalFlowBuilderContext context)
        {
            StringBuilder theBuilder = new StringBuilder(this.GetType().Name);
            theBuilder.AppendLine();
            theBuilder.AppendLine("{");
            IndentAndAppendString(theBuilder, (this.Entry as LogicalConstructBase).ToString(context));
            theBuilder.AppendLine();

            if (DefaultCase != null)
            {
                IndentAndAppendString(theBuilder, DefaultCase.ToString(context));
            }

            foreach (CaseLogicalConstruct @case in ConditionCases)
            {
                IndentAndAppendString(theBuilder, @case.ToString(context));
            }

            foreach (KeyValuePair<List<int>, CFGBlockLogicalConstruct> pair in NonDominatedCFGSuccessors)
            {
                theBuilder.Append("\tCase");
                foreach (int numLabel in pair.Key)
                {
                    theBuilder.Append(" ").Append(numLabel);
                }
                theBuilder.Append(": ").AppendLine(NodeILOffset(context, pair.Value));
            }

            if (DefaultCase == null)
            {
                theBuilder.Append("\tDefault: ").AppendLine(NodeILOffset(context, this.DefaultCFGSuccessor));
            }

            theBuilder.Append("\tFollowNode: ").AppendLine(NodeILOffset(context, this.CFGFollowNode));
            theBuilder.AppendLine("}");

            printedCFGBlocks.UnionWith(this.CFGBlocks);
            return theBuilder.ToString();
        }
        protected override string ToString(string constructName, HashSet <CFGBlockLogicalConstruct> printedBlocks, LogicalFlowBuilderContext context)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("IfLogicalConstruct");
            sb.AppendLine("{");

            StringBuilder childStrings = new StringBuilder();

            childStrings.Append((Entry as ConditionLogicalConstruct).ToString(context));
            childStrings.Append(Then.ToString(context));
            if (Else != null)
            {
                childStrings.Append(Else.ToString(context));
            }

            foreach (string line in childStrings.ToString().Split(new String[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
            {
                sb.AppendLine(string.Format("\t{0}", line));
            }

            string followNodeString = string.Format("\tFollowNode: {0}", NodeILOffset(context, CFGFollowNode));

            sb.AppendLine(followNodeString);
            sb.AppendLine("}");

            printedBlocks.UnionWith(this.CFGBlocks);

            return(sb.ToString());
        }
        protected override string ToString(string constructName, HashSet <CFGBlockLogicalConstruct> printedBlocks, LogicalFlowBuilderContext context)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(LoopType);
            sb.AppendLine("LogicalConstruct");
            sb.AppendLine("{");

            foreach (LogicalConstructBase child in GetSortedArrayFromCollection(this.Children))
            {
                string childString = child.ToString(context);
                foreach (string childStringLine in childString.Split(new String[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
                {
                    sb.Append('\t');
                    sb.AppendLine(childStringLine);
                }
                printedBlocks.UnionWith(child.CFGBlocks);
            }

            string followNodeString = string.Format("\tFollowNode: {0}", NodeILOffset(context, CFGFollowNode));

            sb.AppendLine(followNodeString);
            sb.AppendLine("}");

            return(sb.ToString());
        }
        protected override string ToString(string constructName, HashSet <CFGBlockLogicalConstruct> printedBlocks, LogicalFlowBuilderContext context)
        {
            StringBuilder nameBuilder = new StringBuilder(this.GetType().Name);

            if ((this.Parent as SwitchLogicalConstruct).DefaultCase != this)
            {
                foreach (int caseIndex in CaseNumbers)
                {
                    nameBuilder.Append(' ');
                    nameBuilder.Append(caseIndex);
                }
            }
            else
            {
                nameBuilder.Append(" Default");
            }

            return(base.ToString(nameBuilder.ToString(), printedBlocks, context));
        }
 public LoopBuilder(LogicalFlowBuilderContext logicalContext, TypeSystem typeSystem)
     : base(logicalContext)
 {
     this.typeSystem = typeSystem;
 }
        protected override string ToString(string constructName, HashSet <CFGBlockLogicalConstruct> printedCFGBlocks, LogicalFlowBuilderContext context)
        {
            StringBuilder theBuilder = new StringBuilder(this.GetType().Name);

            theBuilder.AppendLine();
            theBuilder.AppendLine("{");
            IndentAndAppendString(theBuilder, (this.Entry as LogicalConstructBase).ToString(context));
            theBuilder.AppendLine();

            if (DefaultCase != null)
            {
                IndentAndAppendString(theBuilder, DefaultCase.ToString(context));
            }

            foreach (CaseLogicalConstruct @case in ConditionCases)
            {
                IndentAndAppendString(theBuilder, @case.ToString(context));
            }

            foreach (KeyValuePair <List <int>, CFGBlockLogicalConstruct> pair in NonDominatedCFGSuccessors)
            {
                theBuilder.Append("\tCase");
                foreach (int numLabel in pair.Key)
                {
                    theBuilder.Append(" ").Append(numLabel);
                }
                theBuilder.Append(": ").AppendLine(NodeILOffset(context, pair.Value));
            }

            if (DefaultCase == null)
            {
                theBuilder.Append("\tDefault: ").AppendLine(NodeILOffset(context, this.DefaultCFGSuccessor));
            }

            theBuilder.Append("\tFollowNode: ").AppendLine(NodeILOffset(context, this.CFGFollowNode));
            theBuilder.AppendLine("}");

            printedCFGBlocks.UnionWith(this.CFGBlocks);
            return(theBuilder.ToString());
        }
 public SwitchBuilder(LogicalFlowBuilderContext logicalContext)
     :base(logicalContext)
 {
     this.logicalConstructToSwitchBlocksMap = new Dictionary<ILogicalConstruct, List<CFGBlockLogicalConstruct>>();
 }
        protected override string ToString(string constructName, HashSet<CFGBlockLogicalConstruct> printedBlocks, LogicalFlowBuilderContext context)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("ConditionLogicalConstruct");
            sb.AppendLine("{");
            sb.Append(string.Format("\t{0}: ", NodeILOffset(context, this.FirstBlock)));
            sb.AppendLine(ConditionExpression.ToCodeString());
            sb.AppendLine(string.Format("\tTrueSuccessorBlock: {0}", NodeILOffset(context, TrueCFGSuccessor)));
            sb.AppendLine(string.Format("\tFalseSuccessorBlock: {0}", NodeILOffset(context, FalseCFGSuccessor)));

            string followNodeString = string.Format("\tFollowNode: {0}", NodeILOffset(context, CFGFollowNode));
            sb.AppendLine(followNodeString);
            sb.AppendLine("}");
            printedBlocks.UnionWith(this.CFGBlocks);
            return sb.ToString();
        }
 public ConditionBuilder(LogicalFlowBuilderContext logicalBuilderContext, TypeSystem typeSystem)
 {
     this.typeSystem = typeSystem;
     this.logicalBuilderContext = logicalBuilderContext;
     this.booleanTypeReference = logicalBuilderContext.CFG.MethodBody.Method.Module.TypeSystem.Boolean;
 }