diff options
author | Kevin Newton <kddnewton@gmail.com> | 2023-09-01 09:40:08 -0400 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-09-01 22:52:14 +0000 |
commit | c666077182e3408a6b8a3e83789f60d6cee30c70 (patch) | |
tree | b19ab09b175eb5bfb241cc2825c8a3b6b2855ecc /test/yarp | |
parent | d1f83c37f890e5345e68853c5e268975d4396ffc (diff) | |
download | ruby-c666077182e3408a6b8a3e83789f60d6cee30c70.tar.gz |
[ruby/yarp] Add global variables to the constant pool
https://github.com/ruby/yarp/commit/b48067b067
Diffstat (limited to 'test/yarp')
21 files changed, 67 insertions, 50 deletions
diff --git a/test/yarp/errors_test.rb b/test/yarp/errors_test.rb index 2af3c605e4..e1c40e11cb 100644 --- a/test/yarp/errors_test.rb +++ b/test/yarp/errors_test.rb @@ -1006,8 +1006,8 @@ module YARP expected = BeginNode( Location(), StatementsNode([ - GlobalVariableWriteNode(Location(), NilNode(), Location()), - GlobalVariableWriteNode(Location(), NilNode(), Location()) + GlobalVariableWriteNode(:$+, Location(), NilNode(), Location()), + GlobalVariableWriteNode(:$1466, Location(), NilNode(), Location()) ]), nil, nil, diff --git a/test/yarp/snapshots/alias.txt b/test/yarp/snapshots/alias.txt index 639311e64a..224c2069a5 100644 --- a/test/yarp/snapshots/alias.txt +++ b/test/yarp/snapshots/alias.txt @@ -31,7 +31,7 @@ ProgramNode(0...199)( (61...66) ), AliasNode(86...97)( - GlobalVariableReadNode(92...94)(), + GlobalVariableReadNode(92...94)(:$a), BackReferenceReadNode(95...97)(), (86...91) ), @@ -41,8 +41,8 @@ ProgramNode(0...199)( (99...104) ), AliasNode(114...129)( - GlobalVariableReadNode(120...124)(), - GlobalVariableReadNode(125...129)(), + GlobalVariableReadNode(120...124)(:$foo), + GlobalVariableReadNode(125...129)(:$bar), (114...119) ), AliasNode(131...143)( diff --git a/test/yarp/snapshots/global_variables.txt b/test/yarp/snapshots/global_variables.txt index d0a9f782e0..578f02e9b8 100644 --- a/test/yarp/snapshots/global_variables.txt +++ b/test/yarp/snapshots/global_variables.txt @@ -1,30 +1,30 @@ ProgramNode(0...349)( [], StatementsNode(0...349)( - [GlobalVariableReadNode(0...16)(), - GlobalVariableReadNode(18...20)(), - GlobalVariableReadNode(22...25)(), - GlobalVariableReadNode(27...37)(), - GlobalVariableReadNode(39...45)(), - GlobalVariableReadNode(47...54)(), - GlobalVariableReadNode(56...63)(), - GlobalVariableReadNode(65...67)(), - GlobalVariableReadNode(69...71)(), - GlobalVariableReadNode(73...75)(), + [GlobalVariableReadNode(0...16)(:$global_variable), + GlobalVariableReadNode(18...20)(:$_), + GlobalVariableReadNode(22...25)(:$-w), + GlobalVariableReadNode(27...37)(:$LOAD_PATH), + GlobalVariableReadNode(39...45)(:$stdin), + GlobalVariableReadNode(47...54)(:$stdout), + GlobalVariableReadNode(56...63)(:$stderr), + GlobalVariableReadNode(65...67)(:$!), + GlobalVariableReadNode(69...71)(:$?), + GlobalVariableReadNode(73...75)(:$~), BackReferenceReadNode(77...79)(), BackReferenceReadNode(81...83)(), BackReferenceReadNode(85...87)(), BackReferenceReadNode(89...91)(), - GlobalVariableReadNode(93...95)(), - GlobalVariableReadNode(97...99)(), - GlobalVariableReadNode(101...103)(), - GlobalVariableReadNode(105...111)(), - GlobalVariableReadNode(113...122)(), - GlobalVariableReadNode(124...126)(), - GlobalVariableReadNode(128...131)(), - GlobalVariableReadNode(133...149)(), - GlobalVariableReadNode(151...159)(), - GlobalVariableReadNode(161...164)(), + GlobalVariableReadNode(93...95)(:$:), + GlobalVariableReadNode(97...99)(:$;), + GlobalVariableReadNode(101...103)(:$,), + GlobalVariableReadNode(105...111)(:$DEBUG), + GlobalVariableReadNode(113...122)(:$FILENAME), + GlobalVariableReadNode(124...126)(:$0), + GlobalVariableReadNode(128...131)(:$-0), + GlobalVariableReadNode(133...149)(:$LOADED_FEATURES), + GlobalVariableReadNode(151...159)(:$VERBOSE), + GlobalVariableReadNode(161...164)(:$-K), SymbolNode(166...183)((166...167), (167...183), nil, "$global_variable"), SymbolNode(185...188)((185...186), (186...188), nil, "$_"), SymbolNode(190...194)((190...191), (191...194), nil, "$-w"), diff --git a/test/yarp/snapshots/methods.txt b/test/yarp/snapshots/methods.txt index 79d11f1038..15042a2ce8 100644 --- a/test/yarp/snapshots/methods.txt +++ b/test/yarp/snapshots/methods.txt @@ -173,7 +173,7 @@ ProgramNode(0...1194)( ), DefNode(161...175)( (170...171), - GlobalVariableReadNode(165...169)(), + GlobalVariableReadNode(165...169)(:$var), nil, nil, [], diff --git a/test/yarp/snapshots/patterns.txt b/test/yarp/snapshots/patterns.txt index 01292cbf3c..efcae6d0d4 100644 --- a/test/yarp/snapshots/patterns.txt +++ b/test/yarp/snapshots/patterns.txt @@ -959,7 +959,7 @@ ProgramNode(0...3743)( "foo" ), PinnedVariableNode(988...993)( - GlobalVariableReadNode(989...993)(), + GlobalVariableReadNode(989...993)(:$bar), (988...989) ), (985...987) diff --git a/test/yarp/snapshots/regex.txt b/test/yarp/snapshots/regex.txt index 6ba394271a..37e32c4dd8 100644 --- a/test/yarp/snapshots/regex.txt +++ b/test/yarp/snapshots/regex.txt @@ -21,7 +21,7 @@ ProgramNode(0...293)( [StringNode(29...33)(nil, (29...33), nil, "aaa "), EmbeddedVariableNode(33...38)( (33...34), - GlobalVariableReadNode(34...38)() + GlobalVariableReadNode(34...38)(:$bbb) )], (38...39), 0 diff --git a/test/yarp/snapshots/seattlerb/alias_gvar_backref.txt b/test/yarp/snapshots/seattlerb/alias_gvar_backref.txt index c055a64925..d4890ed587 100644 --- a/test/yarp/snapshots/seattlerb/alias_gvar_backref.txt +++ b/test/yarp/snapshots/seattlerb/alias_gvar_backref.txt @@ -2,7 +2,7 @@ ProgramNode(0...15)( [], StatementsNode(0...15)( [AliasNode(0...15)( - GlobalVariableReadNode(6...12)(), + GlobalVariableReadNode(6...12)(:$MATCH), BackReferenceReadNode(13...15)(), (0...5) )] diff --git a/test/yarp/snapshots/seattlerb/bug202.txt b/test/yarp/snapshots/seattlerb/bug202.txt index cbed9a6712..08bcfd6b7d 100644 --- a/test/yarp/snapshots/seattlerb/bug202.txt +++ b/test/yarp/snapshots/seattlerb/bug202.txt @@ -1,7 +1,12 @@ ProgramNode(0...22)( [:测试], StatementsNode(0...22)( - [GlobalVariableWriteNode(0...11)((0...7), IntegerNode(10...11)(), (8...9)), + [GlobalVariableWriteNode(0...11)( + :$测试, + (0...7), + IntegerNode(10...11)(), + (8...9) + ), LocalVariableWriteNode(12...22)( :测试, 0, diff --git a/test/yarp/snapshots/seattlerb/case_in.txt b/test/yarp/snapshots/seattlerb/case_in.txt index aaee410ef3..1262e453c9 100644 --- a/test/yarp/snapshots/seattlerb/case_in.txt +++ b/test/yarp/snapshots/seattlerb/case_in.txt @@ -498,7 +498,7 @@ ProgramNode(0...747)( (628...629) ), PinnedVariableNode(633...636)( - GlobalVariableReadNode(634...636)(), + GlobalVariableReadNode(634...636)(:$b), (633...634) ), PinnedVariableNode(638...642)( diff --git a/test/yarp/snapshots/strings.txt b/test/yarp/snapshots/strings.txt index 86a732d85d..ca98151c14 100644 --- a/test/yarp/snapshots/strings.txt +++ b/test/yarp/snapshots/strings.txt @@ -177,7 +177,7 @@ ProgramNode(0...498)( (405...406), [EmbeddedVariableNode(406...411)( (406...407), - GlobalVariableReadNode(407...411)() + GlobalVariableReadNode(407...411)(:$foo) )], (411...412) ), diff --git a/test/yarp/snapshots/unparser/corpus/literal/alias.txt b/test/yarp/snapshots/unparser/corpus/literal/alias.txt index cf6c04cd2e..18e16e1dd9 100644 --- a/test/yarp/snapshots/unparser/corpus/literal/alias.txt +++ b/test/yarp/snapshots/unparser/corpus/literal/alias.txt @@ -2,8 +2,8 @@ ProgramNode(0...31)( [], StatementsNode(0...31)( [AliasNode(0...15)( - GlobalVariableReadNode(6...10)(), - GlobalVariableReadNode(11...15)(), + GlobalVariableReadNode(6...10)(:$foo), + GlobalVariableReadNode(11...15)(:$bar), (0...5) ), AliasNode(16...31)( diff --git a/test/yarp/snapshots/unparser/corpus/literal/assignment.txt b/test/yarp/snapshots/unparser/corpus/literal/assignment.txt index 7680b90f61..c08204cf16 100644 --- a/test/yarp/snapshots/unparser/corpus/literal/assignment.txt +++ b/test/yarp/snapshots/unparser/corpus/literal/assignment.txt @@ -1,10 +1,15 @@ ProgramNode(0...704)( [:a, :b, :foo, :c, :x], StatementsNode(0...704)( - [GlobalVariableWriteNode(0...6)((0...2), IntegerNode(5...6)(), (3...4)), + [GlobalVariableWriteNode(0...6)( + :$a, + (0...2), + IntegerNode(5...6)(), + (3...4) + ), MultiWriteNode(7...24)( - [GlobalVariableTargetNode(8...10)(), - GlobalVariableTargetNode(12...14)()], + [GlobalVariableTargetNode(8...10)(:$a), + GlobalVariableTargetNode(12...14)(:$b)], (16...17), ArrayNode(18...24)( [IntegerNode(19...20)(), IntegerNode(22...23)()], diff --git a/test/yarp/snapshots/unparser/corpus/literal/dstr.txt b/test/yarp/snapshots/unparser/corpus/literal/dstr.txt index 396ebcd3da..369e1491e5 100644 --- a/test/yarp/snapshots/unparser/corpus/literal/dstr.txt +++ b/test/yarp/snapshots/unparser/corpus/literal/dstr.txt @@ -66,7 +66,7 @@ ProgramNode(0...299)( [StringNode(153...154)(nil, (153...154), nil, "a"), EmbeddedVariableNode(154...157)( (154...155), - GlobalVariableReadNode(155...157)() + GlobalVariableReadNode(155...157)(:$a) )], (157...158) ), diff --git a/test/yarp/snapshots/unparser/corpus/literal/literal.txt b/test/yarp/snapshots/unparser/corpus/literal/literal.txt index 3b85d3e95f..8af9ea3c5e 100644 --- a/test/yarp/snapshots/unparser/corpus/literal/literal.txt +++ b/test/yarp/snapshots/unparser/corpus/literal/literal.txt @@ -163,7 +163,7 @@ ProgramNode(0...916)( StringNode(215...216)(nil, (215...216), nil, " "), EmbeddedVariableNode(216...219)( (216...217), - GlobalVariableReadNode(217...219)() + GlobalVariableReadNode(217...219)(:$a) )], (219...220) ), diff --git a/test/yarp/snapshots/unparser/corpus/literal/variables.txt b/test/yarp/snapshots/unparser/corpus/literal/variables.txt index fe98a8cd57..21738f74f0 100644 --- a/test/yarp/snapshots/unparser/corpus/literal/variables.txt +++ b/test/yarp/snapshots/unparser/corpus/literal/variables.txt @@ -4,7 +4,7 @@ ProgramNode(0...66)( [CallNode(0...1)(nil, nil, (0...1), nil, nil, nil, nil, 2, "a"), InstanceVariableReadNode(2...4)(:@a), ClassVariableReadNode(5...8)(:@@a), - GlobalVariableReadNode(9...11)(), + GlobalVariableReadNode(9...11)(:$a), NumberedReferenceReadNode(12...14)(1), BackReferenceReadNode(15...17)(), ConstantReadNode(18...23)(), diff --git a/test/yarp/snapshots/unparser/corpus/semantic/dstr.txt b/test/yarp/snapshots/unparser/corpus/semantic/dstr.txt index 8822eb5333..8edb0134b1 100644 --- a/test/yarp/snapshots/unparser/corpus/semantic/dstr.txt +++ b/test/yarp/snapshots/unparser/corpus/semantic/dstr.txt @@ -234,7 +234,7 @@ ProgramNode(0...608)( [StringNode(587...588)(nil, (587...588), nil, "a"), EmbeddedVariableNode(588...591)( (588...589), - GlobalVariableReadNode(589...591)() + GlobalVariableReadNode(589...591)(:$a) )], (591...592) ), diff --git a/test/yarp/snapshots/variables.txt b/test/yarp/snapshots/variables.txt index edd27690a1..11e232c1cb 100644 --- a/test/yarp/snapshots/variables.txt +++ b/test/yarp/snapshots/variables.txt @@ -27,11 +27,12 @@ ProgramNode(0...293)( (42...43) ), GlobalVariableWriteNode(50...58)( + :$abc, (50...54), IntegerNode(57...58)(), (55...56) ), - GlobalVariableReadNode(60...64)(), + GlobalVariableReadNode(60...64)(:$abc), InstanceVariableReadNode(66...70)(:@abc), InstanceVariableWriteNode(72...80)( :@abc, @@ -48,14 +49,15 @@ ProgramNode(0...293)( (89...90) ), MultiWriteNode(94...108)( - [GlobalVariableTargetNode(94...98)(), - GlobalVariableTargetNode(100...104)()], + [GlobalVariableTargetNode(94...98)(:$foo), + GlobalVariableTargetNode(100...104)(:$bar)], (105...106), IntegerNode(107...108)(), nil, nil ), GlobalVariableWriteNode(110...121)( + :$foo, (110...114), ArrayNode(117...121)( [IntegerNode(117...118)(), IntegerNode(120...121)()], diff --git a/test/yarp/snapshots/whitequark/alias_gvar.txt b/test/yarp/snapshots/whitequark/alias_gvar.txt index c615e52655..06482181f4 100644 --- a/test/yarp/snapshots/whitequark/alias_gvar.txt +++ b/test/yarp/snapshots/whitequark/alias_gvar.txt @@ -2,13 +2,13 @@ ProgramNode(0...24)( [], StatementsNode(0...24)( [AliasNode(0...11)( - GlobalVariableReadNode(6...8)(), + GlobalVariableReadNode(6...8)(:$a), BackReferenceReadNode(9...11)(), (0...5) ), AliasNode(13...24)( - GlobalVariableReadNode(19...21)(), - GlobalVariableReadNode(22...24)(), + GlobalVariableReadNode(19...21)(:$a), + GlobalVariableReadNode(22...24)(:$b), (13...18) )] ) diff --git a/test/yarp/snapshots/whitequark/gvar.txt b/test/yarp/snapshots/whitequark/gvar.txt index 2ac61ed4f4..dbc16e65d8 100644 --- a/test/yarp/snapshots/whitequark/gvar.txt +++ b/test/yarp/snapshots/whitequark/gvar.txt @@ -1,4 +1,4 @@ ProgramNode(0...4)( [], - StatementsNode(0...4)([GlobalVariableReadNode(0...4)()]) + StatementsNode(0...4)([GlobalVariableReadNode(0...4)(:$foo)]) ) diff --git a/test/yarp/snapshots/whitequark/gvasgn.txt b/test/yarp/snapshots/whitequark/gvasgn.txt index c4030831e3..b416ac55ab 100644 --- a/test/yarp/snapshots/whitequark/gvasgn.txt +++ b/test/yarp/snapshots/whitequark/gvasgn.txt @@ -1,6 +1,11 @@ ProgramNode(0...9)( [], StatementsNode(0...9)( - [GlobalVariableWriteNode(0...9)((0...4), IntegerNode(7...9)(), (5...6))] + [GlobalVariableWriteNode(0...9)( + :$var, + (0...4), + IntegerNode(7...9)(), + (5...6) + )] ) ) diff --git a/test/yarp/snapshots/whitequark/string_dvar.txt b/test/yarp/snapshots/whitequark/string_dvar.txt index 12f083660b..66cd00b5cb 100644 --- a/test/yarp/snapshots/whitequark/string_dvar.txt +++ b/test/yarp/snapshots/whitequark/string_dvar.txt @@ -15,7 +15,7 @@ ProgramNode(0...14)( StringNode(9...10)(nil, (9...10), nil, " "), EmbeddedVariableNode(10...13)( (10...11), - GlobalVariableReadNode(11...13)() + GlobalVariableReadNode(11...13)(:$a) )], (13...14) )] |