summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorchromatic <chromatic@wgz.org>2022-10-27 11:24:58 +0200
committerYves Orton <demerphq@gmail.com>2022-11-01 09:46:16 +0100
commit1102a6f006f2bb626d2c7f1c5b7d360c28518129 (patch)
treeeb90ea178d14524d853018b788c2c0bc02021d22 /op.c
parent73d66f354cd4df0324b11e46af48f66bd5c1dd15 (diff)
downloadperl-1102a6f006f2bb626d2c7f1c5b7d360c28518129.tar.gz
Enable `use feature 'module_true'`
Per RFC 18, whenever `use feature 'module_true';` is enabled in a scope, any file required with `require` has an implicit return value of true and will not trigger the "did not return a true value" error condition. This includes logic to use the OPf_SPECIAL flag for OP_RETURN listops to indicate that the module_true feature is in effect when it executes. This flag plays no role unless the OP_RETURN tail calls the pp_leaveeval logic, so it doesn't affect normal sub returns.
Diffstat (limited to 'op.c')
-rw-r--r--op.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/op.c b/op.c
index 481158db3f..8849369944 100644
--- a/op.c
+++ b/op.c
@@ -5225,6 +5225,10 @@ OP *
Perl_op_convert_list(pTHX_ I32 type, I32 flags, OP *o)
{
if (type < 0) type = -type, flags |= OPf_SPECIAL;
+ if (type == OP_RETURN) {
+ if (FEATURE_MODULE_TRUE_IS_ENABLED)
+ flags |= OPf_SPECIAL;
+ }
if (!o || o->op_type != OP_LIST)
o = force_list(o, FALSE);
else