protected override IPyStatement[] VisitSwitchStatement(CsharpSwitchStatement src) { var switchStatement = new PySwitchStatement { Expression = TransValue(src.Expression) }; foreach (var sec in src.Sections) { var section = new PySwitchSection { Labels = sec.Labels.Select(q => new PySwitchLabel { Value = q.Expression == null ? null : TransValue(q.Expression), IsDefault = q.IsDefault }).ToArray() }; var statements = this.TranslateStatements(sec.Statements); var block = new PyCodeBlock(); block.Statements.AddRange(statements); section.Statement = PyCodeBlock.Reduce(block); switchStatement.Sections.Add(section); } return(MkArray(switchStatement)); }
protected virtual T VisitPySwitchStatement(PySwitchStatement node) { if (ThrowNotImplementedException) { throw new NotImplementedException(string.Format("Method {0} is not supported in class {1}", "VisitPySwitchStatement", this.GetType().FullName)); } return(default(T)); }
protected override IPyStatement VisitPySwitchStatement(PySwitchStatement node) { return(node.Simplify(this)); }