1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 09:28:13 +00:00

LibWasm: Fix validation of if-else blocks

We were doing a number of things wrong:
- Switching to the parent context in the else meant that we couldn't
  break out of the else section anymore
- We were not validating the resulting values, and so the stack was
  in a relatively unknown state after 'else'

This commit fixes these issues :^)
This commit is contained in:
Ali Mohammad Pur 2022-02-15 17:32:13 +03:30 committed by Ali Mohammad Pur
parent 385b07dcda
commit eccdf4eb4b
2 changed files with 33 additions and 15 deletions

View file

@ -260,7 +260,6 @@ private:
enum class ChildScopeKind {
Block,
Loop,
IfWithoutElse,
IfWithElse,
Else,
@ -270,7 +269,6 @@ private:
size_t initial_stack_size { 0 };
struct IfDetails {
Stack initial_stack;
Stack true_branch_stack;
};
Variant<IfDetails, Empty> details;
};