summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorydah <[email protected]>2024-11-11 23:22:36 +0900
committerYudai Takada <[email protected]>2025-01-21 20:25:38 +0900
commit3260b0b6471ae0d7c31c1047550d8cc8afbfe63c (patch)
treecba248fd223b9c84bc15d8545d8e9f78c7a90105
parent5d6f76cf6eea68749a761cf40c731f78fb17c2d9 (diff)
Remove unnecessary assignments to local variables in `strings`
Local variables are not reassigned and are not needed.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12054
-rw-r--r--parse.y11
1 files changed, 4 insertions, 7 deletions
diff --git a/parse.y b/parse.y
index c98db458d3..304fa89e76 100644
--- a/parse.y
+++ b/parse.y
@@ -5927,14 +5927,11 @@ literal : numeric
strings : string
{
- NODE *node = $1;
- if (!node) {
- node = NEW_STR(STRING_NEW0(), &@$);
+ if (!$1) {
+ $$ = NEW_STR(STRING_NEW0(), &@$);
+ } else {
+ $$ = evstr2dstr(p, $1);
}
- else {
- node = evstr2dstr(p, node);
- }
- $$ = node;
/*% ripper: $:1 %*/
}
;