summaryrefslogtreecommitdiff
path: root/yarp
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2023-09-06 11:22:27 -0400
committergit <svn-admin@ruby-lang.org>2023-09-07 12:42:02 +0000
commit9343ef250452c17b2842701805a4a0417165dd15 (patch)
tree8f4a701db226bfc46c2818f9454e87f911b19384 /yarp
parent3f78eec44ab2f06f05c699cbd90714716e13ebd7 (diff)
[ruby/yarp] Constants on rest parameter nodes
https://github.com/ruby/yarp/commit/a6fdb8aae9
Diffstat (limited to 'yarp')
-rw-r--r--yarp/config.yml6
-rw-r--r--yarp/yarp.c5
2 files changed, 7 insertions, 4 deletions
diff --git a/yarp/config.yml b/yarp/config.yml
index b24490a333..f62b591d4f 100644
--- a/yarp/config.yml
+++ b/yarp/config.yml
@@ -2059,10 +2059,12 @@ nodes:
`ex` is in the `exception` field.
- name: RestParameterNode
fields:
- - name: operator_loc
- type: location
+ - name: name
+ type: constant?
- name: name_loc
type: location?
+ - name: operator_loc
+ type: location
comment: |
Represents a rest parameter to a method, block, or lambda definition.
diff --git a/yarp/yarp.c b/yarp/yarp.c
index 7f9f3b5589..c7c43e14bb 100644
--- a/yarp/yarp.c
+++ b/yarp/yarp.c
@@ -3900,8 +3900,9 @@ yp_rest_parameter_node_create(yp_parser_t *parser, const yp_token_t *operator, c
.end = (name->type == YP_TOKEN_NOT_PROVIDED ? operator->end : name->end)
}
},
- .operator_loc = YP_LOCATION_TOKEN_VALUE(operator),
- .name_loc = YP_OPTIONAL_LOCATION_TOKEN_VALUE(name)
+ .name = yp_parser_optional_constant_id_token(parser, name),
+ .name_loc = YP_OPTIONAL_LOCATION_TOKEN_VALUE(name),
+ .operator_loc = YP_LOCATION_TOKEN_VALUE(operator)
};
return node;