コード例 #1
0
        protected override IPhpStatement[] VisitForStatement(ForStatement src)
        {
            var condition       = TransValue(src.Condition);
            var statement       = TranslateStatementOne(src.Statement);
            var incrementors    = TranslateStatements(src.Incrementors);
            var declarations    = TranslateStatement(src.Declaration).ToArray();
            var phpDeclarations = new List <PhpAssignExpression>();

            foreach (object declaration in declarations)
            {
                var d = declaration;
                if (declaration is PhpExpressionStatement)
                {
                    d = (declaration as PhpExpressionStatement).Expression;
                }
                if (d is PhpAssignExpression)
                {
                    phpDeclarations.Add(d as PhpAssignExpression);
                }
                else
                {
                    throw new NotSupportedException();
                }
            }

            var result = new PhpForStatement(phpDeclarations.ToArray(), condition, statement, incrementors);

            return(MkArray(result));
        }
コード例 #2
0
ファイル: PhpBaseVisitor.cs プロジェクト: yekainew/cs2php
 protected virtual T VisitPhpForStatement(PhpForStatement node)
 {
     if (ThrowNotImplementedException)
     {
         throw new NotImplementedException(string.Format("Method {0} is not supported in class {1}", "VisitPhpForStatement", this.GetType().FullName));
     }
     return(default(T));
 }
コード例 #3
0
 protected override IPhpStatement VisitPhpForStatement(PhpForStatement node)
 {
     return(node.Simplify(this));
 }