diff options
author | Kevin Newton <kddnewton@gmail.com> | 2023-08-25 13:03:16 -0400 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-08-25 19:31:33 +0000 |
commit | 0df515c0959ec3b501132cf511a56f47d6f93682 (patch) | |
tree | 6feaa47ddb6efb22ef8e3f42c1125bfdef9509b5 /yarp | |
parent | 7898b8e1ea01f3cc670543416d4d3ca90b3917aa (diff) | |
download | ruby-0df515c0959ec3b501132cf511a56f47d6f93682.tar.gz |
[ruby/yarp] Mark local variable targets in pattern matching
https://github.com/ruby/yarp/commit/6c6700a001
Diffstat (limited to 'yarp')
-rw-r--r-- | yarp/config.yml | 20 | ||||
-rw-r--r-- | yarp/yarp.c | 15 |
2 files changed, 16 insertions, 19 deletions
diff --git a/yarp/config.yml b/yarp/config.yml index bb4d4174da..d7269f336d 100644 --- a/yarp/config.yml +++ b/yarp/config.yml @@ -908,9 +908,9 @@ nodes: type: node kind: ConstantPathNode - name: operator_loc - type: location? + type: location - name: value - type: node? + type: node comment: | Represents writing to a constant path. @@ -939,9 +939,9 @@ nodes: - name: name_loc type: location - name: value - type: node? + type: node - name: operator_loc - type: location? + type: location comment: | Represents writing to a constant. @@ -1208,9 +1208,9 @@ nodes: - name: name_loc type: location - name: operator_loc - type: location? + type: location - name: value - type: node? + type: node comment: | Represents writing to a global variable. @@ -1354,9 +1354,9 @@ nodes: - name: name_loc type: location - name: value - type: node? + type: node - name: operator_loc - type: location? + type: location comment: | Represents writing to an instance variable. @@ -1564,11 +1564,11 @@ nodes: - name: depth type: uint32 - name: value - type: node? + type: node - name: name_loc type: location - name: operator_loc - type: location? + type: location comment: | Represents writing to a local variable. diff --git a/yarp/yarp.c b/yarp/yarp.c index f8fd94997d..ad762d89a3 100644 --- a/yarp/yarp.c +++ b/yarp/yarp.c @@ -3075,21 +3075,18 @@ yp_local_variable_write_node_create(yp_parser_t *parser, yp_constant_id_t consta return node; } -// Allocate and initialize a new LocalVariableWriteNode node without an operator or target. -static yp_local_variable_write_node_t * +// Allocate and initialize a new LocalVariableTargetNode node. +static yp_local_variable_target_node_t * yp_local_variable_target_node_create(yp_parser_t *parser, const yp_token_t *name) { - yp_local_variable_write_node_t *node = YP_ALLOC_NODE(parser, yp_local_variable_write_node_t); + yp_local_variable_target_node_t *node = YP_ALLOC_NODE(parser, yp_local_variable_target_node_t); - *node = (yp_local_variable_write_node_t) { + *node = (yp_local_variable_target_node_t) { { - .type = YP_NODE_LOCAL_VARIABLE_WRITE_NODE, + .type = YP_NODE_LOCAL_VARIABLE_TARGET_NODE, .location = YP_LOCATION_TOKEN_VALUE(name) }, .constant_id = yp_parser_constant_id_token(parser, name), - .depth = 0, - .value = NULL, - .name_loc = YP_LOCATION_TOKEN_VALUE(name), - .operator_loc = { .start = NULL, .end = NULL } + .depth = 0 }; return node; |