Пример #1
0
        public void VisitNode(JSBreakExpression be)
        {
            if (be.TargetLoop.HasValue)
                UsedLoops.Add(be.TargetLoop.Value);

            VisitChildren(be);
        }
Пример #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;
            }
        }
Пример #3
0
        public void VisitNode(JSBreakExpression be)
        {
            if (be.TargetLoop.HasValue && LoopIndexStack.Contains(be.TargetLoop.Value))
            {
                RecordUntargettedExit();
            }

            VisitControlFlowNode(be);
        }
Пример #4
0
        public void VisitNode(JSBreakExpression be)
        {
            if (be.TargetLoop.HasValue)
            {
                UsedLoops.Add(be.TargetLoop.Value);
            }

            VisitChildren(be);
        }
Пример #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)
                );
        }
Пример #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)
                );
        }
Пример #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);
        }
Пример #8
0
        protected JSBreakExpression Translate_LoopOrSwitchBreak(ILExpression node)
        {
            var result = new JSBreakExpression();

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

            return result;
        }
Пример #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;
        }
Пример #10
0
 public void VisitNode(JSBreakExpression be)
 {
     VisitControlFlowNode(be);
 }
Пример #11
0
        public void VisitNode(JSBreakExpression be)
        {
            VisitChildren(be);

            Result.Add(GenerateSubtreeBarrier(0, BarrierFlags.Jump));
        }
Пример #12
0
 public void VisitNode(JSBreakExpression be)
 {
     VisitControlFlowNode(be);
 }