mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:48:11 +00:00
LibJS: Track source positions all the way down to exceptions
This makes exceptions have a trace of source positions too, which could probably be helpful in making fancier error tracebacks.
This commit is contained in:
parent
f17874ecd2
commit
b34b681811
10 changed files with 647 additions and 245 deletions
|
@ -126,10 +126,14 @@ public:
|
|||
|
||||
void pop_call_frame() { m_call_stack.take_last(); }
|
||||
|
||||
void push_ast_node(const ASTNode& node) { m_ast_nodes.append(&node); }
|
||||
void pop_ast_node() { m_ast_nodes.take_last(); }
|
||||
|
||||
CallFrame& call_frame() { return *m_call_stack.last(); }
|
||||
const CallFrame& call_frame() const { return *m_call_stack.last(); }
|
||||
const Vector<CallFrame*>& call_stack() const { return m_call_stack; }
|
||||
Vector<CallFrame*>& call_stack() { return m_call_stack; }
|
||||
const Vector<const ASTNode*>& node_stack() const { return m_ast_nodes; }
|
||||
|
||||
const ScopeObject* current_scope() const { return call_frame().scope; }
|
||||
ScopeObject* current_scope() { return call_frame().scope; }
|
||||
|
@ -249,6 +253,7 @@ private:
|
|||
Vector<Interpreter*> m_interpreters;
|
||||
|
||||
Vector<CallFrame*> m_call_stack;
|
||||
Vector<const ASTNode*> m_ast_nodes;
|
||||
|
||||
Value m_last_value;
|
||||
ScopeType m_unwind_until { ScopeType::None };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue