summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatt Valentine-House <matt@eightbitraptor.com>2023-10-05 20:41:41 +0100
committergit <svn-admin@ruby-lang.org>2023-10-06 12:21:03 +0000
commit7db4ce13ed051bc422c5db594bb41edbaeb1ae35 (patch)
treebeeea6a29e4a88fd696ef1ea106df57c872ce680 /test
parent723318f5d7a6475f69fc0d095a4149547b6050a3 (diff)
[ruby/prism] Introduce transparent scopes.
A transparent scope is a scope that cannot have local variables added to it's local table. When a local is added to it's table, it instead gets added to the first non-transparent parent scope. This is used in for loops to ensure the correct depth for local variables inside the body https://github.com/ruby/prism/commit/ddb8e82253 Co-Authored-By: Kevin Newton <kddnewton@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/prism/snapshots/for.txt12
-rw-r--r--test/prism/snapshots/whitequark/for.txt4
-rw-r--r--test/prism/snapshots/whitequark/for_mlhs.txt4
3 files changed, 10 insertions, 10 deletions
diff --git a/test/prism/snapshots/for.txt b/test/prism/snapshots/for.txt
index a0485a57ff..cfcf3e4d36 100644
--- a/test/prism/snapshots/for.txt
+++ b/test/prism/snapshots/for.txt
@@ -23,7 +23,7 @@
│ │ └── body: (length: 1)
│ │ └── @ LocalVariableReadNode (location: (2,0)-(2,1))
│ │ ├── name: :i
- │ │ └── depth: 0
+ │ │ └── depth: 1
│ ├── for_keyword_loc: (1,0)-(1,3) = "for"
│ ├── in_keyword_loc: (1,6)-(1,8) = "in"
│ ├── do_keyword_loc: ∅
@@ -48,7 +48,7 @@
│ │ └── body: (length: 1)
│ │ └── @ LocalVariableReadNode (location: (5,16)-(5,17))
│ │ ├── name: :i
- │ │ └── depth: 0
+ │ │ └── depth: 1
│ ├── for_keyword_loc: (5,0)-(5,3) = "for"
│ ├── in_keyword_loc: (5,6)-(5,8) = "in"
│ ├── do_keyword_loc: ∅
@@ -80,7 +80,7 @@
│ │ └── body: (length: 1)
│ │ └── @ LocalVariableReadNode (location: (8,0)-(8,1))
│ │ ├── name: :i
- │ │ └── depth: 0
+ │ │ └── depth: 1
│ ├── for_keyword_loc: (7,0)-(7,3) = "for"
│ ├── in_keyword_loc: (7,8)-(7,10) = "in"
│ ├── do_keyword_loc: ∅
@@ -115,7 +115,7 @@
│ │ └── body: (length: 1)
│ │ └── @ LocalVariableReadNode (location: (12,0)-(12,1))
│ │ ├── name: :i
- │ │ └── depth: 0
+ │ │ └── depth: 1
│ ├── for_keyword_loc: (11,0)-(11,3) = "for"
│ ├── in_keyword_loc: (11,10)-(11,12) = "in"
│ ├── do_keyword_loc: ∅
@@ -140,7 +140,7 @@
│ │ └── body: (length: 1)
│ │ └── @ LocalVariableReadNode (location: (16,0)-(16,1))
│ │ ├── name: :i
- │ │ └── depth: 0
+ │ │ └── depth: 1
│ ├── for_keyword_loc: (15,0)-(15,3) = "for"
│ ├── in_keyword_loc: (15,6)-(15,8) = "in"
│ ├── do_keyword_loc: (15,15)-(15,17) = "do"
@@ -165,7 +165,7 @@
│ └── body: (length: 1)
│ └── @ LocalVariableReadNode (location: (19,16)-(19,17))
│ ├── name: :i
- │ └── depth: 0
+ │ └── depth: 1
├── for_keyword_loc: (19,0)-(19,3) = "for"
├── in_keyword_loc: (19,6)-(19,8) = "in"
├── do_keyword_loc: ∅
diff --git a/test/prism/snapshots/whitequark/for.txt b/test/prism/snapshots/whitequark/for.txt
index d4d4dc1602..1006da9272 100644
--- a/test/prism/snapshots/whitequark/for.txt
+++ b/test/prism/snapshots/whitequark/for.txt
@@ -32,7 +32,7 @@
│ │ │ └── arguments: (length: 1)
│ │ │ └── @ LocalVariableReadNode (location: (1,18)-(1,19))
│ │ │ ├── name: :a
- │ │ │ └── depth: 0
+ │ │ │ └── depth: 1
│ │ ├── closing_loc: ∅
│ │ ├── block: ∅
│ │ ├── flags: ∅
@@ -70,7 +70,7 @@
│ │ └── arguments: (length: 1)
│ │ └── @ LocalVariableReadNode (location: (3,16)-(3,17))
│ │ ├── name: :a
- │ │ └── depth: 0
+ │ │ └── depth: 1
│ ├── closing_loc: ∅
│ ├── block: ∅
│ ├── flags: ∅
diff --git a/test/prism/snapshots/whitequark/for_mlhs.txt b/test/prism/snapshots/whitequark/for_mlhs.txt
index ef15199a80..93b0eb3297 100644
--- a/test/prism/snapshots/whitequark/for_mlhs.txt
+++ b/test/prism/snapshots/whitequark/for_mlhs.txt
@@ -39,10 +39,10 @@
│ │ └── arguments: (length: 2)
│ │ ├── @ LocalVariableReadNode (location: (1,19)-(1,20))
│ │ │ ├── name: :a
- │ │ │ └── depth: 0
+ │ │ │ └── depth: 1
│ │ └── @ LocalVariableReadNode (location: (1,22)-(1,23))
│ │ ├── name: :b
- │ │ └── depth: 0
+ │ │ └── depth: 1
│ ├── closing_loc: ∅
│ ├── block: ∅
│ ├── flags: ∅