mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:07:34 +00:00
LibJS: Provide better assertion for empty execution context stack
When calling `running_execution_context` from other VM APIs, and the execution context stack is empty, the verification message is inlined from AK::Vector. Add a specific VERIFY to `running_execution_context` to help diagnose this issue better.
This commit is contained in:
parent
64912d4d02
commit
82ec1ea75e
1 changed files with 10 additions and 3 deletions
|
@ -114,8 +114,16 @@ public:
|
|||
// https://tc39.es/ecma262/#running-execution-context
|
||||
// At any point in time, there is at most one execution context per agent that is actually executing code.
|
||||
// This is known as the agent's running execution context.
|
||||
ExecutionContext& running_execution_context() { return *m_execution_context_stack.last(); }
|
||||
ExecutionContext const& running_execution_context() const { return *m_execution_context_stack.last(); }
|
||||
ExecutionContext& running_execution_context()
|
||||
{
|
||||
VERIFY(!m_execution_context_stack.is_empty());
|
||||
return *m_execution_context_stack.last();
|
||||
}
|
||||
ExecutionContext const& running_execution_context() const
|
||||
{
|
||||
VERIFY(!m_execution_context_stack.is_empty());
|
||||
return *m_execution_context_stack.last();
|
||||
}
|
||||
|
||||
// https://tc39.es/ecma262/#execution-context-stack
|
||||
// The execution context stack is used to track execution contexts.
|
||||
|
@ -156,7 +164,6 @@ public:
|
|||
|
||||
Value this_value() const
|
||||
{
|
||||
VERIFY(!m_execution_context_stack.is_empty());
|
||||
return running_execution_context().this_value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue