From 132df4d1d48d91ad35a358e4085fa00f4092f8f5 Mon Sep 17 00:00:00 2001 From: matthew healy Date: Mon, 11 Mar 2024 20:46:25 +0100 Subject: [PATCH] [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 --- prism/config.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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.