diff options
| -rw-r--r-- | src/Execution/Runtime.php | 2 | ||||
| -rw-r--r-- | src/Execution/TrapKind.php | 1 | ||||
| -rw-r--r-- | tests/src/SpecTestsuites/SpecTestsuiteBase.php | 5 |
3 files changed, 5 insertions, 3 deletions
diff --git a/src/Execution/Runtime.php b/src/Execution/Runtime.php index 58e2169..5107c3d 100644 --- a/src/Execution/Runtime.php +++ b/src/Execution/Runtime.php @@ -2357,7 +2357,7 @@ final class Runtime } $r = $tab->elem[$i]; if ($r instanceof Refs\RefNull) { - throw new TrapException("call_indirect: ref.null"); + throw new TrapException("call_indirect: ref.null", trapKind: TrapKind::UninitializedElement); } assert($r instanceof Refs\RefFunc); $a = $r->addr; diff --git a/src/Execution/TrapKind.php b/src/Execution/TrapKind.php index b1c00ef..ac1c4dd 100644 --- a/src/Execution/TrapKind.php +++ b/src/Execution/TrapKind.php @@ -9,4 +9,5 @@ enum TrapKind case Unknown; case OutOfBoundsMemoryAccess; case OutOfBoundsTableAccess; + case UninitializedElement; } diff --git a/tests/src/SpecTestsuites/SpecTestsuiteBase.php b/tests/src/SpecTestsuites/SpecTestsuiteBase.php index f2b0206..d6cd85e 100644 --- a/tests/src/SpecTestsuites/SpecTestsuiteBase.php +++ b/tests/src/SpecTestsuites/SpecTestsuiteBase.php @@ -252,10 +252,11 @@ abstract class SpecTestsuiteBase extends TestCase TrapKind::Unknown => 'unknown', TrapKind::OutOfBoundsMemoryAccess => 'out of bounds memory access', TrapKind::OutOfBoundsTableAccess => 'out of bounds table access', + TrapKind::UninitializedElement => 'uninitialized element', }; - $this->assertSame( - $expectedErrorMessage, + $this->assertStringContainsString( $actualErrorMessage, + $expectedErrorMessage, 'trap kind mismatch' . $message, ); } |
