summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-05-24 10:02:35 +0200
committerJean Boussier <[email protected]>2025-06-02 13:41:28 +0200
commitff222ac27afe712ef6ec2bb74c81cdde1a1fa176 (patch)
tree0b9b4579d53e86ca4d8031d77d8a638dda817d66 /compile.c
parent9a292528305e88fc05c054afcfe25fc23e5c9b80 (diff)
compile.c: Handle anonymous variables in `outer_variable_cmp`
[Bug #21370]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13436
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index 7eb953203c..3ab4aa81c6 100644
--- a/compile.c
+++ b/compile.c
@@ -13378,6 +13378,13 @@ outer_variable_cmp(const void *a, const void *b, void *arg)
{
const struct outer_variable_pair *ap = (const struct outer_variable_pair *)a;
const struct outer_variable_pair *bp = (const struct outer_variable_pair *)b;
+
+ if (!ap->name) {
+ return -1;
+ } else if (!bp->name) {
+ return 1;
+ }
+
return rb_str_cmp(ap->name, bp->name);
}