public override string GetValueCodePHP(MethodInfoPointer owner, UInt32 branchId)
        {
            ParameterInfo[]        ps = owner.Info;
            SubMethodParameterInfo p  = (SubMethodParameterInfo)ps[1];

            return(codeName2(p.CodeName, branchId));
        }
        public override CodeStatement GetIncrementalStatement(MethodInfoPointer owner, ILimnorCodeCompiler compiler, IMethodCompile methodToCompile, CodeMemberMethod method, CodeStatementCollection statements, UInt32 branchId)
        {
            ParameterInfo[]         ps   = owner.Info;
            SubMethodParameterInfo  p    = (SubMethodParameterInfo)ps[0];
            CodeExpressionStatement incr = new CodeExpressionStatement(new CodeSnippetExpression(codeName2(p.CodeName, branchId) + "++"));

            return(incr);
        }
        public override CodeStatement GetInitStatement(MethodInfoPointer owner, ILimnorCodeCompiler compiler, IMethodCompile methodToCompile, CodeMemberMethod method, CodeStatementCollection statements, UInt32 branchId)
        {
            ParameterInfo[]                  ps = owner.Info;
            SubMethodParameterInfo           p  = (SubMethodParameterInfo)ps[0];
            CodeVariableDeclarationStatement vd = new CodeVariableDeclarationStatement(typeof(int), codeName2(p.CodeName, branchId), new CodePrimitiveExpression(0));

            return(vd);
        }
 /// <summary>
 /// parameters of the method
 /// </summary>
 /// <returns></returns>
 public override ParameterInfo[] GetParameters()
 {
     if (_parameters == null)
     {
         _parameters    = new ParameterInfo[1];
         _parameters[0] = new SubMethodParameterInfo("value", _itemType.BaseClassType, codeName, "Current collection item");
     }
     return(_parameters);
 }
        public override string GetIncrementalStatementPhp(MethodInfoPointer owner, StringCollection jsCode, StringCollection methodCode, JsMethodCompiler data, UInt32 branchId)
        {
            ParameterInfo[]        ps = owner.Info;
            SubMethodParameterInfo p  = (SubMethodParameterInfo)ps[0];
            string incr = string.Format(CultureInfo.InvariantCulture,
                                        "{0}++", codeName2(p.CodeName, branchId));

            return(incr);
        }
        public override string GetTestExpressionPhp(MethodInfoPointer owner, StringCollection jsCode, StringCollection methodCode, JsMethodCompiler data, UInt32 branchId)
        {
            ParameterInfo[]        ps = owner.Info;
            SubMethodParameterInfo p  = (SubMethodParameterInfo)ps[0];
            string bin = string.Format(CultureInfo.InvariantCulture,
                                       "{0} < count({1});", codeName2(p.CodeName, branchId), owner.Owner.GetPhpScriptReferenceCode(jsCode));

            return(bin);
        }
        public override string[] GetIndexCodesPhp(MethodInfoPointer owner, JsMethodCompiler data, UInt32 branchId)
        {
            ParameterInfo[]        ps = owner.Info;
            SubMethodParameterInfo p  = (SubMethodParameterInfo)ps[0];

            string[] pss = new string[1];
            pss[0] = codeName2(p.CodeName, branchId);
            return(pss);
        }
        /// <summary>
        /// indices for accessing array item
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="method"></param>
        /// <returns></returns>
        public override CodeExpression[] GetIndexCodes(MethodInfoPointer owner, IMethodCompile method, UInt32 branchId)
        {
            ParameterInfo[]        ps = owner.Info;
            SubMethodParameterInfo p  = (SubMethodParameterInfo)ps[0];

            CodeExpression[] pss = new CodeExpression[1];
            pss[0] = new CodeVariableReferenceExpression(codeName2(p.CodeName, branchId));
            return(pss);
        }
 /// <summary>
 /// parameters of the method
 /// </summary>
 /// <returns></returns>
 public override ParameterInfo[] GetParameters()
 {
     if (_parameters == null)
     {
         _parameters    = new ParameterInfo[2];
         _parameters[0] = new SubMethodParameterInfo("index", typeof(int), codeName, "Index for the current array/list item, starting from 0");
         _parameters[1] = new SubMethodParameterInfo("value", _itemType, codeName, "Current array/list item");
     }
     return(_parameters);
 }
        public override CodeExpression GetTestExpression(MethodInfoPointer owner, ILimnorCodeCompiler compiler, IMethodCompile methodToCompile, CodeMemberMethod method, CodeStatementCollection statements, UInt32 branchId)
        {
            ParameterInfo[]              ps  = owner.Info;
            SubMethodParameterInfo       p   = (SubMethodParameterInfo)ps[0];
            CodeBinaryOperatorExpression bin = new CodeBinaryOperatorExpression(
                new CodeVariableReferenceExpression(codeName2(p.CodeName, branchId)),
                CodeBinaryOperatorType.LessThan,
                new CodePropertyReferenceExpression(owner.Owner.GetReferenceCode(methodToCompile, statements, true), "Length"));

            return(bin);
        }