mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
LibJS: Make Interpreter::in_strict_mode() work outside of scope
This one is a little weird. I don't know why it's okay for this function to assume that there is a current scope on the scope stack when it can be called during global object initialization etc. For now, just make it say "we are in strict mode" when there is no currently active scope.
This commit is contained in:
parent
893df28e80
commit
668e73df8a
Notes:
sideshowbarker
2024-07-19 02:19:31 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/668e73df8ad
1 changed files with 6 additions and 1 deletions
|
@ -152,7 +152,12 @@ public:
|
|||
const LexicalEnvironment* current_environment() const { return m_call_stack.last().environment; }
|
||||
LexicalEnvironment* current_environment() { return m_call_stack.last().environment; }
|
||||
|
||||
bool in_strict_mode() const { return m_scope_stack.last().scope_node->in_strict_mode(); }
|
||||
bool in_strict_mode() const
|
||||
{
|
||||
if (m_scope_stack.is_empty())
|
||||
return true;
|
||||
return m_scope_stack.last().scope_node->in_strict_mode();
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
void for_each_argument(Callback callback)
|
||||
|
|
Loading…
Reference in a new issue