Esempio n. 1
0
 void _Visit(JsIfStatement node)
 {
     Keyword("if");
     Control("(");
     Visit(node.Condition);
     Control(")");
     Visit(node.IfStatement);
     if (node.ElseStatement != null)
     {
         Keyword("else");
         Space();
         if (node.ElseStatement is JsIfStatement)
         {
             Visit(node.ElseStatement);
         }
         else
         {
             Visit(node.ElseStatement);
         }
     }
 }
 protected virtual void _visit( JsIfStatement node )
 {
     throw new NotImplementedException( "JsIfStatement" );
 }
Esempio n. 3
0
 public static JsIfStatement Else(this JsIfStatement ifStatement, JsStatement elseStatement)
 {
     ifStatement.ElseStatement = elseStatement;
     return(ifStatement);
 }
Esempio n. 4
0
 public static JsIfStatement Then(this JsIfStatement ifStatement, JsStatement thenStatement)
 {
     ifStatement.IfStatement = thenStatement;
     return(ifStatement);
 }
        protected JsFunction getCachedHtmlFileFunction(string arrayName)
        {
            JsFunction result = null;
            JsBlock resultsBlock = null;

            if ( arrayName != null )
            {
                JsIfStatement ifArrayNotNull = new JsIfStatement();
                string arrayKeyStr = arrayName + "[ " + FILE_NAME_PARAMETER + " ]";
                ifArrayNotNull.Condition = AstUtils.getJsBinaryExpression(AstUtils.getNewMemberExpression(arrayKeyStr), "!=", new JsNullExpression());

                JsBlock ifBlock = new JsBlock();
                ifBlock.Statements = new List<JsStatement>();
                ifArrayNotNull.IfStatement = ifBlock;
                ifBlock.Statements.Add(AstUtils.getJsReturnStatement(arrayKeyStr));

                // function contents
                resultsBlock = new JsBlock();
                resultsBlock.Statements = new List<JsStatement>();
                resultsBlock.Statements.Add(ifArrayNotNull);
                resultsBlock.Statements.Add(new JsReturnStatement());
            }

            if (resultsBlock != null)
            {
                result = new JsFunction();
                result.Parameters = new List<string>();
                result.Parameters.Add(FILE_NAME_PARAMETER);
                result.Block = resultsBlock;
            }

            return result;
        }
 protected override void _visit(JsIfStatement node)
 {
     if (node != null)
     {
         visit(node.Condition);
         visit(node.ElseStatement);
         visit(node.IfStatement);
     }
 }