diff options
| author | Justin Collins <justin@presidentbeef.com> | 2025-01-13 23:17:25 -0700 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-01-14 15:33:02 +0000 |
| commit | d0c493df7d1bb4b32ede82422b0d08f72de025b9 (patch) | |
| tree | 4c28375820f5a4f6bd452f489e42cea99759a28e | |
| parent | da93c9ae29d2575aa2eb3a3a0868b3ca7e489576 (diff) | |
[ruby/prism] Fix block parameters and it for RubyParser
https://github.com/ruby/prism/commit/7a93a307ac
| -rw-r--r-- | lib/prism/translation/ruby_parser.rb | 2 | ||||
| -rw-r--r-- | test/prism/fixtures/it.txt | 3 | ||||
| -rw-r--r-- | test/prism/snapshots/it.txt | 31 |
3 files changed, 35 insertions, 1 deletions
diff --git a/lib/prism/translation/ruby_parser.rb b/lib/prism/translation/ruby_parser.rb index 7fb533048c..8784e22d10 100644 --- a/lib/prism/translation/ruby_parser.rb +++ b/lib/prism/translation/ruby_parser.rb @@ -1559,7 +1559,7 @@ module Prism else parameters = case block.parameters - when nil, NumberedParametersNode + when nil, ItParametersNode, NumberedParametersNode 0 else visit(block.parameters) diff --git a/test/prism/fixtures/it.txt b/test/prism/fixtures/it.txt new file mode 100644 index 0000000000..76deb68028 --- /dev/null +++ b/test/prism/fixtures/it.txt @@ -0,0 +1,3 @@ +x do + it +end diff --git a/test/prism/snapshots/it.txt b/test/prism/snapshots/it.txt new file mode 100644 index 0000000000..d3d676f768 --- /dev/null +++ b/test/prism/snapshots/it.txt @@ -0,0 +1,31 @@ +@ ProgramNode (location: (1,0)-(3,3)) +├── flags: ∅ +├── locals: [] +└── statements: + @ StatementsNode (location: (1,0)-(3,3)) + ├── flags: ∅ + └── body: (length: 1) + └── @ CallNode (location: (1,0)-(3,3)) + ├── flags: newline, ignore_visibility + ├── receiver: ∅ + ├── call_operator_loc: ∅ + ├── name: :x + ├── message_loc: (1,0)-(1,1) = "x" + ├── opening_loc: ∅ + ├── arguments: ∅ + ├── closing_loc: ∅ + └── block: + @ BlockNode (location: (1,2)-(3,3)) + ├── flags: ∅ + ├── locals: [] + ├── parameters: + │ @ ItParametersNode (location: (1,2)-(3,3)) + │ └── flags: ∅ + ├── body: + │ @ StatementsNode (location: (2,2)-(2,4)) + │ ├── flags: ∅ + │ └── body: (length: 1) + │ └── @ ItLocalVariableReadNode (location: (2,2)-(2,4)) + │ └── flags: newline + ├── opening_loc: (1,2)-(1,4) = "do" + └── closing_loc: (3,0)-(3,3) = "end" |
