protected override IPhpStatement[] VisitLocalDeclarationStatement(LocalDeclarationStatement src)
        {
            var s = new List <IPhpStatement>();

            foreach (var i in src.Declaration.Declarators)
            {
                /// to jest przypadek z c# 'int x;', dla php można to pominąć
                if (i.Value == null)
                {
                    continue;
                }
                if (i.Value is UnknownIdentifierValue)
                {
                    throw new NotImplementedException();
                }
                var l  = new PhpVariableExpression(PhpVariableExpression.AddDollar(i.Name), PhpVariableKind.Local);
                var r  = TransValue(i.Value);
                var tt = new PhpAssignExpression(l, r);
                s.Add(new PhpExpressionStatement(tt));

                //var r = new PhpAssignVariable( PhpVariableExpression.AddDollar(i.Name), false );
                //// r.Name = "$" + i.Name;
                //r.Value = TV(i.Value);
                //s.Add(r);
            }

            return(s.ToArray());
        }
Example #2
0
        protected override IPhpStatement[] VisitVariableDeclaration(VariableDeclaration src)
        {
            //throw new Exception("DELETE THIS ??????");
            var s = new List <IPhpStatement>();

            foreach (var i in src.Declarators)
            {
                var l  = new PhpVariableExpression(PhpVariableExpression.AddDollar(i.Name), PhpVariableKind.Local);
                var r  = TransValue(i.Value);
                var tt = new PhpAssignExpression(l, r);
                s.Add(new PhpExpressionStatement(tt));

                //var r = new PhpAssignVariable(PhpVariableExpression.AddDollar(i.Name), false);
                //r.Value = TV(i.Value);
                //s.Add(r);
            }
            return(s.ToArray());
        }