Ejemplo n.º 1
0
        public static JSIfStatement New(params KeyValuePair <JSExpression, JSStatement>[] conditions)
        {
            if ((conditions == null) || (conditions.Length == 0))
            {
                throw new ArgumentNullException("conditions");
            }

            JSIfStatement result = new JSIfStatement(
                conditions[0].Key, conditions[0].Value
                );
            JSIfStatement next = null, current = result;

            for (int i = 1; i < conditions.Length; i++)
            {
                var cond = conditions[i].Key;

                if (cond != null)
                {
                    next = new JSIfStatement(cond, conditions[i].Value);
                    current._FalseClause = next;
                    current = next;
                }
                else
                {
                    current._FalseClause = conditions[i].Value;
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
 public void VisitNode(JSIfStatement ifs)
 {
     VisitChildren(ifs);
 }
Ejemplo n.º 3
0
        public static JSIfStatement New(params KeyValuePair<JSExpression, JSStatement>[] conditions)
        {
            if ((conditions == null) || (conditions.Length == 0))
                throw new ArgumentNullException("conditions");

            JSIfStatement result = new JSIfStatement(
                conditions[0].Key, conditions[0].Value
            );
            JSIfStatement next = null, current = result;

            for (int i = 1; i < conditions.Length; i++) {
                var cond = conditions[i].Key;

                if (cond != null) {
                    next = new JSIfStatement(cond, conditions[i].Value);
                    current._FalseClause = next;
                    current = next;
                } else
                    current._FalseClause = conditions[i].Value;
            }

            return result;
        }
Ejemplo n.º 4
0
        public JSStatement TranslateNode(ILCondition condition)
        {
            JSStatement result = null;
            if (TranslateCallSiteConstruction(condition, out result))
                return result;

            JSStatement falseBlock = null;
            if ((condition.FalseBlock != null) && (condition.FalseBlock.Body.Count > 0))
                falseBlock = TranslateNode(condition.FalseBlock);

            result = new JSIfStatement(
                TranslateNode(condition.Condition),
                TranslateNode(condition.TrueBlock),
                falseBlock
            );

            return result;
        }
Ejemplo n.º 5
0
 public void VisitNode(JSIfStatement node)
 {
     VisitChildren(node);
 }