Exemple #1
0
        public void VisitNode(JSGotoExpression ge)
        {
            if (LabelGroupStack.Count > 0)
            {
                var enclosingLabelledStatement = Stack.OfType <JSStatement>().LastOrDefault((n) => n.Label != null);

                if (enclosingLabelledStatement != null)
                {
                    foreach (var lg in LabelGroupStack)
                    {
                        LabelGroupLabelData labelData;

                        if (lg.TryGetValue(enclosingLabelledStatement.Label, out labelData))
                        {
                            if (ge is JSExitLabelGroupExpression)
                            {
                                labelData.UntargettedExitCount += 1;
                            }
                            else
                            {
                                labelData.ExitTargetLabels.Add(ge.TargetLabel);
                            }
                        }
                    }
                }
            }

            VisitControlFlowNode(ge);
        }
Exemple #2
0
        public void VisitNode(JSGotoExpression ge)
        {
            var labelInfo = GetLabelInfo(ge.TargetLabel);

            Formatter.ConditionalNewLine();
            Comment("goto {0}", ge.TargetLabel);
            Formatter.WriteRaw("(block (set_local $currentLabel_{0} (i32.const {1})) (break $labelgroup_{0}_dispatch) )", labelInfo.GroupIndex, labelInfo.LabelIndex);
            Formatter.NewLine();
        }
Exemple #3
0
        public void VisitNode(JSGotoExpression ge)
        {
            Gotos.Add(new GotoEntry {
                Goto           = ge,
                EnclosingBlock = BlockStack.Peek()
            });

            UsedLabels.Add(ge.TargetLabel);

            VisitChildren(ge);
        }
Exemple #4
0
        public void VisitNode(JSGotoExpression go)
        {
            if (GotoStack.Count > 0)
            {
                foreach (var eg in GotoStack)
                {
                    if (eg(go.TargetLabel))
                    {
                        return;
                    }
                }
            }

            Output.Identifier("JSIL.UntranslatableInstruction", null);
            Output.LPar();
            Output.Value(go.ToString());
            Output.RPar();
        }
        public void VisitNode(JSGotoExpression ge)
        {
            Gotos.Add(new GotoEntry {
                Goto = ge,
                EnclosingBlock = BlockStack.Peek()
            });

            UsedLabels.Add(ge.TargetLabel);

            VisitChildren(ge);
        }
        public void VisitNode(JSGotoExpression ge)
        {
            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}", ge);

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

            VisitChildren(ge);
        }
 public void VisitNode(JSGotoExpression ge)
 {
     VisitControlFlowNode(ge);
 }
 public void VisitNode(JSGotoExpression ge)
 {
     VisitControlFlowNode(ge);
 }