mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
vm: add OP_MATCHERR instruction for pattern matching errors
Replace 4-instruction sequence (GETCONST + STRING + SEND + RAISEIF) with single OP_MATCHERR instruction that raises NoMatchingPatternError with "pattern not matched" message. Bump RITE binary format version from 0300 to 0400 due to opcode number shift. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -572,6 +572,9 @@ codedump(mrb_state *mrb, const mrb_irep *irep, FILE *out)
|
||||
fprintf(out, "RAISEIF\tR%d\t", a);
|
||||
print_lv_a(mrb, irep, a, out);
|
||||
break;
|
||||
CASE(OP_MATCHERR, Z):
|
||||
fprintf(out, "MATCHERR\n");
|
||||
break;
|
||||
|
||||
CASE(OP_DEBUG, BBB):
|
||||
fprintf(out, "DEBUG\t\t%d\t%d\t%d\n", a, b, c);
|
||||
|
||||
Reference in New Issue
Block a user