diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2024-05-08 14:56:07 -0400 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-05-08 18:56:14 +0000 |
| commit | 442e398e62d32d042884f0cad76b5294d3110bfe (patch) | |
| tree | b97564818e364fafdd332df4f5612fb63e7b7c6c | |
| parent | 128c9a92dde2ad1319a2f5afc2e35b1b23841fd9 (diff) | |
[ruby/prism] Ensure keyword parameters are not constants
https://github.com/ruby/prism/commit/fd210115c1
| -rw-r--r-- | prism/prism.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/prism/prism.c b/prism/prism.c index 09f25fa8a9..f24f122420 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -14326,7 +14326,9 @@ parse_parameters( pm_token_t local = name; local.end -= 1; - if (local.end[-1] == '!' || local.end[-1] == '?') { + if (parser->encoding_changed ? parser->encoding->isupper_char(local.start, local.end - local.start) : pm_encoding_utf_8_isupper_char(local.start, local.end - local.start)) { + pm_parser_err(parser, local.start, local.end, PM_ERR_ARGUMENT_FORMAL_CONSTANT); + } else if (local.end[-1] == '!' || local.end[-1] == '?') { PM_PARSER_ERR_TOKEN_FORMAT_CONTENT(parser, local, PM_ERR_INVALID_LOCAL_VARIABLE_WRITE); } |
