diff options
| author | Jemma Issroff <jemmaissroff@gmail.com> | 2023-10-18 17:14:13 -0300 |
|---|---|---|
| committer | Jemma Issroff <jemmaissroff@gmail.com> | 2023-10-20 11:49:53 -0300 |
| commit | a426a230de4deb8771b0134a367f4ad28658476a (patch) | |
| tree | 130781623e61d16659f0a9bdbb82c3ffae6f60a5 | |
| parent | 8b3d044004be68acf2e71d43c51d99db3deff514 (diff) | |
[PRISM] Fixed StringConcatNode, uncommented tests
| -rw-r--r-- | prism_compile.c | 3 | ||||
| -rw-r--r-- | test/ruby/test_compile_prism.rb | 18 |
2 files changed, 12 insertions, 9 deletions
diff --git a/prism_compile.c b/prism_compile.c index 2061f9dbd1..c71ed2a8c1 100644 --- a/prism_compile.c +++ b/prism_compile.c @@ -2429,6 +2429,9 @@ pm_compile_node(rb_iseq_t *iseq, const pm_node_t *node, LINK_ANCHOR *const ret, pm_string_concat_node_t *str_concat_node = (pm_string_concat_node_t *)node; PM_COMPILE(str_concat_node->left); PM_COMPILE(str_concat_node->right); + if (!popped) { + ADD_INSN1(ret, &dummy_line_node, concatstrings, INT2FIX(2)); + } return; } case PM_STRING_NODE: { diff --git a/test/ruby/test_compile_prism.rb b/test/ruby/test_compile_prism.rb index f57d980120..52099d87a7 100644 --- a/test/ruby/test_compile_prism.rb +++ b/test/ruby/test_compile_prism.rb @@ -241,8 +241,8 @@ module Prism ############################################################################ def test_EmbeddedVariableNode - # test_prism_eval('class Prism::TestCompilePrism; @pit = 1; "#@pit"; end') - # test_prism_eval('class Prism::TestCompilePrism; @@pit = 1; "#@@pit"; end') + test_prism_eval('class Prism::TestCompilePrism; @pit = 1; "#@pit"; end') + test_prism_eval('class Prism::TestCompilePrism; @@pit = 1; "#@@pit"; end') test_prism_eval('$pit = 1; "#$pit"') end @@ -284,7 +284,7 @@ module Prism end def test_StringConcatNode - # test_prism_eval('"Prism" "::" "TestCompilePrism"') + test_prism_eval('"Prism" "::" "TestCompilePrism"') end def test_StringNode @@ -296,12 +296,12 @@ module Prism end def test_XStringNode - # test_prism_eval(<<~RUBY) - # class Prism::TestCompilePrism - # def self.`(command) = command * 2 - # `pit` - # end - # RUBY + test_prism_eval(<<~RUBY) + class Prism::TestCompilePrism + def self.`(command) = command * 2 + `pit` + end + RUBY end ############################################################################ |
