mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 08:10:02 +00:00
LibWasm: Resolve labels starting from the top of the stack
Otherwise "label index 0" would be the first ever created label, not the last one (as the spec wants) :^(
This commit is contained in:
parent
35b3ae26ed
commit
29b193d25d
Notes:
sideshowbarker
2024-07-18 17:39:33 +09:00
Author: https://github.com/alimpfard
Commit: 29b193d25d
Pull-request: https://github.com/SerenityOS/serenity/pull/7239
Reviewed-by: https://github.com/linusg
1 changed files with 2 additions and 1 deletions
|
@ -11,7 +11,8 @@ namespace Wasm {
|
||||||
|
|
||||||
Optional<Label> Configuration::nth_label(size_t i)
|
Optional<Label> Configuration::nth_label(size_t i)
|
||||||
{
|
{
|
||||||
for (auto& entry : m_stack.entries()) {
|
for (size_t index = m_stack.size(); index > 0; --index) {
|
||||||
|
auto& entry = m_stack.entries()[index - 1];
|
||||||
if (auto ptr = entry.get_pointer<NonnullOwnPtr<Label>>()) {
|
if (auto ptr = entry.get_pointer<NonnullOwnPtr<Label>>()) {
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
return **ptr;
|
return **ptr;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue