public void VisitNode(JSSwitchCase sc) { SwitchCaseStack.Push(sc); if (TraceLevel >= 2) { if (sc.Values != null) Console.WriteLine("// Entering case {0}", sc.Values.FirstOrDefault()); else Console.WriteLine("// Entering case default"); } VisitChildren(sc); if (TraceLevel >= 2) Console.WriteLine("// Exiting case"); SwitchCaseStack.Pop(); }
// Crossing these kinds of control flow boundaries would change behavior. public void VisitNode(JSSwitchCase sc) { VisitChildren(sc); }
public void VisitNode(JSBlockStatement bs) { var thisSwitchCase = ParentSwitchCase; var parentLabelGroup = ParentNode as JSLabelGroupStatement; var isControlFlow = bs.IsControlFlow || (thisSwitchCase != LastSwitchCase) || (parentLabelGroup != null); if (TraceLevel >= 2) Console.WriteLine("// Entering block {0}", bs.Label ?? bs.GetType().Name); if (isControlFlow) { if (TraceLevel >= 2) Console.WriteLine("// Count reset"); AbsoluteJumpsSeenStack.Add(0); } BlockStack.Push(bs); VisitChildren(bs); BlockStack.Pop(); if (TraceLevel >= 2) Console.WriteLine("// Exiting block"); if (isControlFlow) AbsoluteJumpsSeenStack.RemoveAt(AbsoluteJumpsSeenStack.Count - 1); LastSwitchCase = thisSwitchCase; }