Esempio n. 1
0
        protected override void TranslateSwitchStatementContinuousSafe(List <string> output, SwitchStatementContinuousSafe switchStatement)
        {
            foreach (SwitchStatement.Chunk chunks in switchStatement.OriginalSwitchStatement.Chunks)
            {
                if (chunks.Cases.Length > 1)
                {
                    throw new Exception("Not a continuous switch statement.");
                }
                if (chunks.Cases[0] == null)
                {
                    throw new Exception("Not a safe switch statement.");
                }
            }

            this.TranslateSwitchStatement(output, switchStatement.OriginalSwitchStatement);
        }
Esempio n. 2
0
 protected abstract void TranslateSwitchStatementContinuousSafe(List <string> output, SwitchStatementContinuousSafe switchStatement);
Esempio n. 3
0
        protected override void TranslateSwitchStatementContinuousSafe(List <string> output, SwitchStatementContinuousSafe switchStatement)
        {
            SwitchStatementContinuousSafe.SearchTree tree = switchStatement.GenerateSearchTree();
            int    switchId = this.GetNextInt();
            string varName  = "switch_key_" + switchId;

            output.Add(this.CurrentTabIndention);
            output.Add(varName);
            output.Add(" = ");
            this.TranslateExpression(output, switchStatement.Condition);
            output.Add("\r\n");
            this.GenerateSearchTree(output, tree, varName);
        }