aboutsummaryrefslogtreecommitdiffstats
path: root/test/yarp/snapshots
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2023-09-14 09:01:20 -0400
committergit <svn-admin@ruby-lang.org>2023-09-14 19:10:58 +0000
commit0a8f3670d1c1aa4ec58a08642cccf5ee5dbf95ae (patch)
treee3e8844905f5e3e9b46d55fb83fdc00830186ba8 /test/yarp/snapshots
parent9d2549ac311f98288bd42c4a8054cba46ca8ce32 (diff)
downloadruby-0a8f3670d1c1aa4ec58a08642cccf5ee5dbf95ae.tar.gz
[ruby/yarp] Introduce MatchWriteNode
This rarely used node holds information about the local variables that need to get written in the case a regular expression is used on the left-hand side of a =~ operator and it has named capture groups. Note that we already "handled" these nodes by adding locals to the AST, but we didn't actually expose this information, making it difficult to compile. The general idea behind this node is that it maintains the ability for consumers to find all of the call nodes in the tree easily so it's not flattening down. However, it should be okay because you hopefully don't need any information in the call node to determine what to compile because the locals list is on the top level. https://github.com/ruby/yarp/commit/e136e7f9a8
Diffstat (limited to 'test/yarp/snapshots')
-rw-r--r--test/yarp/snapshots/regex.txt59
-rw-r--r--test/yarp/snapshots/whitequark/lvar_injecting_match.txt51
2 files changed, 58 insertions, 52 deletions
diff --git a/test/yarp/snapshots/regex.txt b/test/yarp/snapshots/regex.txt
index f474669ee0..6f0d42ce3f 100644
--- a/test/yarp/snapshots/regex.txt
+++ b/test/yarp/snapshots/regex.txt
@@ -84,34 +84,37 @@
│ └── flags: ∅
├── @ ArrayNode (location: (59...86))
│ ├── elements: (length: 2)
- │ │ ├── @ CallNode (location: (60...80))
- │ │ │ ├── receiver:
- │ │ │ │ @ RegularExpressionNode (location: (60...73))
- │ │ │ │ ├── opening_loc: (60...61) = "/"
- │ │ │ │ ├── content_loc: (61...72) = "(?<foo>bar)"
- │ │ │ │ ├── closing_loc: (72...73) = "/"
- │ │ │ │ ├── unescaped: "(?<foo>bar)"
- │ │ │ │ └── flags: ∅
- │ │ │ ├── call_operator_loc: ∅
- │ │ │ ├── message_loc: (74...76) = "=~"
- │ │ │ ├── opening_loc: ∅
- │ │ │ ├── arguments:
- │ │ │ │ @ ArgumentsNode (location: (77...80))
- │ │ │ │ └── arguments: (length: 1)
- │ │ │ │ └── @ CallNode (location: (77...80))
- │ │ │ │ ├── receiver: ∅
- │ │ │ │ ├── call_operator_loc: ∅
- │ │ │ │ ├── message_loc: (77...80) = "baz"
- │ │ │ │ ├── opening_loc: ∅
- │ │ │ │ ├── arguments: ∅
- │ │ │ │ ├── closing_loc: ∅
- │ │ │ │ ├── block: ∅
- │ │ │ │ ├── flags: variable_call
- │ │ │ │ └── name: "baz"
- │ │ │ ├── closing_loc: ∅
- │ │ │ ├── block: ∅
- │ │ │ ├── flags: ∅
- │ │ │ └── name: "=~"
+ │ │ ├── @ MatchWriteNode (location: (60...80))
+ │ │ │ ├── call:
+ │ │ │ │ @ CallNode (location: (60...80))
+ │ │ │ │ ├── receiver:
+ │ │ │ │ │ @ RegularExpressionNode (location: (60...73))
+ │ │ │ │ │ ├── opening_loc: (60...61) = "/"
+ │ │ │ │ │ ├── content_loc: (61...72) = "(?<foo>bar)"
+ │ │ │ │ │ ├── closing_loc: (72...73) = "/"
+ │ │ │ │ │ ├── unescaped: "(?<foo>bar)"
+ │ │ │ │ │ └── flags: ∅
+ │ │ │ │ ├── call_operator_loc: ∅
+ │ │ │ │ ├── message_loc: (74...76) = "=~"
+ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ ├── arguments:
+ │ │ │ │ │ @ ArgumentsNode (location: (77...80))
+ │ │ │ │ │ └── arguments: (length: 1)
+ │ │ │ │ │ └── @ CallNode (location: (77...80))
+ │ │ │ │ │ ├── receiver: ∅
+ │ │ │ │ │ ├── call_operator_loc: ∅
+ │ │ │ │ │ ├── message_loc: (77...80) = "baz"
+ │ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ │ ├── arguments: ∅
+ │ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ │ ├── block: ∅
+ │ │ │ │ │ ├── flags: variable_call
+ │ │ │ │ │ └── name: "baz"
+ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ ├── block: ∅
+ │ │ │ │ ├── flags: ∅
+ │ │ │ │ └── name: "=~"
+ │ │ │ └── locals: [:foo]
│ │ └── @ LocalVariableReadNode (location: (82...85))
│ │ ├── name: :foo
│ │ └── depth: 0
diff --git a/test/yarp/snapshots/whitequark/lvar_injecting_match.txt b/test/yarp/snapshots/whitequark/lvar_injecting_match.txt
index 2375854350..e570bf18a8 100644
--- a/test/yarp/snapshots/whitequark/lvar_injecting_match.txt
+++ b/test/yarp/snapshots/whitequark/lvar_injecting_match.txt
@@ -3,30 +3,33 @@
└── statements:
@ StatementsNode (location: (0...31))
└── body: (length: 2)
- ├── @ CallNode (location: (0...24))
- │ ├── receiver:
- │ │ @ RegularExpressionNode (location: (0...15))
- │ │ ├── opening_loc: (0...1) = "/"
- │ │ ├── content_loc: (1...14) = "(?<match>bar)"
- │ │ ├── closing_loc: (14...15) = "/"
- │ │ ├── unescaped: "(?<match>bar)"
- │ │ └── flags: ∅
- │ ├── call_operator_loc: ∅
- │ ├── message_loc: (16...18) = "=~"
- │ ├── opening_loc: ∅
- │ ├── arguments:
- │ │ @ ArgumentsNode (location: (19...24))
- │ │ └── arguments: (length: 1)
- │ │ └── @ StringNode (location: (19...24))
- │ │ ├── flags: ∅
- │ │ ├── opening_loc: (19...20) = "'"
- │ │ ├── content_loc: (20...23) = "bar"
- │ │ ├── closing_loc: (23...24) = "'"
- │ │ └── unescaped: "bar"
- │ ├── closing_loc: ∅
- │ ├── block: ∅
- │ ├── flags: ∅
- │ └── name: "=~"
+ ├── @ MatchWriteNode (location: (0...24))
+ │ ├── call:
+ │ │ @ CallNode (location: (0...24))
+ │ │ ├── receiver:
+ │ │ │ @ RegularExpressionNode (location: (0...15))
+ │ │ │ ├── opening_loc: (0...1) = "/"
+ │ │ │ ├── content_loc: (1...14) = "(?<match>bar)"
+ │ │ │ ├── closing_loc: (14...15) = "/"
+ │ │ │ ├── unescaped: "(?<match>bar)"
+ │ │ │ └── flags: ∅
+ │ │ ├── call_operator_loc: ∅
+ │ │ ├── message_loc: (16...18) = "=~"
+ │ │ ├── opening_loc: ∅
+ │ │ ├── arguments:
+ │ │ │ @ ArgumentsNode (location: (19...24))
+ │ │ │ └── arguments: (length: 1)
+ │ │ │ └── @ StringNode (location: (19...24))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: (19...20) = "'"
+ │ │ │ ├── content_loc: (20...23) = "bar"
+ │ │ │ ├── closing_loc: (23...24) = "'"
+ │ │ │ └── unescaped: "bar"
+ │ │ ├── closing_loc: ∅
+ │ │ ├── block: ∅
+ │ │ ├── flags: ∅
+ │ │ └── name: "=~"
+ │ └── locals: [:match]
└── @ LocalVariableReadNode (location: (26...31))
├── name: :match
└── depth: 0