[ruby/prism] Document ClassVariableWriteNode
fields
(https://github.com/ruby/prism/pull/2162) * Make ClassVariableWriteNode operator_loc non-nullable * Document ClassVariableWriteNode fields * Update config.yml --------- https://github.com/ruby/prism/commit/659b133888 Co-authored-by: Kevin Newton <kddnewton@gmail.com>
This commit is contained in:
parent
a6dac9bb4f
commit
e407e3f497
@ -1302,12 +1302,37 @@ nodes:
|
||||
fields:
|
||||
- name: name
|
||||
type: constant
|
||||
comment: |
|
||||
The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
||||
|
||||
@@abc = 123 # name `@@abc`
|
||||
|
||||
@@_test = :test # name `@@_test`
|
||||
- name: name_loc
|
||||
type: location
|
||||
comment: |
|
||||
The location of the variable name.
|
||||
|
||||
@@foo = :bar
|
||||
^^^^^
|
||||
- name: value
|
||||
type: node
|
||||
comment: |
|
||||
The value to assign to the class variable. Can be any node that
|
||||
represents a non-void expression.
|
||||
|
||||
@@foo = :bar
|
||||
^^^^
|
||||
|
||||
@@_xyz = 123
|
||||
^^^
|
||||
- name: operator_loc
|
||||
type: location?
|
||||
type: location
|
||||
comment: |
|
||||
The location of the `=` operator.
|
||||
|
||||
@@foo = :bar
|
||||
^
|
||||
comment: |
|
||||
Represents writing to a class variable.
|
||||
|
||||
|
@ -2691,7 +2691,7 @@ pm_class_variable_write_node_create(pm_parser_t *parser, pm_class_variable_read_
|
||||
},
|
||||
.name = read_node->name,
|
||||
.name_loc = PM_LOCATION_NODE_VALUE((pm_node_t *) read_node),
|
||||
.operator_loc = PM_OPTIONAL_LOCATION_TOKEN_VALUE(operator),
|
||||
.operator_loc = PM_LOCATION_TOKEN_VALUE(operator),
|
||||
.value = value
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user