summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorydah <t.yudai92@gmail.com>2024-11-28 23:33:57 +0900
committergit <svn-admin@ruby-lang.org>2024-12-02 18:34:49 +0000
commitefb3f84ce89aed6ed8c52117007796fc4bd01c06 (patch)
tree72cd6c811344f5af2b68efdc017242e736acc33b
parent02fa822ebce7b197fcadbb4b2d66df7a1166fe8b (diff)
[ruby/prism] Add document BlockNode fields
Partially fixes: https://github.com/ruby/prism/issues/2123 https://github.com/ruby/prism/commit/9c0ef71449
-rw-r--r--prism/config.yml29
1 files changed, 29 insertions, 0 deletions
diff --git a/prism/config.yml b/prism/config.yml
index 03c6fbb745..70c68e5739 100644
--- a/prism/config.yml
+++ b/prism/config.yml
@@ -1132,21 +1132,50 @@ nodes:
fields:
- name: locals
type: constant[]
+ comment: |
+ The local variables declared in the block.
+
+ [1, 2, 3].each { |i| puts x } # locals: [:i]
+ ^
- name: parameters
type: node?
kind:
- BlockParametersNode
- NumberedParametersNode
- ItParametersNode
+ comment: |
+ The parameters of the block.
+
+ [1, 2, 3].each { |i| puts x }
+ ^^^
+ [1, 2, 3].each { puts _1 }
+ ^^^^^^^^^^^
+ [1, 2, 3].each { puts it }
+ ^^^^^^^^^^^
- name: body
type: node?
kind:
- StatementsNode
- BeginNode
+ comment: |
+ The body of the block.
+
+ [1, 2, 3].each { |i| puts x }
+ ^^^^^^
- name: opening_loc
type: location
+ comment: |
+ Represents the location of the opening `|`.
+
+ [1, 2, 3].each { |i| puts x }
+ ^
- name: closing_loc
type: location
+ comment: |
+ Represents the location of the closing `|`.
+
+ [1, 2, 3].each { |i| puts x }
+ ^
comment: |
Represents a block of ruby code.