mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:18:11 +00:00
LibJS/Bytecode: Perform ToNumeric on accumulator before postfix inc/dec
This ensures we get the expected behavior of code like: let a = [] let b = a++ (Where b should be 0, not [], because JavaScript.)
This commit is contained in:
parent
c9bd324369
commit
d364d99cb8
4 changed files with 26 additions and 0 deletions
|
@ -835,6 +835,19 @@ public:
|
|||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
||||
class ToNumeric final : public Instruction {
|
||||
public:
|
||||
ToNumeric()
|
||||
: Instruction(Type::ToNumeric)
|
||||
{
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> execute_impl(Bytecode::Interpreter&) const;
|
||||
DeprecatedString to_deprecated_string_impl(Bytecode::Executable const&) const;
|
||||
void replace_references_impl(BasicBlock const&, BasicBlock const&) { }
|
||||
void replace_references_impl(Register, Register) { }
|
||||
};
|
||||
|
||||
class Throw final : public Instruction {
|
||||
public:
|
||||
constexpr static bool IsTerminator = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue