GH-123044: Give the POP_TOP after a case test a location in the body, not the pattern. (GH-130627)

This commit is contained in:
Mark Shannon 2025-03-10 17:31:16 +00:00 committed by GitHub
parent 91d6db7ee0
commit be046ee6e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 52 additions and 6 deletions

View file

@ -6124,7 +6124,8 @@ codegen_match_inner(compiler *c, stmt_ty s, pattern_context *pc)
}
// Success! Pop the subject off, we're done with it:
if (i != cases - has_default - 1) {
ADDOP(c, LOC(m->pattern), POP_TOP);
/* Use the next location to give better locations for branch events */
ADDOP(c, NEXT_LOCATION, POP_TOP);
}
VISIT_SEQ(c, stmt, m->body);
ADDOP_JUMP(c, NO_LOCATION, JUMP, end);