summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/VM.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/VM.cpp')
-rw-r--r--Userland/Libraries/LibJS/Runtime/VM.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp
index 2efebbe12d..17bc99b593 100644
--- a/Userland/Libraries/LibJS/Runtime/VM.cpp
+++ b/Userland/Libraries/LibJS/Runtime/VM.cpp
@@ -622,4 +622,17 @@ void VM::dump_backtrace() const
dbgln("-> {}", m_call_stack[i]->function_name);
}
+void VM::dump_scope_chain() const
+{
+ for (auto* scope = current_scope(); scope; scope = scope->parent()) {
+ dbgln("+> {} ({:p})", scope->class_name(), scope);
+ if (is<LexicalEnvironment>(*scope)) {
+ auto& lexical_environment = static_cast<LexicalEnvironment const&>(*scope);
+ for (auto& variable : lexical_environment.variables()) {
+ dbgln(" {}", variable.key);
+ }
+ }
+ }
+}
+
}