summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-05-08 12:38:42 -0400
committergit <svn-admin@ruby-lang.org>2024-05-08 16:52:07 +0000
commit61829eec657e8271f05a74f2067b4203ba0a51a2 (patch)
treea6929d29c250a8c85e56491e07372e97c87162db
parent84ba35e8c2b7f089ac9cbc601a8fe68432023c44 (diff)
[ruby/prism] Ensure keyword parameters do not end in ! or ?
https://github.com/ruby/prism/commit/57d86a8545
-rw-r--r--prism/prism.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/prism/prism.c b/prism/prism.c
index 97fa30e4bd..6ae32825eb 100644
--- a/prism/prism.c
+++ b/prism/prism.c
@@ -14326,6 +14326,10 @@ parse_parameters(
pm_token_t local = name;
local.end -= 1;
+ if (local.end[-1] == '!' || local.end[-1] == '?') {
+ PM_PARSER_ERR_TOKEN_FORMAT_CONTENT(parser, local, PM_ERR_INVALID_LOCAL_VARIABLE_WRITE);
+ }
+
bool repeated = pm_parser_parameter_name_check(parser, &local);
pm_parser_local_add_token(parser, &local, 1);