public static JsDoWhileStatement DoWhile(JsExpression condition, JsStatement body)
 {
     return(new JsDoWhileStatement(condition, body));
 }
        public JsForStatement(JsStatement initStatement, JsExpression conditionExpression, JsExpression iteratorExpression, JsStatement body)
        {
            if (initStatement == null)
            {
                throw new ArgumentNullException("initStatement");
            }
            if (!(initStatement is JsEmptyStatement || initStatement is JsVariableDeclarationStatement || initStatement is JsExpressionStatement))
            {
                throw new ArgumentException("initStatement must be a VariableDeclarationStatement or an ExpressionStatement.", "initStatement");
            }
            if (body == null)
            {
                throw new ArgumentNullException("body");
            }

            InitStatement       = initStatement;
            ConditionExpression = conditionExpression;
            IteratorExpression  = iteratorExpression;
            Body = JsBlockStatement.MakeBlock(body);
        }
 public static JsTryStatement Try(JsStatement guardedStatement, JsCatchClause catchClause, JsStatement @finally)
 {
     return(new JsTryStatement(guardedStatement, catchClause, @finally));
 }
 public static JsWithStatement With(JsExpression @object, JsStatement body)
 {
     return(new JsWithStatement(@object, body));
 }
 public static JsSwitchSection SwitchSection(IEnumerable <JsExpression> values, JsStatement body)
 {
     return(new JsSwitchSection(values, body));
 }
 public static JsCatchClause Catch(string identifier, JsStatement body)
 {
     return(new JsCatchClause(identifier, body));
 }
 public static JsIfStatement If(JsExpression test, JsStatement then, JsStatement @else)
 {
     return(new JsIfStatement(test, then, @else));
 }
 public static JsLabelledStatement Label(string label, JsStatement statement)
 {
     return(new JsLabelledStatement(label, statement));
 }
 public static JsFunctionStatement Function(string name, IEnumerable <string> parameterNames, JsStatement body)
 {
     return(new JsFunctionStatement(name, parameterNames, body));
 }
Example #10
0
 public static JsForStatement For(JsStatement initStatement, JsExpression conditionExpression, JsExpression iteratorExpression, JsStatement body)
 {
     return(new JsForStatement(initStatement, conditionExpression, iteratorExpression, body));
 }
Example #11
0
 public static JsForEachInStatement ForIn(string loopVariableName, JsExpression objectToIterateOver, JsStatement body, bool isLoopVariableDeclared = true)
 {
     return(new JsForEachInStatement(loopVariableName, objectToIterateOver, body, isLoopVariableDeclared));
 }
 public JsLabelledStatement(string label, JsStatement statement)
 {
     Require.ValidJavaScriptIdentifier(label, "label", allowNull: false);
     Label     = label;
     Statement = statement;
 }
Example #13
0
        public JsForEachInStatement(string loopVariableName, JsExpression objectToIterateOver, JsStatement body, bool isLoopVariableDeclared = true)
        {
            if (loopVariableName == null)
            {
                throw new ArgumentNullException("loopVariableName");
            }
            if (!loopVariableName.IsValidJavaScriptIdentifier())
            {
                throw new ArgumentException("loopVariableName");
            }
            if (objectToIterateOver == null)
            {
                throw new ArgumentNullException("objectToIterateOver");
            }
            if (body == null)
            {
                throw new ArgumentNullException("body");
            }

            LoopVariableName    = loopVariableName;
            ObjectToIterateOver = objectToIterateOver;
            Body = JsBlockStatement.MakeBlock(body);
            IsLoopVariableDeclared = isLoopVariableDeclared;
        }