mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-25 09:04:53 +00:00
LibJS/Bytecode: Always evaluate LHS first in assignment expressions
This fixes an issue where expressions like `a[i] = a[++i]` could evaluate `++i` before `a[i]`.
This commit is contained in:
@@ -435,7 +435,9 @@ Bytecode::CodeGenerationErrorOr<Optional<Bytecode::Operand>> AssignmentExpressio
|
||||
}
|
||||
|
||||
if (expression.is_computed()) {
|
||||
computed_property = TRY(expression.property().generate_bytecode(generator)).value();
|
||||
auto property = TRY(expression.property().generate_bytecode(generator)).value();
|
||||
computed_property = Bytecode::Operand(generator.allocate_register());
|
||||
generator.emit<Bytecode::Op::Mov>(*computed_property, property);
|
||||
|
||||
// To be continued later with PutByValue.
|
||||
} else if (expression.property().is_identifier()) {
|
||||
|
||||
Reference in New Issue
Block a user