mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
LibJS/Bytecode: Make typeof return "undefined" on unresolvable IDs
Previously it would throw instead of returning "undefined" for `typeof Identifier` if Identifier does not exist.
This commit is contained in:
parent
c0fadfb9b7
commit
482a827346
4 changed files with 55 additions and 1 deletions
|
@ -910,6 +910,22 @@ public:
|
|||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
};
|
||||
|
||||
class TypeofVariable final : public Instruction {
|
||||
public:
|
||||
explicit TypeofVariable(IdentifierTableIndex identifier)
|
||||
: Instruction(Type::TypeofVariable)
|
||||
, m_identifier(identifier)
|
||||
{
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
String to_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
|
||||
private:
|
||||
IdentifierTableIndex m_identifier;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace JS::Bytecode {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue