protected override IPhpStatement[] VisitSwitchStatement(CsharpSwitchStatement src)
        {
            var switchStatement = new PhpSwitchStatement
            {
                Expression = TransValue(src.Expression)
            };

            foreach (var sec in src.Sections)
            {
                var section = new PhpSwitchSection
                {
                    Labels = sec.Labels.Select(q => new PhpSwitchLabel
                    {
                        Value     = q.Expression == null ? null : TransValue(q.Expression),
                        IsDefault = q.IsDefault
                    }).ToArray()
                };
                var statements = TranslateStatements(sec.Statements);
                var block      = new PhpCodeBlock();
                block.Statements.AddRange(statements);
                section.Statement = PhpCodeBlock.Reduce(block);
                switchStatement.Sections.Add(section);
            }

            return(MkArray(switchStatement));
        }
Beispiel #2
0
 protected virtual T VisitPhpSwitchStatement(PhpSwitchStatement node)
 {
     if (ThrowNotImplementedException)
     {
         throw new NotImplementedException(string.Format("Method {0} is not supported in class {1}", "VisitPhpSwitchStatement", this.GetType().FullName));
     }
     return(default(T));
 }
 protected override IPhpStatement VisitPhpSwitchStatement(PhpSwitchStatement node)
 {
     return(node.Simplify(this));
 }