summaryrefslogtreecommitdiff
path: root/test/prism/snapshots/whitequark/op_asgn.txt
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2023-10-17 11:15:56 -0400
committergit <svn-admin@ruby-lang.org>2023-10-18 14:23:26 +0000
commit2a6f7cd9255b61e21cead0c761a513bde2899728 (patch)
tree7d8f270506d907f970973cdb576513e7d3b62b93 /test/prism/snapshots/whitequark/op_asgn.txt
parentef3f9f1a685effb51543d1f08831692fa68863a2 (diff)
[ruby/prism] Index{Operator,And,Or}WriteNode
Right now, our Call{Operator,And,Or}WriteNode nodes represent two different concepts: ```ruby foo.bar += 1 foo[bar] += 1 ``` These two statements are different in what they can support. The former can never have arguments (or an opening_loc or closing_loc). The former can also never have a block. Also, the former is a variable method name. The latter is always going to be []/[]=, it can have any number of arguments including blocks (`foo[&bar] ||= 1`), and will always have an opening_loc and closing_loc. Furthermore, these statements end of having to take different paths through the various compilers because with the latter you have to consider the arguments and the block, whereas the former can perform some additional peephole optimizations since there are fewer values on the stack. For these reasons, I'm introducing Index{Operator,And,Or}WriteNode. These nodes never have a read_name or write_name on them because they are always []/[]=. They also support blocks, which the previous write nodes didn't. As a benefit of introducing these nodes, I've removed the opening_loc, closing_loc, and arguments from the older write nodes because they will always be null. For the serialized format, both of these nodes end up being smaller, and for in-memory we're storing fewer things in general, so we have savings all around. I don't love that we are introducing another node that is a call node since we generally want consumers to only have to handle a single call, but these nodes are so specific that they would have to be handled separately anyway since in fact call 2 methods. https://github.com/ruby/prism/commit/70155db9cd
Diffstat (limited to 'test/prism/snapshots/whitequark/op_asgn.txt')
-rw-r--r--test/prism/snapshots/whitequark/op_asgn.txt9
1 files changed, 0 insertions, 9 deletions
diff --git a/test/prism/snapshots/whitequark/op_asgn.txt b/test/prism/snapshots/whitequark/op_asgn.txt
index 69672acac5..bd49593a0b 100644
--- a/test/prism/snapshots/whitequark/op_asgn.txt
+++ b/test/prism/snapshots/whitequark/op_asgn.txt
@@ -17,9 +17,6 @@
│ │ └── name: :foo
│ ├── call_operator_loc: (1,3)-(1,4) = "."
│ ├── message_loc: (1,4)-(1,5) = "A"
- │ ├── opening_loc: ∅
- │ ├── arguments: ∅
- │ ├── closing_loc: ∅
│ ├── flags: ∅
│ ├── read_name: :A
│ ├── write_name: :A=
@@ -42,9 +39,6 @@
│ │ └── name: :foo
│ ├── call_operator_loc: (3,3)-(3,4) = "."
│ ├── message_loc: (3,4)-(3,5) = "a"
- │ ├── opening_loc: ∅
- │ ├── arguments: ∅
- │ ├── closing_loc: ∅
│ ├── flags: ∅
│ ├── read_name: :a
│ ├── write_name: :a=
@@ -67,9 +61,6 @@
│ └── name: :foo
├── call_operator_loc: (5,3)-(5,5) = "::"
├── message_loc: (5,5)-(5,6) = "a"
- ├── opening_loc: ∅
- ├── arguments: ∅
- ├── closing_loc: ∅
├── flags: ∅
├── read_name: :a
├── write_name: :a=