Esempio n. 1
0
        private void GenerateBlock(Lifter.IR.Block block)
        {
            for (int i = 0; i < block.Body.Count; ++i)
            {
                for (int j = 0; j < indentation; ++j)
                {
                    builder.Append("  ");
                }

                if (block.Body[i] is Lifter.IR.StatementExpression)
                {
                    Lifter.IR.Expression expression = ((Lifter.IR.StatementExpression)block.Body[i]).Expression;

                    if (expression is Lifter.IR.Call)
                    {
                        GenerateCall((Lifter.IR.Call)expression);
                    }
                }

                else if (block.Body[i] is Lifter.IR.LocalAssignment)
                {
                    GenerateLocalAssignment((Lifter.IR.LocalAssignment)block.Body[i]);
                }

                else if (block.Body[i] is Lifter.IR.Assign)
                {
                    GenerateAssign((Lifter.IR.Assign)block.Body[i]);
                }

                builder.Append("\n");
            }
        }
Esempio n. 2
0
        private void GenerateExpression(Lifter.IR.Expression expression)
        {
            if (expression is Lifter.IR.Global)
            {
                builder.Append(((Lifter.IR.Global)expression).value);
            }

            else if (expression is Lifter.IR.Constant)
            {
                builder.Append(((Lifter.IR.Constant)expression).ToString());
            }

            else if (expression is Lifter.IR.LocalExpression)
            {
                GenerateLocalExpression((Lifter.IR.LocalExpression)expression);
            }

            else if (expression is Lifter.IR.NameIndex)
            {
                GenerateNameIndex((Lifter.IR.NameIndex)expression);
            }

            else if (expression is Lifter.IR.Call)
            {
                GenerateCall((Lifter.IR.Call)expression);
            }
        }