Example #1
0
        public void VisitNode(JSBreakExpression be)
        {
            if (be.TargetLoop.HasValue)
                UsedLoops.Add(be.TargetLoop.Value);

            VisitChildren(be);
        }
Example #2
0
        public void VisitNode(JSBreakExpression brk)
        {
            if (brk.TargetLoop.HasValue)
            {
                Output.WriteRaw("break");
                Output.Space();
                Output.Identifier(String.Format("$loop{0}", brk.TargetLoop.Value));
                return;
            }

            if (BlockStack.Count == 0)
            {
                throw new NotImplementedException("Break expression found outside of block");
            }

            switch (BlockStack.Peek())
            {
            case BlockType.Switch:
                Output.WriteRaw("break");
                break;

            default:
                throw new NotImplementedException("Break statement found outside of switch statement or loop");
                break;
            }
        }
Example #3
0
        public void VisitNode(JSBreakExpression be)
        {
            if (be.TargetLoop.HasValue && LoopIndexStack.Contains(be.TargetLoop.Value))
            {
                RecordUntargettedExit();
            }

            VisitControlFlowNode(be);
        }
Example #4
0
        public void VisitNode(JSBreakExpression be)
        {
            if (be.TargetLoop.HasValue)
            {
                UsedLoops.Add(be.TargetLoop.Value);
            }

            VisitChildren(be);
        }
Example #5
0
        public void VisitNode(JSBreakExpression be)
        {
            if (!be.TargetLoop.HasValue)
            {
                // Switch break
                return;
            }

            var targetLoop = be.TargetLoop.Value;

            Formatter.WriteSExpr(
                "break", (_) => _.WriteRaw("$loop_{0}", be.TargetLoop.Value)
                );
        }
Example #6
0
        public void VisitNode(JSBreakExpression be)
        {
            int targetLoop;

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

            Formatter.WriteSExpr(
                "break", (_) => _.WriteRaw("$loop_{0}", be.TargetLoop.Value)
                );
        }
Example #7
0
        public void VisitNode(JSBreakExpression be)
        {
            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}", be);

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

            VisitChildren(be);
        }
Example #8
0
        protected JSBreakExpression Translate_LoopOrSwitchBreak(ILExpression node)
        {
            var result = new JSBreakExpression();

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

            return result;
        }
Example #9
0
        protected JSBreakExpression Translate_LoopOrSwitchBreak(ILExpression node)
        {
            var result = new JSBreakExpression();

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

            return result;
        }
 public void VisitNode(JSBreakExpression be)
 {
     VisitControlFlowNode(be);
 }
Example #11
0
        public void VisitNode(JSBreakExpression be)
        {
            VisitChildren(be);

            Result.Add(GenerateSubtreeBarrier(0, BarrierFlags.Jump));
        }
Example #12
0
 public void VisitNode(JSBreakExpression be)
 {
     VisitControlFlowNode(be);
 }