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); }
protected abstract void TranslateSwitchStatementContinuousSafe(List <string> output, SwitchStatementContinuousSafe switchStatement);
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); }