Ejemplo n.º 1
0
 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);
        }
Ejemplo n.º 3
0
 public static JsTryStatement Try(JsStatement guardedStatement, JsCatchClause catchClause, JsStatement @finally)
 {
     return(new JsTryStatement(guardedStatement, catchClause, @finally));
 }
Ejemplo n.º 4
0
 public static JsWithStatement With(JsExpression @object, JsStatement body)
 {
     return(new JsWithStatement(@object, body));
 }
Ejemplo n.º 5
0
 public static JsSwitchSection SwitchSection(IEnumerable <JsExpression> values, JsStatement body)
 {
     return(new JsSwitchSection(values, body));
 }
Ejemplo n.º 6
0
 public static JsCatchClause Catch(string identifier, JsStatement body)
 {
     return(new JsCatchClause(identifier, body));
 }
Ejemplo n.º 7
0
 public static JsIfStatement If(JsExpression test, JsStatement then, JsStatement @else)
 {
     return(new JsIfStatement(test, then, @else));
 }
Ejemplo n.º 8
0
 public static JsLabelledStatement Label(string label, JsStatement statement)
 {
     return(new JsLabelledStatement(label, statement));
 }
Ejemplo n.º 9
0
 public static JsFunctionStatement Function(string name, IEnumerable <string> parameterNames, JsStatement body)
 {
     return(new JsFunctionStatement(name, parameterNames, body));
 }
Ejemplo n.º 10
0
 public static JsForStatement For(JsStatement initStatement, JsExpression conditionExpression, JsExpression iteratorExpression, JsStatement body)
 {
     return(new JsForStatement(initStatement, conditionExpression, iteratorExpression, body));
 }
Ejemplo n.º 11
0
 public static JsForEachInStatement ForIn(string loopVariableName, JsExpression objectToIterateOver, JsStatement body, bool isLoopVariableDeclared = true)
 {
     return(new JsForEachInStatement(loopVariableName, objectToIterateOver, body, isLoopVariableDeclared));
 }
Ejemplo n.º 12
0
 public JsLabelledStatement(string label, JsStatement statement)
 {
     Require.ValidJavaScriptIdentifier(label, "label", allowNull: false);
     Label     = label;
     Statement = statement;
 }
Ejemplo n.º 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;
        }