using System; using Esprima; using Esprima.Ast; using Jint.Native; namespace Jint.Runtime.Debugger { public sealed class DebugInformation : EventArgs { internal DebugInformation(Statement currentStatement, DebugCallStack callStack, long currentMemoryUsage) { CurrentStatement = currentStatement; CallStack = callStack; CurrentMemoryUsage = currentMemoryUsage; } /// /// The current call stack. /// /// This will always include at least a call frame for the global environment. public DebugCallStack CallStack { get; set; } /// /// The Statement that will be executed on next step. /// Note that this will be null when execution is at a return point. /// public Statement CurrentStatement { get; } /// /// The current source Location. /// For return points, this starts and ends at the end of the function body. /// public Location Location => CurrentCallFrame.Location; /// /// Not implemented. Will always return 0. /// public long CurrentMemoryUsage { get; } /// /// The currently executing call frame. /// public CallFrame CurrentCallFrame => CallStack[0]; /// /// The scope chain of the currently executing call frame. /// public DebugScopes CurrentScopeChain => CurrentCallFrame.ScopeChain; /// /// The return value of the currently executing call frame. /// This is null if execution is not at a return point. /// public JsValue ReturnValue => CurrentCallFrame.ReturnValue; } }