From b7d37e274a58cc3afa06d421627d11e226329cec Mon Sep 17 00:00:00 2001 From: Matthew Healy Date: Mon, 8 Jan 2024 21:51:21 +0100 Subject: [PATCH] [ruby/prism] Document LocalVariableReadNode fields https://github.com/ruby/prism/commit/5e9afd3729 --- prism/config.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/prism/config.yml b/prism/config.yml index f26494f70f..70de2d9477 100644 --- a/prism/config.yml +++ b/prism/config.yml @@ -2085,8 +2085,33 @@ nodes: fields: - name: name type: constant + comment: | + The name of the local variable. Local variable names begin with an + underscore or a lower-case letter, followed by arbitrarily many + underscores, alphanumeric or non-ASCII characters. The exact + definitions of "lower-case", "alphabetical" and "alphanumeric" are + encoding-dependent. + + x # name `:x` + + _Test # name `:_Test` + + 🌯 # name `:🌯` - name: depth type: uint32 + comment: | + The number of visible scopes searched up to find the declaration of + this local variable. + + foo = 1; foo # depth 0 + + bar = 2; tap { bar } # depth 1 + + The specific rules for calculating the depth may differ from + individual Ruby implementations, as they are not specified by the + language. + + For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md). comment: | Represents reading a local variable. Note that this requires that a local variable of the same name has already been written to in the same scope,