Exemple #1
0
        private EvaluationResult StepThrough(Node node, Context context, ModuleLiteral env, EvaluationStackFrame args, Func <EvaluationResult> continuation)
        {
            Contract.Requires(context?.DebugState?.Action != null);

            var previousStop  = context.DebugState.Action;
            var callStack     = EvaluationState.GetStackTrace(context, env, node);
            var callStackSize = callStack.Length;

            // dont't stop if either:
            //   (1) no call stack is available, or
            //   (2) top stack is an ambient call (because there are no sources for ambient calls), or
            //   (3) current node is of a certain type (because people are not used to it)
            if (callStackSize == 0 ||
                DoesTopStackHaveSource(callStack) ||
                (node is FunctionLikeExpression) ||
                (node is BlockStatement))
            {
                return(RunToBreakpoint(node, context, env, args, continuation));
            }

            if (ShouldPause(node, context, previousStop, callStackSize))
            {
                PauseEvaluation(node, context, env, args, GetPauseReason(previousStop));
            }

            return(RunToBreakpoint(node, context, env, args, continuation));
        }
Exemple #2
0
        private static bool IsCallStackShallower(Node node, Context context, ModuleLiteral env, DebugAction debugAction)
        {
            var callStackSize = EvaluationState.GetStackTrace(context, env, node).Length;

            return(callStackSize < debugAction.StackSize);
        }