mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibJS/Bytecode: Add support for direct eval()
This is implemented as a special mode of the Call opcode that invokes the PerformEval AO (instead of the Call or Construct AO).
This commit is contained in:
parent
8a3e350321
commit
2ac8a4bbb7
Notes:
sideshowbarker
2024-07-17 06:09:44 +09:00
Author: https://github.com/awesomekling
Commit: 2ac8a4bbb7
Pull-request: https://github.com/SerenityOS/serenity/pull/19408
Issue: https://github.com/SerenityOS/serenity/issues/15210
3 changed files with 25 additions and 4 deletions
|
@ -1379,6 +1379,8 @@ Bytecode::CodeGenerationErrorOr<void> CallExpression::generate_bytecode(Bytecode
|
|||
Bytecode::Op::Call::CallType call_type;
|
||||
if (is<NewExpression>(*this)) {
|
||||
call_type = Bytecode::Op::Call::CallType::Construct;
|
||||
} else if (m_callee->is_identifier() && static_cast<Identifier const&>(*m_callee).string() == "eval"sv) {
|
||||
call_type = Bytecode::Op::Call::CallType::DirectEval;
|
||||
} else {
|
||||
call_type = Bytecode::Op::Call::CallType::Call;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue