From abdad356462b4b84cba771af742d1b6ecfaabc2d Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 1 May 2024 23:17:58 +0900 Subject: test: define more trap kind --- src/Execution/Runtime.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Execution/Runtime.php') diff --git a/src/Execution/Runtime.php b/src/Execution/Runtime.php index 9d7c367..08600e5 100644 --- a/src/Execution/Runtime.php +++ b/src/Execution/Runtime.php @@ -1756,7 +1756,7 @@ final class Runtime $s = $this->stack->popInt(); $d = $this->stack->popInt(); if (count($tabX->elem) < $d + $n || count($tabY->elem) < $s + $n) { - throw new TrapException("table.copy: out of bounds"); + throw new TrapException("table.copy: out of bounds", trapKind: TrapKind::OutOfBoundsTableAccess); } if ($n === 0 || ($x === $y && $d === $s)) { return; @@ -1779,7 +1779,7 @@ final class Runtime $val = $this->stack->popRef(); $i = $this->stack->popInt(); if (count($tab->elem) < $i + $n) { - throw new TrapException("table.fill: out of bounds"); + throw new TrapException("table.fill: out of bounds", trapKind: TrapKind::OutOfBoundsTableAccess); } for ($k = 0; $k < $n; $k++) { // @phpstan-ignore-next-line @@ -1795,7 +1795,7 @@ final class Runtime $tab = $this->store->tables[$a]; $i = $this->stack->popInt(); if (count($tab->elem) <= $i) { - throw new TrapException("table.get: out of bounds"); + throw new TrapException("table.get: out of bounds", trapKind: TrapKind::OutOfBoundsTableAccess); } $val = $tab->elem[$i]; $this->stack->pushValue($val); @@ -1845,10 +1845,10 @@ final class Runtime $s = $this->stack->popInt(); $d = $this->stack->popInt(); if (count($elem->elem) < $s + $n) { - throw new TrapException("table.init: out of bounds"); + throw new TrapException("table.init: out of bounds", trapKind: TrapKind::OutOfBoundsTableAccess); } if (count($tab->elem) < $d + $n) { - throw new TrapException("table.init: out of bounds"); + throw new TrapException("table.init: out of bounds", trapKind: TrapKind::OutOfBoundsTableAccess); } for ($i = 0; $i < $n; $i++) { // @phpstan-ignore-next-line @@ -1865,7 +1865,7 @@ final class Runtime $val = $this->stack->popRef(); $i = $this->stack->popInt(); if (count($tab->elem) <= $i) { - throw new TrapException("table.set: out of bounds"); + throw new TrapException("table.set: out of bounds", trapKind: TrapKind::OutOfBoundsTableAccess); } // @phpstan-ignore-next-line $tab->elem[$i] = $val; -- cgit v1.2.3-70-g09d2