summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthew healy <matthew-healy@users.noreply.github.com>2024-03-11 20:46:25 +0100
committergit <svn-admin@ruby-lang.org>2024-03-11 19:46:29 +0000
commit132df4d1d48d91ad35a358e4085fa00f4092f8f5 (patch)
treed783472e2205fa3b933657f519260f3cbe30d5ee
parente407e3f497eaefb15311833c274b83ded5d17e21 (diff)
[ruby/prism] Document `InstanceVariableWriteNode` fields
(https://github.com/ruby/prism/pull/2161) * Document InstanceVariableWriteNode fields * Reference lexing docs in name field documentation * Update config.yml --------- https://github.com/ruby/prism/commit/015b3a857e Co-authored-by: Kevin Newton <kddnewton@gmail.com>
-rw-r--r--prism/config.yml25
1 files changed, 25 insertions, 0 deletions
diff --git a/prism/config.yml b/prism/config.yml
index d6698ab1b7..7729aff050 100644
--- a/prism/config.yml
+++ b/prism/config.yml
@@ -2143,12 +2143,37 @@ nodes:
fields:
- name: name
type: constant
+ comment: |
+ The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
+
+ @x = :y # name `:@x`
+
+ @_foo = "bar" # name `@_foo`
- name: name_loc
type: location
+ comment: |
+ The location of the variable name.
+
+ @_x = 1
+ ^^^
- name: value
type: node
+ comment: |
+ The value to assign to the instance variable. Can be any node that
+ represents a non-void expression.
+
+ @foo = :bar
+ ^^^^
+
+ @_x = 1234
+ ^^^^
- name: operator_loc
type: location
+ comment: |
+ The location of the `=` operator.
+
+ @x = y
+ ^
comment: |
Represents writing to an instance variable.