Ejemplo n.º 1
0
        public void VisitNode(JSContinueExpression cont)
        {
            var parentLoop = Stack.OfType<JSLoopStatement>().FirstOrDefault();
            if (
                (parentLoop != null) &&
                (cont.TargetLoop == parentLoop.Index)
            ) {
                if (
                    Stack.Skip(1).TakeWhile((s) => s != parentLoop)
                        .All((s) => {
                            var l = s.Children.LastOrDefault();
                            if (l != null)
                                return l.SelfAndChildrenRecursive.Contains(cont);
                            else
                                return false;
                        })
                ) {
                    var newNull = new JSNullExpression();
                    ParentNode.ReplaceChild(cont, newNull);
                    VisitReplacement(newNull);
                    return;
                }
            }

            VisitChildren(cont);
        }
Ejemplo n.º 2
0
        public void VisitNode(JSContinueExpression cont)
        {
            var parentLoop = Stack.OfType <JSLoopStatement>().FirstOrDefault();

            if (
                (parentLoop != null) &&
                (cont.TargetLoop == parentLoop.Index)
                )
            {
                if (
                    Stack.Skip(1).TakeWhile((s) => s != parentLoop)
                    .All((s) => {
                    var l = s.Children.LastOrDefault();
                    if (l != null)
                    {
                        return(l.SelfAndChildrenRecursive.Contains(cont));
                    }
                    else
                    {
                        return(false);
                    }
                })
                    )
                {
                    var newNull = new JSNullExpression();
                    ParentNode.ReplaceChild(cont, newNull);
                    VisitReplacement(newNull);
                    return;
                }
            }

            VisitChildren(cont);
        }
Ejemplo n.º 3
0
        public void VisitNode(JSContinueExpression ce)
        {
            if (ce.TargetLoop.HasValue)
                UsedLoops.Add(ce.TargetLoop.Value);

            VisitChildren(ce);
        }
Ejemplo n.º 4
0
        public void VisitNode(JSContinueExpression ce)
        {
            if (ce.TargetLoop.HasValue && LoopIndexStack.Contains(ce.TargetLoop.Value))
            {
                RecordUntargettedExit();
            }

            VisitControlFlowNode(ce);
        }
Ejemplo n.º 5
0
        public void VisitNode(JSContinueExpression ce)
        {
            if (ce.TargetLoop.HasValue)
            {
                UsedLoops.Add(ce.TargetLoop.Value);
            }

            VisitChildren(ce);
        }
Ejemplo n.º 6
0
        public void VisitNode(JSContinueExpression ce)
        {
            if (!ce.TargetLoop.HasValue)
            {
                throw new Exception("Continue expression without target loop");
            }

            var targetLoop = ce.TargetLoop.Value;

            Formatter.WriteSExpr(
                "break", (_) => _.WriteRaw("$loop_{0}_iterate", ce.TargetLoop.Value)
                );
        }
Ejemplo n.º 7
0
        public void VisitNode(JSContinueExpression ce)
        {
            int targetLoop;

            if (ce.TargetLoop.HasValue)
            {
                targetLoop = ce.TargetLoop.Value;
            }
            else
            {
                targetLoop = Stack.OfType <JSLoopStatement>().First().Index.Value;
            }

            Formatter.WriteSExpr(
                "break", (_) => _.WriteRaw("$loop_{0}_iterate", ce.TargetLoop.Value)
                );
        }
Ejemplo n.º 8
0
 public void VisitNode(JSContinueExpression cont)
 {
     if (cont.TargetLoop.HasValue)
     {
         Output.WriteRaw("continue");
         Output.Space();
         Output.Identifier(String.Format("$loop{0}", cont.TargetLoop.Value));
     }
     else if (GotoStack.Count > 0)
     {
         GotoStack.Peek()(null);
     }
     else
     {
         Output.WriteRaw("continue");
     }
 }
Ejemplo n.º 9
0
        public void VisitNode(JSContinueExpression ce)
        {
            var stackSlice = Stack.Take(3).ToArray();
            var parentEs = stackSlice[1] as JSExpressionStatement;
            var parentBlock = stackSlice[2] as JSBlockStatement;

            if ((parentEs != null) && (parentBlock == BlockStack.Peek())) {
                AbsoluteJumpsSeen += 1;

                if (AbsoluteJumpsSeen > 1) {
                    if (TraceLevel >= 1)
                        Console.WriteLine("// Eliminating {0}", ce);

                    var replacement = new JSNullExpression();
                    ParentNode.ReplaceChild(ce, replacement);
                    return;
                } else {
                    if (TraceLevel >= 3)
                        Console.WriteLine("// Not eliminating {0}", ce);
                }
            }

            VisitChildren(ce);
        }
Ejemplo n.º 10
0
        protected JSContinueExpression Translate_LoopContinue(ILExpression node)
        {
            var result = new JSContinueExpression();

            if (Blocks.Count > 0)
                result.TargetLabel = Blocks.Peek().Label;

            return result;
        }
Ejemplo n.º 11
0
        protected JSContinueExpression Translate_LoopContinue(ILExpression node)
        {
            var result = new JSContinueExpression();

            if (Blocks.Count > 0) {
                var theLoop = Blocks.Peek() as JSLoopStatement;
                if (theLoop != null)
                    result.TargetLoop = theLoop.Index.Value;
            }

            return result;
        }
Ejemplo n.º 12
0
 public void VisitNode(JSContinueExpression ce)
 {
     VisitControlFlowNode(ce);
 }
Ejemplo n.º 13
0
        public void VisitNode(JSContinueExpression ce)
        {
            VisitChildren(ce);

            Result.Add(GenerateSubtreeBarrier(0, BarrierFlags.Jump));
        }
Ejemplo n.º 14
0
 public void VisitNode(JSContinueExpression ce)
 {
     VisitControlFlowNode(ce);
 }