Skip to content

Commit 5e9afd3

Browse files
committed
Document LocalVariableReadNode fields
1 parent c3148b4 commit 5e9afd3

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

config.yml

+25
Original file line numberDiff line numberDiff line change
@@ -2085,8 +2085,33 @@ nodes:
20852085
fields:
20862086
- name: name
20872087
type: constant
2088+
comment: |
2089+
The name of the local variable. Local variable names begin with an
2090+
underscore or a lower-case letter, followed by arbitrarily many
2091+
underscores, alphanumeric or non-ASCII characters. The exact
2092+
definitions of "lower-case", "alphabetical" and "alphanumeric" are
2093+
encoding-dependent.
2094+
2095+
x # name `:x`
2096+
2097+
_Test # name `:_Test`
2098+
2099+
🌯 # name `:🌯`
20882100
- name: depth
20892101
type: uint32
2102+
comment: |
2103+
The number of visible scopes searched up to find the declaration of
2104+
this local variable.
2105+
2106+
foo = 1; foo # depth 0
2107+
2108+
bar = 2; tap { bar } # depth 1
2109+
2110+
The specific rules for calculating the depth may differ from
2111+
individual Ruby implementations, as they are not specified by the
2112+
language.
2113+
2114+
For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md).
20902115
comment: |
20912116
Represents reading a local variable. Note that this requires that a local
20922117
variable of the same name has already been written to in the same scope,

0 commit comments

Comments
 (0)