sexp_processor 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/History.txt CHANGED
@@ -1,3 +1,18 @@
1
+ === 3.2.0 / 2012-04-15
2
+
3
+ * 5 minor enhancements:
4
+
5
+ * Added a ton of block arg tests.
6
+ * Added add19_edgecases to help refactor a bunch of tests that all have the same output.
7
+ * Added better debugging output for rewrites.
8
+ * Cleaned and added a bunch of stabby proc tests.
9
+ * Moved RawParseTree test data to ParseTree project.
10
+
11
+ * 2 bug fixes:
12
+
13
+ * Fixed a bunch of entries for r2r changes against edgecase parse/lex tests
14
+ * Fixes for R2R
15
+
1
16
  === 3.1.0 / 2012-02-29
2
17
 
3
18
  * 4 minor enhancements:
data/lib/pt_testcase.rb CHANGED
@@ -212,37 +212,29 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
212
212
  ############################################################
213
213
  # Shared TestCases:
214
214
 
215
- @@testcase_order = %w(Ruby RawParseTree ParseTree)
215
+ @@testcase_order = %w(Ruby ParseTree)
216
216
 
217
217
  @@testcases = Hash.new { |h,k| h[k] = {} }
218
218
 
219
219
  add_tests("alias",
220
220
  "Ruby" => "class X\n alias :y :x\nend",
221
- "RawParseTree" => [:class, :X, nil,
222
- [:scope, [:alias, [:lit, :y], [:lit, :x]]]],
223
221
  "ParseTree" => s(:class, :X, nil,
224
222
  s(:scope, s(:alias, s(:lit, :y), s(:lit, :x)))))
225
223
 
226
224
  add_tests("alias_ugh",
227
225
  "Ruby" => "class X\n alias y x\nend",
228
- "RawParseTree" => [:class, :X, nil,
229
- [:scope, [:alias, [:lit, :y], [:lit, :x]]]],
230
226
  "ParseTree" => s(:class, :X, nil,
231
227
  s(:scope, s(:alias, s(:lit, :y), s(:lit, :x)))),
232
228
  "Ruby2Ruby" => "class X\n alias :y :x\nend")
233
229
 
234
230
  add_tests("and",
235
231
  "Ruby" => "a and b",
236
- "RawParseTree" => [:and, [:vcall, :a], [:vcall, :b]],
237
232
  "ParseTree" => s(:and,
238
233
  s(:call, nil, :a, s(:arglist)),
239
234
  s(:call, nil, :b, s(:arglist))))
240
235
 
241
236
  add_tests("argscat_inside",
242
237
  "Ruby" => "a = [b, *c]",
243
- "RawParseTree" => [:lasgn, :a,
244
- [:argscat,
245
- [:array, [:vcall, :b]], [:vcall, :c]]],
246
238
  "ParseTree" => s(:lasgn, :a,
247
239
  s(:array,
248
240
  s(:call, nil, :b, s(:arglist)),
@@ -250,11 +242,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
250
242
 
251
243
  add_tests("argscat_svalue",
252
244
  "Ruby" => "a = b, c, *d",
253
- "RawParseTree" => [:lasgn, :a,
254
- [:svalue,
255
- [:argscat,
256
- [:array, [:vcall, :b], [:vcall, :c]],
257
- [:vcall, :d]]]],
258
245
  "ParseTree" => s(:lasgn, :a,
259
246
  s(:svalue,
260
247
  s(:array,
@@ -265,13 +252,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
265
252
 
266
253
  add_tests("argspush",
267
254
  "Ruby" => "a[*b] = c",
268
- "RawParseTree" => [:attrasgn,
269
- [:vcall, :a],
270
- :[]=,
271
- [:argspush,
272
- [:splat,
273
- [:vcall, :b]],
274
- [:vcall, :c]]],
275
255
  "ParseTree" => s(:attrasgn,
276
256
  s(:call, nil, :a, s(:arglist)),
277
257
  :[]=,
@@ -282,22 +262,16 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
282
262
 
283
263
  add_tests("array",
284
264
  "Ruby" => "[1, :b, \"c\"]",
285
- "RawParseTree" => [:array, [:lit, 1], [:lit, :b], [:str, "c"]],
286
265
  "ParseTree" => s(:array, s(:lit, 1), s(:lit, :b), s(:str, "c")))
287
266
 
288
267
  add_tests("array_pct_W",
289
268
  "Ruby" => "%W[a b c]",
290
- "RawParseTree" => [:array, [:str, "a"], [:str, "b"], [:str, "c"]],
291
269
  "ParseTree" => s(:array,
292
270
  s(:str, "a"), s(:str, "b"), s(:str, "c")),
293
271
  "Ruby2Ruby" => "[\"a\", \"b\", \"c\"]")
294
272
 
295
273
  add_tests("array_pct_W_dstr",
296
274
  "Ruby" => "%W[a #\{@b} c]",
297
- "RawParseTree" => [:array,
298
- [:str, "a"],
299
- [:dstr, "", [:evstr, [:ivar, :@b]]],
300
- [:str, "c"]],
301
275
  "ParseTree" => s(:array,
302
276
  s(:str, "a"),
303
277
  s(:dstr, "", s(:evstr, s(:ivar, :@b))),
@@ -306,17 +280,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
306
280
 
307
281
  add_tests("array_pct_w",
308
282
  "Ruby" => "%w[a b c]",
309
- "RawParseTree" => [:array, [:str, "a"], [:str, "b"], [:str, "c"]],
310
283
  "ParseTree" => s(:array,
311
284
  s(:str, "a"), s(:str, "b"), s(:str, "c")),
312
285
  "Ruby2Ruby" => "[\"a\", \"b\", \"c\"]")
313
286
 
314
287
  add_tests("array_pct_w_dstr",
315
288
  "Ruby" => "%w[a #\{@b} c]",
316
- "RawParseTree" => [:array,
317
- [:str, "a"],
318
- [:str, "#\{@b}"],
319
- [:str, "c"]],
320
289
  "ParseTree" => s(:array,
321
290
  s(:str, "a"),
322
291
  s(:str, "#\{@b}"),
@@ -325,10 +294,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
325
294
 
326
295
  add_tests("attrasgn",
327
296
  "Ruby" => "y = 0\n42.method = y\n",
328
- "RawParseTree" => [:block,
329
- [:lasgn, :y, [:lit, 0]],
330
- [:attrasgn, [:lit, 42], :method=,
331
- [:array, [:lvar, :y]]]],
332
297
  "ParseTree" => s(:block,
333
298
  s(:lasgn, :y, s(:lit, 0)),
334
299
  s(:attrasgn, s(:lit, 42), :method=,
@@ -336,8 +301,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
336
301
 
337
302
  add_tests("attrasgn_index_equals",
338
303
  "Ruby" => "a[42] = 24",
339
- "RawParseTree" => [:attrasgn, [:vcall, :a], :[]=,
340
- [:array, [:lit, 42], [:lit, 24]]],
341
304
  "ParseTree" => s(:attrasgn,
342
305
  s(:call, nil, :a, s(:arglist)),
343
306
  :[]=,
@@ -345,10 +308,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
345
308
 
346
309
  add_tests("attrasgn_index_equals_space",
347
310
  "Ruby" => "a = []; a [42] = 24",
348
- "RawParseTree" => [:block,
349
- [:lasgn, :a, [:zarray]],
350
- [:attrasgn, [:lvar, :a], :[]=,
351
- [:array, [:lit, 42], [:lit, 24]]]],
352
311
  "ParseTree" => s(:block,
353
312
  s(:lasgn, :a, s(:array)),
354
313
  s(:attrasgn, s(:lvar, :a), :[]=,
@@ -357,7 +316,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
357
316
 
358
317
  add_tests("attrset",
359
318
  "Ruby" => [Examples, :writer=],
360
- "RawParseTree" => [:defn, :writer=, [:attrset, :@writer]],
361
319
  "ParseTree" => s(:defn, :writer=,
362
320
  s(:args, :arg),
363
321
  s(:attrset, :@writer)),
@@ -365,11 +323,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
365
323
 
366
324
  add_tests("back_ref",
367
325
  "Ruby" => "[$&, $`, $', $+]",
368
- "RawParseTree" => [:array,
369
- [:back_ref, :&],
370
- [:back_ref, :"`"],
371
- [:back_ref, :"'"],
372
- [:back_ref, :+]],
373
326
  "ParseTree" => s(:array,
374
327
  s(:back_ref, :&),
375
328
  s(:back_ref, :"`"),
@@ -378,25 +331,18 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
378
331
 
379
332
  add_tests("begin",
380
333
  "Ruby" => "begin\n (1 + 1)\nend",
381
- "RawParseTree" => [:call, [:lit, 1], :+, [:array, [:lit, 1]]],
382
334
  "ParseTree" => s(:call, s(:lit, 1), :+,
383
335
  s(:arglist, s(:lit, 1))),
384
336
  "Ruby2Ruby" => "(1 + 1)")
385
337
 
386
338
  add_tests("begin_def",
387
339
  "Ruby" => "def m\n begin\n\n end\nend",
388
- "RawParseTree" => [:defn, :m, [:scope, [:block, [:args], [:nil]]]],
389
340
  "ParseTree" => s(:defn, :m, s(:args),
390
341
  s(:scope, s(:block, s(:nil)))),
391
342
  "Ruby2Ruby" => "def m\n # do nothing\nend")
392
343
 
393
344
  add_tests("begin_rescue_ensure",
394
345
  "Ruby" => "begin\n a\nrescue\n # do nothing\nensure\n # do nothing\nend",
395
- "RawParseTree" => [:ensure,
396
- [:rescue,
397
- [:vcall, :a],
398
- [:resbody, nil]],
399
- [:nil]],
400
346
  "ParseTree" => s(:ensure,
401
347
  s(:rescue,
402
348
  s(:call, nil, :a, s(:arglist)),
@@ -405,10 +351,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
405
351
 
406
352
  add_tests("begin_rescue_ensure_all_empty",
407
353
  "Ruby" => "begin\n # do nothing\nrescue\n # do nothing\nensure\n # do nothing\nend",
408
- "RawParseTree" => [:ensure,
409
- [:rescue,
410
- [:resbody, nil]],
411
- [:nil]],
412
354
  "ParseTree" => s(:ensure,
413
355
  s(:rescue,
414
356
  s(:resbody, s(:array), nil)),
@@ -416,15 +358,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
416
358
 
417
359
  add_tests("begin_rescue_twice",
418
360
  "Ruby" => "begin\n a\nrescue => mes\n # do nothing\nend\nbegin\n b\nrescue => mes\n # do nothing\nend\n",
419
- "RawParseTree" => [:block,
420
- [:rescue,
421
- [:vcall, :a],
422
- [:resbody, nil,
423
- [:lasgn, :mes, [:gvar, :$!]]]],
424
- [:rescue,
425
- [:vcall, :b],
426
- [:resbody, nil,
427
- [:lasgn, :mes, [:gvar, :$!]]]]],
428
361
  "ParseTree" => s(:block,
429
362
  s(:rescue,
430
363
  s(:call, nil, :a, s(:arglist)),
@@ -438,30 +371,11 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
438
371
  s(:lasgn, :mes, s(:gvar, :$!))),
439
372
  nil))))
440
373
 
441
- add_tests("begin_rescue_twice_mri_verbose_flag",
442
- "RawParseTree" => [:block,
443
- [:rescue, # no begin
444
- [:vcall, :a],
445
- [:resbody, nil,
446
- [:lasgn, :mes, [:gvar, :$!]]]],
447
- [:rescue,
448
- [:vcall, :b],
449
- [:resbody, nil,
450
- [:lasgn, :mes, [:gvar, :$!]]]]])
451
-
452
374
  copy_test_case "begin_rescue_twice", "Ruby"
453
375
  copy_test_case "begin_rescue_twice", "ParseTree"
454
376
 
455
377
  add_tests("block_attrasgn",
456
378
  "Ruby" => "def self.setup(ctx)\n bind = allocate\n bind.context = ctx\n return bind\nend",
457
- "RawParseTree" => [:defs, [:self], :setup,
458
- [:scope,
459
- [:block,
460
- [:args, :ctx],
461
- [:lasgn, :bind, [:vcall, :allocate]],
462
- [:attrasgn, [:lvar, :bind], :context=,
463
- [:array, [:lvar, :ctx]]],
464
- [:return, [:lvar, :bind]]]]],
465
379
  "ParseTree" => s(:defs, s(:self), :setup,
466
380
  s(:args, :ctx),
467
381
  s(:scope,
@@ -475,10 +389,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
475
389
 
476
390
  add_tests("block_lasgn",
477
391
  "Ruby" => "x = (y = 1\n(y + 2))",
478
- "RawParseTree" => [:lasgn, :x,
479
- [:block,
480
- [:lasgn, :y, [:lit, 1]],
481
- [:call, [:lvar, :y], :+, [:array, [:lit, 2]]]]],
482
392
  "ParseTree" => s(:lasgn, :x,
483
393
  s(:block,
484
394
  s(:lasgn, :y, s(:lit, 1)),
@@ -487,19 +397,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
487
397
 
488
398
  add_tests("block_mystery_block",
489
399
  "Ruby" => "a(b) do\n if b then\n true\n else\n c = false\n d { |x| c = true }\n c\n end\nend",
490
- "RawParseTree" => [:iter,
491
- [:fcall, :a, [:array, [:vcall, :b]]],
492
- nil,
493
- [:if,
494
- [:vcall, :b],
495
- [:true],
496
- [:block,
497
- [:dasgn_curr, :c, [:false]],
498
- [:iter,
499
- [:fcall, :d],
500
- [:dasgn_curr, :x],
501
- [:dasgn, :c, [:true]]],
502
- [:dvar, :c]]]],
503
400
  "ParseTree" => s(:iter,
504
401
  s(:call, nil, :a,
505
402
  s(:arglist, s(:call, nil, :b, s(:arglist)))),
@@ -517,16 +414,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
517
414
 
518
415
  add_tests("block_pass_args_and_splat",
519
416
  "Ruby" => "def blah(*args, &block)\n other(42, *args, &block)\nend",
520
- "RawParseTree" => [:defn, :blah,
521
- [:scope,
522
- [:block,
523
- [:args, :"*args"],
524
- [:block_arg, :block],
525
- [:block_pass,
526
- [:lvar, :block],
527
- [:fcall, :other,
528
- [:argscat,
529
- [:array, [:lit, 42]], [:lvar, :args]]]]]]],
530
417
  "ParseTree" => s(:defn, :blah,
531
418
  s(:args, :"*args", :"&block"),
532
419
  s(:scope,
@@ -539,8 +426,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
539
426
 
540
427
  add_tests("block_pass_call_0",
541
428
  "Ruby" => "a.b(&c)",
542
- "RawParseTree" => [:block_pass,
543
- [:vcall, :c], [:call, [:vcall, :a], :b]],
544
429
  "ParseTree" => s(:call,
545
430
  s(:call, nil, :a, s(:arglist)),
546
431
  :b,
@@ -550,9 +435,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
550
435
 
551
436
  add_tests("block_pass_call_1",
552
437
  "Ruby" => "a.b(4, &c)",
553
- "RawParseTree" => [:block_pass,
554
- [:vcall, :c],
555
- [:call, [:vcall, :a], :b, [:array, [:lit, 4]]]],
556
438
  "ParseTree" => s(:call,
557
439
  s(:call, nil, :a, s(:arglist)),
558
440
  :b,
@@ -563,10 +445,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
563
445
 
564
446
  add_tests("block_pass_call_n",
565
447
  "Ruby" => "a.b(1, 2, 3, &c)",
566
- "RawParseTree" => [:block_pass,
567
- [:vcall, :c],
568
- [:call, [:vcall, :a], :b,
569
- [:array, [:lit, 1], [:lit, 2], [:lit, 3]]]],
570
448
  "ParseTree" => s(:call,
571
449
  s(:call, nil, :a, s(:arglist)),
572
450
  :b,
@@ -577,7 +455,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
577
455
 
578
456
  add_tests("block_pass_fcall_0",
579
457
  "Ruby" => "a(&b)",
580
- "RawParseTree" => [:block_pass, [:vcall, :b], [:fcall, :a]],
581
458
  "ParseTree" => s(:call, nil, :a,
582
459
  s(:arglist,
583
460
  s(:block_pass,
@@ -585,9 +462,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
585
462
 
586
463
  add_tests("block_pass_fcall_1",
587
464
  "Ruby" => "a(4, &b)",
588
- "RawParseTree" => [:block_pass,
589
- [:vcall, :b],
590
- [:fcall, :a, [:array, [:lit, 4]]]],
591
465
  "ParseTree" => s(:call, nil, :a,
592
466
  s(:arglist,
593
467
  s(:lit, 4),
@@ -596,10 +470,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
596
470
 
597
471
  add_tests("block_pass_fcall_n",
598
472
  "Ruby" => "a(1, 2, 3, &b)",
599
- "RawParseTree" => [:block_pass,
600
- [:vcall, :b],
601
- [:fcall, :a,
602
- [:array, [:lit, 1], [:lit, 2], [:lit, 3]]]],
603
473
  "ParseTree" => s(:call, nil, :a,
604
474
  s(:arglist,
605
475
  s(:lit, 1), s(:lit, 2), s(:lit, 3),
@@ -608,13 +478,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
608
478
 
609
479
  add_tests("block_pass_omgwtf",
610
480
  "Ruby" => "define_attr_method(:x, :sequence_name, &Proc.new { |*args| nil })",
611
- "RawParseTree" => [:block_pass,
612
- [:iter,
613
- [:call, [:const, :Proc], :new],
614
- [:masgn, nil, [:dasgn_curr, :args], nil],
615
- [:nil]],
616
- [:fcall, :define_attr_method,
617
- [:array, [:lit, :x], [:lit, :sequence_name]]]],
618
481
  "ParseTree" => s(:call, nil, :define_attr_method,
619
482
  s(:arglist,
620
483
  s(:lit, :x),
@@ -629,15 +492,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
629
492
 
630
493
  add_tests("block_pass_splat",
631
494
  "Ruby" => "def blah(*args, &block)\n other(*args, &block)\nend",
632
- "RawParseTree" => [:defn, :blah,
633
- [:scope,
634
- [:block,
635
- [:args, :"*args"],
636
- [:block_arg, :block],
637
- [:block_pass,
638
- [:lvar, :block],
639
- [:fcall, :other,
640
- [:splat, [:lvar, :args]]]]]]],
641
495
  "ParseTree" => s(:defn, :blah,
642
496
  s(:args, :"*args", :"&block"),
643
497
  s(:scope,
@@ -649,10 +503,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
649
503
 
650
504
  add_tests("block_pass_thingy",
651
505
  "Ruby" => "r.read_body(dest, &block)",
652
- "RawParseTree" => [:block_pass,
653
- [:vcall, :block],
654
- [:call, [:vcall, :r], :read_body,
655
- [:array, [:vcall, :dest]]]],
656
506
  "ParseTree" => s(:call,
657
507
  s(:call, nil, :r, s(:arglist)),
658
508
  :read_body,
@@ -663,14 +513,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
663
513
 
664
514
  add_tests("block_stmt_after",
665
515
  "Ruby" => "def f\n begin\n b\n rescue\n c\n end\n\n d\nend",
666
- "RawParseTree" => [:defn, :f,
667
- [:scope,
668
- [:block,
669
- [:args],
670
- [:rescue,
671
- [:vcall, :b],
672
- [:resbody, nil, [:vcall, :c]]],
673
- [:vcall, :d]]]],
674
516
  "ParseTree" => s(:defn, :f,
675
517
  s(:args),
676
518
  s(:scope,
@@ -683,29 +525,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
683
525
  s(:call, nil, :d, s(:arglist))))),
684
526
  "Ruby2Ruby" => "def f\n b rescue c\n d\nend")
685
527
 
686
- add_tests("block_stmt_after_mri_verbose_flag",
687
- "RawParseTree" => [:defn, :f,
688
- [:scope,
689
- [:block,
690
- [:args],
691
- [:rescue, # no begin
692
- [:vcall, :b],
693
- [:resbody, nil, [:vcall, :c]]],
694
- [:vcall, :d]]]])
695
-
696
528
  copy_test_case "block_stmt_after", "Ruby"
697
529
  copy_test_case "block_stmt_after", "ParseTree"
698
530
  copy_test_case "block_stmt_after", "Ruby2Ruby"
699
531
 
700
532
  add_tests("block_stmt_before",
701
533
  "Ruby" => "def f\n a\n begin\n b\n rescue\n c\n end\nend",
702
- "RawParseTree" => [:defn, :f,
703
- [:scope,
704
- [:block,
705
- [:args],
706
- [:vcall, :a],
707
- [:rescue, [:vcall, :b],
708
- [:resbody, nil, [:vcall, :c]]]]]],
709
534
  "ParseTree" => s(:defn, :f,
710
535
  s(:args),
711
536
  s(:scope,
@@ -720,22 +545,10 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
720
545
  # oddly... this one doesn't HAVE any differences when verbose... new?
721
546
  copy_test_case "block_stmt_before", "Ruby"
722
547
  copy_test_case "block_stmt_before", "ParseTree"
723
- copy_test_case "block_stmt_before", "RawParseTree"
724
548
  copy_test_case "block_stmt_before", "Ruby2Ruby"
725
549
 
726
550
  add_tests("block_stmt_both",
727
551
  "Ruby" => "def f\n a\n begin\n b\n rescue\n c\n end\n d\nend",
728
- "RawParseTree" => [:defn, :f,
729
- [:scope,
730
- [:block,
731
- [:args],
732
- [:vcall, :a],
733
- [:rescue,
734
- [:vcall, :b],
735
- [:resbody,
736
- nil,
737
- [:vcall, :c]]],
738
- [:vcall, :d]]]],
739
552
  "ParseTree" => s(:defn, :f, s(:args),
740
553
  s(:scope,
741
554
  s(:block,
@@ -748,29 +561,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
748
561
  s(:call, nil, :d, s(:arglist))))),
749
562
  "Ruby2Ruby" => "def f\n a\n b rescue c\n d\nend")
750
563
 
751
- add_tests("block_stmt_both_mri_verbose_flag",
752
- "RawParseTree" => [:defn, :f,
753
- [:scope,
754
- [:block,
755
- [:args],
756
- [:vcall, :a],
757
- [:rescue, # no begin
758
- [:vcall, :b],
759
- [:resbody,
760
- nil,
761
- [:vcall, :c]]],
762
- [:vcall, :d]]]])
763
-
764
564
  copy_test_case "block_stmt_both", "Ruby"
765
565
  copy_test_case "block_stmt_both", "ParseTree"
766
566
  copy_test_case "block_stmt_both", "Ruby2Ruby"
767
567
 
768
568
  add_tests("bmethod",
769
569
  "Ruby" => [Examples, :unsplatted],
770
- "RawParseTree" => [:defn, :unsplatted,
771
- [:bmethod,
772
- [:dasgn_curr, :x],
773
- [:call, [:dvar, :x], :+, [:array, [:lit, 1]]]]],
774
570
  "ParseTree" => s(:defn, :unsplatted,
775
571
  s(:args, :x),
776
572
  s(:scope,
@@ -783,11 +579,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
783
579
 
784
580
  add_tests("bmethod_noargs",
785
581
  "Ruby" => [Examples, :bmethod_noargs],
786
- "RawParseTree" => [:defn, :bmethod_noargs,
787
- [:bmethod,
788
- nil,
789
- [:call,
790
- [:vcall, :x], :"+", [:array, [:lit, 1]]]]],
791
582
  "ParseTree" => s(:defn, :bmethod_noargs,
792
583
  s(:args),
793
584
  s(:scope,
@@ -800,14 +591,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
800
591
 
801
592
  add_tests("bmethod_splat",
802
593
  "Ruby" => [Examples, :splatted],
803
- "RawParseTree" => [:defn, :splatted,
804
- [:bmethod,
805
- [:masgn, nil, [:dasgn_curr, :args], nil],
806
- [:block,
807
- [:dasgn_curr, :y,
808
- [:call, [:dvar, :args], :first]],
809
- [:call, [:dvar, :y], :+,
810
- [:array, [:lit, 42]]]]]],
811
594
  "ParseTree" => s(:defn, :splatted,
812
595
  s(:args, :"*args"),
813
596
  s(:scope,
@@ -821,72 +604,54 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
821
604
 
822
605
  add_tests("break",
823
606
  "Ruby" => "loop { break if true }",
824
- "RawParseTree" => [:iter,
825
- [:fcall, :loop], nil,
826
- [:if, [:true], [:break], nil]],
827
607
  "ParseTree" => s(:iter,
828
608
  s(:call, nil, :loop, s(:arglist)), nil,
829
609
  s(:if, s(:true), s(:break), nil)))
830
610
 
831
611
  add_tests("break_arg",
832
612
  "Ruby" => "loop { break 42 if true }",
833
- "RawParseTree" => [:iter,
834
- [:fcall, :loop], nil,
835
- [:if, [:true], [:break, [:lit, 42]], nil]],
836
613
  "ParseTree" => s(:iter,
837
614
  s(:call, nil, :loop, s(:arglist)), nil,
838
615
  s(:if, s(:true), s(:break, s(:lit, 42)), nil)))
839
616
 
840
617
  add_tests("call",
841
618
  "Ruby" => "self.method",
842
- "RawParseTree" => [:call, [:self], :method],
843
619
  "ParseTree" => s(:call, s(:self), :method, s(:arglist)))
844
620
 
845
621
  add_tests("call_arglist",
846
622
  "Ruby" => "o.puts(42)",
847
- "RawParseTree" => [:call, [:vcall, :o], :puts,
848
- [:array, [:lit, 42]]],
849
623
  "ParseTree" => s(:call, s(:call, nil, :o, s(:arglist)), :puts,
850
624
  s(:arglist, s(:lit, 42))))
851
625
 
852
626
  add_tests("call_no_space_symbol",
853
627
  "Ruby" => "foo:bar",
854
- "RawParseTree" => [:call, nil, :foo, [:array, [:lit, :bar]]],
855
- "ParseTree" => s(:call, nil, :foo, s(:arglist, s(:lit, :bar))))
628
+ "ParseTree" => s(:call, nil, :foo, s(:arglist, s(:lit, :bar))),
629
+ "Ruby2Ruby" => "foo(:bar)")
856
630
 
857
631
  add_tests("ternary_symbol_no_spaces",
858
632
  "Ruby" => "1?:x:1",
859
- "RawParseTree" => [:if, [:lit, 1], [:lit, :x], [:lit, 1]],
860
- "ParseTree" => s(:if, s(:lit, 1), s(:lit, :x), s(:lit, 1)))
633
+ "ParseTree" => s(:if, s(:lit, 1), s(:lit, :x), s(:lit, 1)),
634
+ "Ruby2Ruby" => "1 ? (:x) : (1)")
861
635
 
862
636
  add_19tests("label_in_callargs_in_ternary",
863
637
  "Ruby" => "1 ? m(a: 2) : 1",
864
- "RawParseTree" => [:if, [:lit, 1], [:call, :nil, :m, [:array, [:hash, [:lit, :a], [:lit, 1]]]], [:lit, 1]],
865
- "ParseTree" => s(:if, s(:lit, 1), s(:call, nil, :m, s(:arglist, s(:hash, s(:lit, :a), s(:lit, 2)))), s(:lit, 1)))
638
+ "ParseTree" => s(:if, s(:lit, 1),
639
+ s(:call, nil, :m,
640
+ s(:arglist,
641
+ s(:hash, s(:lit, :a), s(:lit, 2)))),
642
+ s(:lit, 1)))
866
643
 
867
644
  add_19tests("label_in_bare_hash_in_array_in_ternary",
868
645
  "Ruby" => "1 ? [:a, b: 2] : 1",
869
- "RawParseTree" => [:if, [:array, [:lit, :a], [:hash, [:lit, :b], [:lit, 2]]], [:lit, 1]],
870
646
  "ParseTree" => s(:if, s(:lit, 1), s(:array, s(:lit, :a), s(:hash, s(:lit, :b), s(:lit, 2))), s(:lit, 1)))
871
647
 
872
- add_tests("ternary_object_no_spaces",
873
- "Ruby" => "1 ?o:1",
874
- "RawParseTree" => [:if, [:lit, 1], [:vcall, :o], [:lit, 1]],
875
- "ParseTree" => s(:if, s(:lit, 1), s(:call, nil, :o, s(:arglist)), s(:lit, 1)))
876
-
877
648
  add_tests("ternary_nil_no_space",
878
649
  "Ruby" => "1 ? nil: 1",
879
- "RawParseTree" => [:if, [:lit, 1], [:nil], [:lit, 1]],
880
- "ParseTree" => s(:if, s(:lit, 1), s(:nil), s(:lit, 1)))
650
+ "ParseTree" => s(:if, s(:lit, 1), s(:nil), s(:lit, 1)),
651
+ "Ruby2Ruby" => "1 ? (nil) : (1)")
881
652
 
882
653
  add_tests("call_arglist_hash",
883
654
  "Ruby" => "o.m(:a => 1, :b => 2)",
884
- "RawParseTree" => [:call,
885
- [:vcall, :o], :m,
886
- [:array,
887
- [:hash,
888
- [:lit, :a], [:lit, 1],
889
- [:lit, :b], [:lit, 2]]]],
890
655
  "ParseTree" => s(:call,
891
656
  s(:call, nil, :o, s(:arglist)), :m,
892
657
  s(:arglist,
@@ -896,13 +661,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
896
661
 
897
662
  add_tests("call_arglist_norm_hash",
898
663
  "Ruby" => "o.m(42, :a => 1, :b => 2)",
899
- "RawParseTree" => [:call,
900
- [:vcall, :o], :m,
901
- [:array,
902
- [:lit, 42],
903
- [:hash,
904
- [:lit, :a], [:lit, 1],
905
- [:lit, :b], [:lit, 2]]]],
906
664
  "ParseTree" => s(:call,
907
665
  s(:call, nil, :o, s(:arglist)), :m,
908
666
  s(:arglist,
@@ -913,15 +671,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
913
671
 
914
672
  add_tests("call_arglist_norm_hash_splat",
915
673
  "Ruby" => "o.m(42, :a => 1, :b => 2, *c)",
916
- "RawParseTree" => [:call,
917
- [:vcall, :o], :m,
918
- [:argscat,
919
- [:array,
920
- [:lit, 42],
921
- [:hash,
922
- [:lit, :a], [:lit, 1],
923
- [:lit, :b], [:lit, 2]]],
924
- [:vcall, :c]]],
925
674
  "ParseTree" => s(:call,
926
675
  s(:call, nil, :o, s(:arglist)), :m,
927
676
  s(:arglist,
@@ -933,8 +682,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
933
682
 
934
683
  add_tests("call_arglist_space",
935
684
  "Ruby" => "a (1,2,3)",
936
- "RawParseTree" => [:fcall, :a,
937
- [:array, [:lit, 1], [:lit, 2], [:lit, 3]]],
938
685
  "ParseTree" => s(:call, nil, :a,
939
686
  s(:arglist,
940
687
  s(:lit, 1), s(:lit, 2), s(:lit, 3))),
@@ -942,7 +689,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
942
689
 
943
690
  add_tests("call_command",
944
691
  "Ruby" => "1.b(c)",
945
- "RawParseTree" => [:call, [:lit, 1], :b, [:array, [:vcall, :c]]],
946
692
  "ParseTree" => s(:call,
947
693
  s(:lit, 1),
948
694
  :b,
@@ -950,10 +696,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
950
696
 
951
697
  add_tests("call_expr",
952
698
  "Ruby" => "(v = (1 + 1)).zero?",
953
- "RawParseTree" => [:call,
954
- [:lasgn, :v,
955
- [:call, [:lit, 1], :+, [:array, [:lit, 1]]]],
956
- :zero?],
957
699
  "ParseTree" => s(:call,
958
700
  s(:lasgn, :v,
959
701
  s(:call, s(:lit, 1), :+,
@@ -962,9 +704,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
962
704
 
963
705
  add_tests("call_index",
964
706
  "Ruby" => "a = []\na[42]\n",
965
- "RawParseTree" => [:block,
966
- [:lasgn, :a, [:zarray]],
967
- [:call, [:lvar, :a], :[], [:array, [:lit, 42]]]],
968
707
  "ParseTree" => s(:block,
969
708
  s(:lasgn, :a, s(:array)),
970
709
  s(:call, s(:lvar, :a), :[],
@@ -972,15 +711,11 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
972
711
 
973
712
  add_tests("call_index_no_args",
974
713
  "Ruby" => "a[]",
975
- "RawParseTree" => [:call, [:vcall, :a], :[]],
976
714
  "ParseTree" => s(:call, s(:call, nil, :a, s(:arglist)),
977
715
  :[], s(:arglist)))
978
716
 
979
717
  add_tests("call_index_space",
980
718
  "Ruby" => "a = []\na [42]\n",
981
- "RawParseTree" => [:block,
982
- [:lasgn, :a, [:zarray]],
983
- [:call, [:lvar, :a], :[], [:array, [:lit, 42]]]],
984
719
  "ParseTree" => s(:block,
985
720
  s(:lasgn, :a, s(:array)),
986
721
  s(:call, s(:lvar, :a), :[],
@@ -989,9 +724,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
989
724
 
990
725
  add_tests("call_unary_neg",
991
726
  "Ruby" => "-2**31",
992
- "RawParseTree" => [:call,
993
- [:call, [:lit, 2], :**, [:array, [:lit, 31]]],
994
- :-@],
995
727
  "ParseTree" => s(:call,
996
728
  s(:call,
997
729
  s(:lit, 2),
@@ -1002,31 +734,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1002
734
 
1003
735
  add_tests("case",
1004
736
  "Ruby" => "var = 2\nresult = \"\"\ncase var\nwhen 1 then\n puts(\"something\")\n result = \"red\"\nwhen 2, 3 then\n result = \"yellow\"\nwhen 4 then\n # do nothing\nelse\n result = \"green\"\nend\ncase result\nwhen \"red\" then\n var = 1\nwhen \"yellow\" then\n var = 2\nwhen \"green\" then\n var = 3\nelse\n # do nothing\nend\n",
1005
- "RawParseTree" => [:block,
1006
- [:lasgn, :var, [:lit, 2]],
1007
- [:lasgn, :result, [:str, ""]],
1008
- [:case,
1009
- [:lvar, :var],
1010
- [:when,
1011
- [:array, [:lit, 1]],
1012
- [:block,
1013
- [:fcall, :puts,
1014
- [:array, [:str, "something"]]],
1015
- [:lasgn, :result, [:str, "red"]]]],
1016
- [:when,
1017
- [:array, [:lit, 2], [:lit, 3]],
1018
- [:lasgn, :result, [:str, "yellow"]]],
1019
- [:when, [:array, [:lit, 4]], nil],
1020
- [:lasgn, :result, [:str, "green"]]],
1021
- [:case,
1022
- [:lvar, :result],
1023
- [:when, [:array, [:str, "red"]],
1024
- [:lasgn, :var, [:lit, 1]]],
1025
- [:when, [:array, [:str, "yellow"]],
1026
- [:lasgn, :var, [:lit, 2]]],
1027
- [:when, [:array, [:str, "green"]],
1028
- [:lasgn, :var, [:lit, 3]]],
1029
- nil]],
1030
737
  "ParseTree" => s(:block,
1031
738
  s(:lasgn, :var, s(:lit, 2)),
1032
739
  s(:lasgn, :result, s(:str, "")),
@@ -1055,29 +762,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1055
762
 
1056
763
  add_tests("case_nested",
1057
764
  "Ruby" => "var1 = 1\nvar2 = 2\nresult = nil\ncase var1\nwhen 1 then\n case var2\n when 1 then\n result = 1\n when 2 then\n result = 2\n else\n result = 3\n end\nwhen 2 then\n case var2\n when 1 then\n result = 4\n when 2 then\n result = 5\n else\n result = 6\n end\nelse\n result = 7\nend\n",
1058
- "RawParseTree" => [:block,
1059
- [:lasgn, :var1, [:lit, 1]],
1060
- [:lasgn, :var2, [:lit, 2]],
1061
- [:lasgn, :result, [:nil]],
1062
- [:case,
1063
- [:lvar, :var1],
1064
- [:when, [:array, [:lit, 1]],
1065
- [:case,
1066
- [:lvar, :var2],
1067
- [:when, [:array, [:lit, 1]],
1068
- [:lasgn, :result, [:lit, 1]]],
1069
- [:when, [:array, [:lit, 2]],
1070
- [:lasgn, :result, [:lit, 2]]],
1071
- [:lasgn, :result, [:lit, 3]]]],
1072
- [:when, [:array, [:lit, 2]],
1073
- [:case,
1074
- [:lvar, :var2],
1075
- [:when, [:array, [:lit, 1]],
1076
- [:lasgn, :result, [:lit, 4]]],
1077
- [:when, [:array, [:lit, 2]],
1078
- [:lasgn, :result, [:lit, 5]]],
1079
- [:lasgn, :result, [:lit, 6]]]],
1080
- [:lasgn, :result, [:lit, 7]]]],
1081
765
  "ParseTree" => s(:block,
1082
766
  s(:lasgn, :var1, s(:lit, 1)),
1083
767
  s(:lasgn, :var2, s(:lit, 2)),
@@ -1104,14 +788,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1104
788
 
1105
789
  add_tests("case_nested_inner_no_expr",
1106
790
  "Ruby" => "case a\nwhen b then\n case\n when (d and e) then\n f\n else\n # do nothing\n end\nelse\n # do nothing\nend",
1107
- "RawParseTree" => [:case, [:vcall, :a],
1108
- [:when, [:array, [:vcall, :b]],
1109
- [:case, nil,
1110
- [:when,
1111
- [:array, [:and, [:vcall, :d], [:vcall, :e]]],
1112
- [:vcall, :f]],
1113
- nil]],
1114
- nil],
1115
791
  "ParseTree" => s(:case, s(:call, nil, :a, s(:arglist)),
1116
792
  s(:when,
1117
793
  s(:array, s(:call, nil, :b, s(:arglist))),
@@ -1127,18 +803,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1127
803
 
1128
804
  add_tests("case_no_expr",
1129
805
  "Ruby" => "case\nwhen (a == 1) then\n :a\nwhen (a == 2) then\n :b\nelse\n :c\nend",
1130
- "RawParseTree" => [:case, nil,
1131
- [:when,
1132
- [:array,
1133
- [:call, [:vcall, :a], :==,
1134
- [:array, [:lit, 1]]]],
1135
- [:lit, :a]],
1136
- [:when,
1137
- [:array,
1138
- [:call, [:vcall, :a], :==,
1139
- [:array, [:lit, 2]]]],
1140
- [:lit, :b]],
1141
- [:lit, :c]],
1142
806
  "ParseTree" => s(:case, nil,
1143
807
  s(:when,
1144
808
  s(:array,
@@ -1158,12 +822,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1158
822
 
1159
823
  add_tests("case_splat",
1160
824
  "Ruby" => "case a\nwhen :b, *c then\n d\nelse\n e\nend",
1161
- "RawParseTree" => [:case, [:vcall, :a],
1162
- [:when,
1163
- [:array,
1164
- [:lit, :b], [:when, [:vcall, :c], nil]], # wtf?
1165
- [:vcall, :d]],
1166
- [:vcall, :e]],
1167
825
  "ParseTree" => s(:case, s(:call, nil, :a, s(:arglist)),
1168
826
  s(:when,
1169
827
  s(:array,
@@ -1176,26 +834,10 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1176
834
 
1177
835
  add_tests("cdecl",
1178
836
  "Ruby" => "X = 42",
1179
- "RawParseTree" => [:cdecl, :X, [:lit, 42]],
1180
837
  "ParseTree" => s(:cdecl, :X, s(:lit, 42)))
1181
838
 
1182
839
  add_tests("class_plain",
1183
840
  "Ruby" => "class X\n puts((1 + 1))\n def blah\n puts(\"hello\")\n end\nend",
1184
- "RawParseTree" => [:class,
1185
- :X,
1186
- nil,
1187
- [:scope,
1188
- [:block,
1189
- [:fcall, :puts,
1190
- [:array,
1191
- [:call, [:lit, 1], :+,
1192
- [:array, [:lit, 1]]]]],
1193
- [:defn, :blah,
1194
- [:scope,
1195
- [:block,
1196
- [:args],
1197
- [:fcall, :puts,
1198
- [:array, [:str, "hello"]]]]]]]]],
1199
841
  "ParseTree" => s(:class,
1200
842
  :X,
1201
843
  nil,
@@ -1215,24 +857,16 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1215
857
 
1216
858
  add_tests("class_scoped",
1217
859
  "Ruby" => "class X::Y\n c\nend",
1218
- "RawParseTree" => [:class, [:colon2, [:const, :X], :Y], nil,
1219
- [:scope, [:vcall, :c]]],
1220
860
  "ParseTree" => s(:class, s(:colon2, s(:const, :X), :Y), nil,
1221
861
  s(:scope, s(:call, nil, :c, s(:arglist)))))
1222
862
 
1223
863
  add_tests("class_scoped3",
1224
864
  "Ruby" => "class ::Y\n c\nend",
1225
- "RawParseTree" => [:class, [:colon3, :Y], nil,
1226
- [:scope, [:vcall, :c]]],
1227
865
  "ParseTree" => s(:class, s(:colon3, :Y), nil,
1228
866
  s(:scope, s(:call, nil, :c, s(:arglist)))))
1229
867
 
1230
868
  add_tests("class_super_array",
1231
869
  "Ruby" => "class X < Array\nend",
1232
- "RawParseTree" => [:class,
1233
- :X,
1234
- [:const, :Array],
1235
- [:scope]],
1236
870
  "ParseTree" => s(:class,
1237
871
  :X,
1238
872
  s(:const, :Array),
@@ -1240,10 +874,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1240
874
 
1241
875
  add_tests("class_super_expr",
1242
876
  "Ruby" => "class X < expr\nend",
1243
- "RawParseTree" => [:class,
1244
- :X,
1245
- [:vcall, :expr],
1246
- [:scope]],
1247
877
  "ParseTree" => s(:class,
1248
878
  :X,
1249
879
  s(:call, nil, :expr, s(:arglist)),
@@ -1251,10 +881,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1251
881
 
1252
882
  add_tests("class_super_object",
1253
883
  "Ruby" => "class X < Object\nend",
1254
- "RawParseTree" => [:class,
1255
- :X,
1256
- [:const, :Object],
1257
- [:scope]],
1258
884
  "ParseTree" => s(:class,
1259
885
  :X,
1260
886
  s(:const, :Object),
@@ -1262,47 +888,36 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1262
888
 
1263
889
  add_tests("colon2",
1264
890
  "Ruby" => "X::Y",
1265
- "RawParseTree" => [:colon2, [:const, :X], :Y],
1266
891
  "ParseTree" => s(:colon2, s(:const, :X), :Y))
1267
892
 
1268
893
  add_tests("colon3",
1269
894
  "Ruby" => "::X",
1270
- "RawParseTree" => [:colon3, :X],
1271
895
  "ParseTree" => s(:colon3, :X))
1272
896
 
1273
897
  add_tests("const",
1274
898
  "Ruby" => "X",
1275
- "RawParseTree" => [:const, :X],
1276
899
  "ParseTree" => s(:const, :X))
1277
900
 
1278
901
  add_tests("constX",
1279
902
  "Ruby" => "X = 1",
1280
- "RawParseTree" => [:cdecl, :X, [:lit, 1]],
1281
903
  "ParseTree" => s(:cdecl, :X, s(:lit, 1)))
1282
904
 
1283
905
  add_tests("constY",
1284
906
  "Ruby" => "::X = 1",
1285
- "RawParseTree" => [:cdecl, [:colon3, :X], [:lit, 1]],
1286
907
  "ParseTree" => s(:cdecl, s(:colon3, :X), s(:lit, 1)))
1287
908
 
1288
909
  add_tests("constZ",
1289
910
  "Ruby" => "X::Y = 1",
1290
- "RawParseTree" => [:cdecl, [:colon2, [:const, :X], :Y], [:lit, 1]],
1291
911
  "ParseTree" => s(:cdecl,
1292
912
  s(:colon2, s(:const, :X), :Y),
1293
913
  s(:lit, 1)))
1294
914
 
1295
915
  add_tests("cvar",
1296
916
  "Ruby" => "@@x",
1297
- "RawParseTree" => [:cvar, :@@x],
1298
917
  "ParseTree" => s(:cvar, :@@x))
1299
918
 
1300
919
  add_tests("cvasgn",
1301
920
  "Ruby" => "def x\n @@blah = 1\nend",
1302
- "RawParseTree" => [:defn, :x,
1303
- [:scope,
1304
- [:block, [:args],
1305
- [:cvasgn, :@@blah, [:lit, 1]]]]],
1306
921
  "ParseTree" => s(:defn, :x,
1307
922
  s(:args),
1308
923
  s(:scope,
@@ -1311,11 +926,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1311
926
 
1312
927
  add_tests("cvasgn_cls_method",
1313
928
  "Ruby" => "def self.quiet_mode=(boolean)\n @@quiet_mode = boolean\nend",
1314
- "RawParseTree" => [:defs, [:self], :quiet_mode=,
1315
- [:scope,
1316
- [:block,
1317
- [:args, :boolean],
1318
- [:cvasgn, :@@quiet_mode, [:lvar, :boolean]]]]],
1319
929
  "ParseTree" => s(:defs, s(:self), :quiet_mode=,
1320
930
  s(:args, :boolean),
1321
931
  s(:scope,
@@ -1325,24 +935,11 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1325
935
 
1326
936
  add_tests("cvdecl",
1327
937
  "Ruby" => "class X\n @@blah = 1\nend",
1328
- "RawParseTree" => [:class, :X, nil,
1329
- [:scope, [:cvdecl, :@@blah, [:lit, 1]]]],
1330
938
  "ParseTree" => s(:class, :X, nil,
1331
939
  s(:scope, s(:cvdecl, :@@blah, s(:lit, 1)))))
1332
940
 
1333
941
  add_tests("dasgn_0",
1334
942
  "Ruby" => "a.each { |x| b.each { |y| x = (x + 1) } if true }",
1335
- "RawParseTree" => [:iter,
1336
- [:call, [:vcall, :a], :each],
1337
- [:dasgn_curr, :x],
1338
- [:if, [:true],
1339
- [:iter,
1340
- [:call, [:vcall, :b], :each],
1341
- [:dasgn_curr, :y],
1342
- [:dasgn, :x,
1343
- [:call, [:dvar, :x], :+,
1344
- [:array, [:lit, 1]]]]],
1345
- nil]],
1346
943
  "ParseTree" => s(:iter,
1347
944
  s(:call, s(:call, nil, :a, s(:arglist)), :each,
1348
945
  s(:arglist)),
@@ -1360,17 +957,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1360
957
 
1361
958
  add_tests("dasgn_1",
1362
959
  "Ruby" => "a.each { |x| b.each { |y| c = (c + 1) } if true }",
1363
- "RawParseTree" => [:iter,
1364
- [:call, [:vcall, :a], :each],
1365
- [:dasgn_curr, :x],
1366
- [:if, [:true],
1367
- [:iter,
1368
- [:call, [:vcall, :b], :each],
1369
- [:dasgn_curr, :y],
1370
- [:dasgn_curr, :c,
1371
- [:call, [:dvar, :c], :+,
1372
- [:array, [:lit, 1]]]]],
1373
- nil]],
1374
960
  "ParseTree" => s(:iter,
1375
961
  s(:call, s(:call, nil, :a, s(:arglist)), :each,
1376
962
  s(:arglist)),
@@ -1388,19 +974,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1388
974
 
1389
975
  add_tests("dasgn_2",
1390
976
  "Ruby" => "a.each do |x|\n if true then\n c = 0\n b.each { |y| c = (c + 1) }\n end\nend", # FIX: hate that extra newline!
1391
- "RawParseTree" => [:iter,
1392
- [:call, [:vcall, :a], :each],
1393
- [:dasgn_curr, :x],
1394
- [:if, [:true],
1395
- [:block,
1396
- [:dasgn_curr, :c, [:lit, 0]],
1397
- [:iter,
1398
- [:call, [:vcall, :b], :each],
1399
- [:dasgn_curr, :y],
1400
- [:dasgn, :c,
1401
- [:call, [:dvar, :c], :+,
1402
- [:array, [:lit, 1]]]]]],
1403
- nil]],
1404
977
  "ParseTree" => s(:iter,
1405
978
  s(:call, s(:call, nil, :a, s(:arglist)), :each,
1406
979
  s(:arglist)),
@@ -1420,16 +993,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1420
993
 
1421
994
  add_tests("dasgn_curr",
1422
995
  "Ruby" => "data.each do |x, y|\n a = 1\n b = a\n b = a = x\nend",
1423
- "RawParseTree" => [:iter,
1424
- [:call, [:vcall, :data], :each],
1425
- [:masgn,
1426
- [:array, [:dasgn_curr, :x], [:dasgn_curr, :y]],
1427
- nil, nil],
1428
- [:block,
1429
- [:dasgn_curr, :a, [:lit, 1]],
1430
- [:dasgn_curr, :b, [:dvar, :a]],
1431
- [:dasgn_curr, :b,
1432
- [:dasgn_curr, :a, [:dvar, :x]]]]],
1433
996
  "ParseTree" => s(:iter,
1434
997
  s(:call, s(:call, nil, :data,
1435
998
  s(:arglist)), :each, s(:arglist)),
@@ -1442,22 +1005,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1442
1005
 
1443
1006
  add_tests("dasgn_icky",
1444
1007
  "Ruby" => "a do\n v = nil\n assert_block(full_message) do\n begin\n yield\n rescue Exception => v\n break\n end\n end\nend",
1445
- "RawParseTree" => [:iter,
1446
- [:fcall, :a],
1447
- nil,
1448
- [:block,
1449
- [:dasgn_curr, :v, [:nil]],
1450
- [:iter,
1451
- [:fcall, :assert_block,
1452
- [:array, [:vcall, :full_message]]],
1453
- nil,
1454
- [:rescue,
1455
- [:yield],
1456
- [:resbody,
1457
- [:array, [:const, :Exception]],
1458
- [:block,
1459
- [:dasgn, :v,
1460
- [:gvar, :$!]], [:break]]]]]]],
1461
1008
  "ParseTree" => s(:iter,
1462
1009
  s(:call, nil, :a, s(:arglist)),
1463
1010
  nil,
@@ -1479,14 +1026,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1479
1026
 
1480
1027
  add_tests("dasgn_mixed",
1481
1028
  "Ruby" => "t = 0\nns.each { |n| t += n }\n",
1482
- "RawParseTree" => [:block,
1483
- [:lasgn, :t, [:lit, 0]],
1484
- [:iter,
1485
- [:call, [:vcall, :ns], :each],
1486
- [:dasgn_curr, :n],
1487
- [:lasgn, :t,
1488
- [:call, [:lvar, :t], :+,
1489
- [:array, [:dvar, :n]]]]]],
1490
1029
  "ParseTree" => s(:block,
1491
1030
  s(:lasgn, :t, s(:lit, 0)),
1492
1031
  s(:iter,
@@ -1500,54 +1039,29 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1500
1039
 
1501
1040
  add_tests("defined",
1502
1041
  "Ruby" => "defined? $x",
1503
- "RawParseTree" => [:defined, [:gvar, :$x]],
1504
1042
  "ParseTree" => s(:defined, s(:gvar, :$x)))
1505
1043
 
1506
1044
  # TODO: make all the defn_args* p their arglist
1507
1045
  add_tests("defn_args_block",
1508
1046
  "Ruby" => "def f(&block)\n # do nothing\nend",
1509
- "RawParseTree" => [:defn, :f,
1510
- [:scope,
1511
- [:block,
1512
- [:args],
1513
- [:block_arg, :block],
1514
- [:nil]]]],
1515
1047
  "ParseTree" => s(:defn, :f,
1516
1048
  s(:args, :"&block"),
1517
1049
  s(:scope, s(:block, s(:nil)))))
1518
1050
 
1519
1051
  add_tests("defn_args_mand",
1520
1052
  "Ruby" => "def f(mand)\n # do nothing\nend",
1521
- "RawParseTree" => [:defn, :f,
1522
- [:scope,
1523
- [:block,
1524
- [:args, :mand],
1525
- [:nil]]]],
1526
1053
  "ParseTree" => s(:defn, :f,
1527
1054
  s(:args, :mand),
1528
1055
  s(:scope, s(:block, s(:nil)))))
1529
1056
 
1530
1057
  add_tests("defn_args_mand_block",
1531
1058
  "Ruby" => "def f(mand, &block)\n # do nothing\nend",
1532
- "RawParseTree" => [:defn, :f,
1533
- [:scope,
1534
- [:block,
1535
- [:args, :mand],
1536
- [:block_arg, :block],
1537
- [:nil]]]],
1538
1059
  "ParseTree" => s(:defn, :f,
1539
1060
  s(:args, :mand, :"&block"),
1540
1061
  s(:scope, s(:block, s(:nil)))))
1541
1062
 
1542
1063
  add_tests("defn_args_mand_opt",
1543
1064
  "Ruby" => "def f(mand, opt = 42)\n # do nothing\nend",
1544
- "RawParseTree" => [:defn, :f,
1545
- [:scope,
1546
- [:block,
1547
- [:args, :mand, :opt,
1548
- [:block,
1549
- [:lasgn, :opt, [:lit, 42]]]],
1550
- [:nil]]]],
1551
1065
  "ParseTree" => s(:defn, :f,
1552
1066
  s(:args, :mand, :opt,
1553
1067
  s(:block,
@@ -1556,14 +1070,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1556
1070
 
1557
1071
  add_tests("defn_args_mand_opt_block",
1558
1072
  "Ruby" => "def f(mand, opt = 42, &block)\n # do nothing\nend",
1559
- "RawParseTree" => [:defn, :f,
1560
- [:scope,
1561
- [:block,
1562
- [:args, :mand, :opt,
1563
- [:block,
1564
- [:lasgn, :opt, [:lit, 42]]]],
1565
- [:block_arg, :block],
1566
- [:nil]]]],
1567
1073
  "ParseTree" => s(:defn, :f,
1568
1074
  s(:args, :mand, :opt, :"&block",
1569
1075
  s(:block,
@@ -1572,13 +1078,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1572
1078
 
1573
1079
  add_tests("defn_args_mand_opt_splat",
1574
1080
  "Ruby" => "def f(mand, opt = 42, *rest)\n # do nothing\nend",
1575
- "RawParseTree" => [:defn, :f,
1576
- [:scope,
1577
- [:block,
1578
- [:args, :mand, :opt, :"*rest",
1579
- [:block,
1580
- [:lasgn, :opt, [:lit, 42]]]],
1581
- [:nil]]]],
1582
1081
  "ParseTree" => s(:defn, :f,
1583
1082
  s(:args, :mand, :opt, :"*rest",
1584
1083
  s(:block,
@@ -1587,14 +1086,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1587
1086
 
1588
1087
  add_tests("defn_args_mand_opt_splat_block",
1589
1088
  "Ruby" => "def f(mand, opt = 42, *rest, &block)\n # do nothing\nend",
1590
- "RawParseTree" => [:defn, :f,
1591
- [:scope,
1592
- [:block,
1593
- [:args, :mand, :opt, :"*rest",
1594
- [:block,
1595
- [:lasgn, :opt, [:lit, 42]]]],
1596
- [:block_arg, :block],
1597
- [:nil]]]],
1598
1089
  "ParseTree" => s(:defn, :f,
1599
1090
  s(:args, :mand, :opt, :"*rest", :"&block",
1600
1091
  s(:block,
@@ -1603,12 +1094,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1603
1094
 
1604
1095
  add_tests("defn_args_mand_opt_splat_no_name",
1605
1096
  "Ruby" => "def x(a, b = 42, *)\n # do nothing\nend",
1606
- "RawParseTree" => [:defn, :x,
1607
- [:scope,
1608
- [:block,
1609
- [:args, :a, :b, :"*",
1610
- [:block, [:lasgn, :b, [:lit, 42]]]],
1611
- [:nil]]]],
1612
1097
  "ParseTree" => s(:defn, :x,
1613
1098
  s(:args, :a, :b, :"*",
1614
1099
  s(:block, s(:lasgn, :b, s(:lit, 42)))),
@@ -1618,35 +1103,18 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1618
1103
 
1619
1104
  add_tests("defn_args_mand_splat",
1620
1105
  "Ruby" => "def f(mand, *rest)\n # do nothing\nend",
1621
- "RawParseTree" => [:defn, :f,
1622
- [:scope,
1623
- [:block,
1624
- [:args, :mand, :"*rest"],
1625
- [:nil]]]],
1626
1106
  "ParseTree" => s(:defn, :f,
1627
1107
  s(:args, :mand, :"*rest"),
1628
1108
  s(:scope, s(:block, s(:nil)))))
1629
1109
 
1630
1110
  add_tests("defn_args_mand_splat_block",
1631
1111
  "Ruby" => "def f(mand, *rest, &block)\n # do nothing\nend",
1632
- "RawParseTree" => [:defn, :f,
1633
- [:scope,
1634
- [:block,
1635
- [:args, :mand, :"*rest"],
1636
- [:block_arg, :block],
1637
- [:nil]]]],
1638
1112
  "ParseTree" => s(:defn, :f,
1639
1113
  s(:args, :mand, :"*rest", :"&block"),
1640
1114
  s(:scope, s(:block, s(:nil)))))
1641
1115
 
1642
1116
  add_tests("defn_args_mand_splat_no_name",
1643
1117
  "Ruby" => "def x(a, *args)\n p(a, args)\nend",
1644
- "RawParseTree" => [:defn, :x,
1645
- [:scope,
1646
- [:block,
1647
- [:args, :a, :"*args"],
1648
- [:fcall, :p,
1649
- [:array, [:lvar, :a], [:lvar, :args]]]]]],
1650
1118
  "ParseTree" => s(:defn, :x,
1651
1119
  s(:args, :a, :"*args"),
1652
1120
  s(:scope,
@@ -1656,21 +1124,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1656
1124
 
1657
1125
  add_tests("defn_args_none",
1658
1126
  "Ruby" => "def empty\n # do nothing\nend",
1659
- "RawParseTree" => [:defn, :empty,
1660
- [:scope, [:block, [:args], [:nil]]]],
1661
1127
  "ParseTree" => s(:defn, :empty,
1662
1128
  s(:args),
1663
1129
  s(:scope, s(:block, s(:nil)))))
1664
1130
 
1665
1131
  add_tests("defn_args_opt",
1666
1132
  "Ruby" => "def f(opt = 42)\n # do nothing\nend",
1667
- "RawParseTree" => [:defn, :f,
1668
- [:scope,
1669
- [:block,
1670
- [:args, :opt,
1671
- [:block,
1672
- [:lasgn, :opt, [:lit, 42]]]],
1673
- [:nil]]]],
1674
1133
  "ParseTree" => s(:defn, :f,
1675
1134
  s(:args, :opt,
1676
1135
  s(:block,
@@ -1679,14 +1138,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1679
1138
 
1680
1139
  add_tests("defn_args_opt_block",
1681
1140
  "Ruby" => "def f(opt = 42, &block)\n # do nothing\nend",
1682
- "RawParseTree" => [:defn, :f,
1683
- [:scope,
1684
- [:block,
1685
- [:args, :opt,
1686
- [:block,
1687
- [:lasgn, :opt, [:lit, 42]]]],
1688
- [:block_arg, :block],
1689
- [:nil]]]],
1690
1141
  "ParseTree" => s(:defn, :f,
1691
1142
  s(:args, :opt, :"&block",
1692
1143
  s(:block,
@@ -1695,13 +1146,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1695
1146
 
1696
1147
  add_tests("defn_args_opt_splat",
1697
1148
  "Ruby" => "def f(opt = 42, *rest)\n # do nothing\nend",
1698
- "RawParseTree" => [:defn, :f,
1699
- [:scope,
1700
- [:block,
1701
- [:args, :opt, :"*rest",
1702
- [:block,
1703
- [:lasgn, :opt, [:lit, 42]]]],
1704
- [:nil]]]],
1705
1149
  "ParseTree" => s(:defn, :f,
1706
1150
  s(:args, :opt, :"*rest",
1707
1151
  s(:block,
@@ -1710,14 +1154,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1710
1154
 
1711
1155
  add_tests("defn_args_opt_splat_block",
1712
1156
  "Ruby" => "def f(opt = 42, *rest, &block)\n # do nothing\nend",
1713
- "RawParseTree" => [:defn, :f,
1714
- [:scope,
1715
- [:block,
1716
- [:args, :opt, :"*rest",
1717
- [:block,
1718
- [:lasgn, :opt, [:lit, 42]]]],
1719
- [:block_arg, :block],
1720
- [:nil]]]],
1721
1157
  "ParseTree" => s(:defn, :f,
1722
1158
  s(:args, :opt, :"*rest", :"&block",
1723
1159
  s(:block,
@@ -1726,12 +1162,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1726
1162
 
1727
1163
  add_tests("defn_args_opt_splat_no_name",
1728
1164
  "Ruby" => "def x(b = 42, *)\n # do nothing\nend",
1729
- "RawParseTree" => [:defn, :x,
1730
- [:scope,
1731
- [:block,
1732
- [:args, :b, :"*",
1733
- [:block, [:lasgn, :b, [:lit, 42]]]],
1734
- [:nil]]]],
1735
1165
  "ParseTree" => s(:defn, :x,
1736
1166
  s(:args, :b, :"*",
1737
1167
  s(:block, s(:lasgn, :b, s(:lit, 42)))),
@@ -1741,22 +1171,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1741
1171
 
1742
1172
  add_tests("defn_args_splat",
1743
1173
  "Ruby" => "def f(*rest)\n # do nothing\nend",
1744
- "RawParseTree" => [:defn, :f,
1745
- [:scope,
1746
- [:block,
1747
- [:args, :"*rest"],
1748
- [:nil]]]],
1749
1174
  "ParseTree" => s(:defn, :f,
1750
1175
  s(:args, :"*rest"),
1751
1176
  s(:scope, s(:block, s(:nil)))))
1752
1177
 
1753
1178
  add_tests("defn_args_splat_no_name",
1754
1179
  "Ruby" => "def x(*)\n # do nothing\nend",
1755
- "RawParseTree" => [:defn, :x,
1756
- [:scope,
1757
- [:block,
1758
- [:args, :"*"],
1759
- [:nil]]]],
1760
1180
  "ParseTree" => s(:defn, :x,
1761
1181
  s(:args, :"*"),
1762
1182
  s(:scope,
@@ -1765,25 +1185,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1765
1185
 
1766
1186
  add_tests("defn_or",
1767
1187
  "Ruby" => "def |(o)\n # do nothing\nend",
1768
- "RawParseTree" => [:defn, :|,
1769
- [:scope, [:block, [:args, :o], [:nil]]]],
1770
1188
  "ParseTree" => s(:defn, :|,
1771
1189
  s(:args, :o),
1772
1190
  s(:scope, s(:block, s(:nil)))))
1773
1191
 
1774
1192
  add_tests("defn_rescue",
1775
1193
  "Ruby" => "def eql?(resource)\n (self.uuid == resource.uuid)\nrescue\n false\nend",
1776
- "RawParseTree" => [:defn, :eql?,
1777
- [:scope,
1778
- [:block,
1779
- [:args, :resource],
1780
- [:rescue,
1781
- [:call,
1782
- [:call, [:self], :uuid],
1783
- :==,
1784
- [:array,
1785
- [:call, [:lvar, :resource], :uuid]]],
1786
- [:resbody, nil, [:false]]]]]],
1787
1194
  "ParseTree" => s(:defn, :eql?,
1788
1195
  s(:args, :resource),
1789
1196
  s(:scope,
@@ -1800,17 +1207,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1800
1207
 
1801
1208
  add_tests("defn_rescue_mri_verbose_flag",
1802
1209
  "Ruby" => "def eql?(resource)\n (self.uuid == resource.uuid)\nrescue\n false\nend",
1803
- "RawParseTree" => [:defn, :eql?,
1804
- [:scope,
1805
- [:block,
1806
- [:args, :resource],
1807
- [:rescue,
1808
- [:call,
1809
- [:call, [:self], :uuid],
1810
- :==,
1811
- [:array,
1812
- [:call, [:lvar, :resource], :uuid]]],
1813
- [:resbody, nil, [:false]]]]]],
1814
1210
  "ParseTree" => s(:defn, :eql?,
1815
1211
  s(:args, :resource),
1816
1212
  s(:scope,
@@ -1827,20 +1223,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1827
1223
 
1828
1224
  add_tests("defn_something_eh",
1829
1225
  "Ruby" => "def something?\n # do nothing\nend",
1830
- "RawParseTree" => [:defn, :something?,
1831
- [:scope, [:block, [:args], [:nil]]]],
1832
1226
  "ParseTree" => s(:defn, :something?,
1833
1227
  s(:args),
1834
1228
  s(:scope, s(:block, s(:nil)))))
1835
1229
 
1836
1230
  add_tests("defn_splat_no_name",
1837
1231
  "Ruby" => "def x(a, *)\n p(a)\nend",
1838
- "RawParseTree" => [:defn, :x,
1839
- [:scope,
1840
- [:block,
1841
- [:args, :a, :"*"],
1842
- [:fcall, :p,
1843
- [:array, [:lvar, :a]]]]]],
1844
1232
  "ParseTree" => s(:defn, :x,
1845
1233
  s(:args, :a, :"*"),
1846
1234
  s(:scope,
@@ -1850,11 +1238,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1850
1238
 
1851
1239
  add_tests("defn_zarray",
1852
1240
  "Ruby" => "def zarray\n a = []\n return a\nend",
1853
- "RawParseTree" => [:defn, :zarray,
1854
- [:scope,
1855
- [:block, [:args],
1856
- [:lasgn, :a, [:zarray]],
1857
- [:return, [:lvar, :a]]]]],
1858
1241
  "ParseTree" => s(:defn, :zarray,
1859
1242
  s(:args),
1860
1243
  s(:scope,
@@ -1864,12 +1247,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1864
1247
 
1865
1248
  add_tests("defs",
1866
1249
  "Ruby" => "def self.x(y)\n (y + 1)\nend",
1867
- "RawParseTree" => [:defs, [:self], :x,
1868
- [:scope,
1869
- [:block,
1870
- [:args, :y],
1871
- [:call, [:lvar, :y], :+,
1872
- [:array, [:lit, 1]]]]]],
1873
1250
  "ParseTree" => s(:defs, s(:self), :x,
1874
1251
  s(:args, :y),
1875
1252
  s(:scope,
@@ -1879,26 +1256,18 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1879
1256
 
1880
1257
  add_tests("defs_empty",
1881
1258
  "Ruby" => "def self.empty\n # do nothing\nend",
1882
- "RawParseTree" => [:defs, [:self], :empty,
1883
- [:scope, [:args]]],
1884
1259
  "ParseTree" => s(:defs, s(:self), :empty,
1885
1260
  s(:args),
1886
1261
  s(:scope, s(:block))))
1887
1262
 
1888
1263
  add_tests("defs_empty_args",
1889
1264
  "Ruby" => "def self.empty(*)\n # do nothing\nend",
1890
- "RawParseTree" => [:defs, [:self], :empty,
1891
- [:scope, [:args, :*]]],
1892
1265
  "ParseTree" => s(:defs, s(:self), :empty,
1893
1266
  s(:args, :*),
1894
1267
  s(:scope, s(:block))))
1895
1268
 
1896
1269
  add_tests("defs_expr_wtf",
1897
1270
  "Ruby" => "def (a.b).empty(*)\n # do nothing\nend",
1898
- "RawParseTree" => [:defs,
1899
- [:call, [:vcall, :a], :b],
1900
- :empty,
1901
- [:scope, [:args, :*]]],
1902
1271
  "ParseTree" => s(:defs,
1903
1272
  s(:call,
1904
1273
  s(:call, nil, :a, s(:arglist)),
@@ -1909,14 +1278,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1909
1278
 
1910
1279
  add_tests("dmethod",
1911
1280
  "Ruby" => [Examples, :dmethod_added],
1912
- "RawParseTree" => [:defn, :dmethod_added,
1913
- [:dmethod,
1914
- :a_method,
1915
- [:scope,
1916
- [:block,
1917
- [:args, :x],
1918
- [:call, [:lvar, :x], :+,
1919
- [:array, [:lit, 1]]]]]]],
1920
1281
  "ParseTree" => s(:defn, :dmethod_added,
1921
1282
  s(:args, :x),
1922
1283
  s(:scope,
@@ -1927,24 +1288,18 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1927
1288
 
1928
1289
  add_tests("dot2",
1929
1290
  "Ruby" => "(a..b)",
1930
- "RawParseTree" => [:dot2, [:vcall, :a], [:vcall, :b]],
1931
1291
  "ParseTree" => s(:dot2,
1932
1292
  s(:call, nil, :a, s(:arglist)),
1933
1293
  s(:call, nil, :b, s(:arglist))))
1934
1294
 
1935
1295
  add_tests("dot3",
1936
1296
  "Ruby" => "(a...b)",
1937
- "RawParseTree" => [:dot3, [:vcall, :a], [:vcall, :b]],
1938
1297
  "ParseTree" => s(:dot3,
1939
1298
  s(:call, nil, :a, s(:arglist)),
1940
1299
  s(:call, nil, :b, s(:arglist))))
1941
1300
 
1942
1301
  add_tests("dregx",
1943
1302
  "Ruby" => "/x#\{(1 + 1)}y/",
1944
- "RawParseTree" => [:dregx, "x",
1945
- [:evstr,
1946
- [:call, [:lit, 1], :+, [:array, [:lit, 1]]]],
1947
- [:str, "y"]],
1948
1303
  "ParseTree" => s(:dregx, "x",
1949
1304
  s(:evstr,
1950
1305
  s(:call, s(:lit, 1), :+,
@@ -1953,26 +1308,19 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1953
1308
 
1954
1309
  add_tests("dregx_interp",
1955
1310
  "Ruby" => "/#\{@rakefile}/",
1956
- "RawParseTree" => [:dregx, '', [:evstr, [:ivar, :@rakefile]]],
1957
1311
  "ParseTree" => s(:dregx, '', s(:evstr, s(:ivar, :@rakefile))))
1958
1312
 
1959
1313
  add_tests("dregx_interp_empty",
1960
1314
  "Ruby" => "/a#\{}b/",
1961
- "RawParseTree" => [:dregx, 'a', [:evstr], [:str, "b"]],
1962
1315
  "ParseTree" => s(:dregx, 'a', s(:evstr), s(:str, "b")))
1963
1316
 
1964
1317
  add_tests("dregx_n",
1965
1318
  "Ruby" => '/#{1}/n',
1966
- "RawParseTree" => [:dregx, '', [:evstr, [:lit, 1]], /x/n.options],
1967
1319
  "ParseTree" => s(:dregx, '',
1968
1320
  s(:evstr, s(:lit, 1)), /x/n.options))
1969
1321
 
1970
1322
  add_tests("dregx_once",
1971
1323
  "Ruby" => "/x#\{(1 + 1)}y/o",
1972
- "RawParseTree" => [:dregx_once, "x",
1973
- [:evstr,
1974
- [:call, [:lit, 1], :+, [:array, [:lit, 1]]]],
1975
- [:str, "y"]],
1976
1324
  "ParseTree" => s(:dregx_once, "x",
1977
1325
  s(:evstr,
1978
1326
  s(:call, s(:lit, 1), :+,
@@ -1981,19 +1329,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
1981
1329
 
1982
1330
  add_tests("dregx_once_n_interp",
1983
1331
  "Ruby" => "/#\{IAC}#\{SB}/no",
1984
- "RawParseTree" => [:dregx_once, '',
1985
- [:evstr, [:const, :IAC]],
1986
- [:evstr, [:const, :SB]], /x/n.options],
1987
1332
  "ParseTree" => s(:dregx_once, '',
1988
1333
  s(:evstr, s(:const, :IAC)),
1989
1334
  s(:evstr, s(:const, :SB)), /x/n.options))
1990
1335
 
1991
1336
  add_tests("dstr",
1992
1337
  "Ruby" => "argl = 1\n\"x#\{argl}y\"\n",
1993
- "RawParseTree" => [:block,
1994
- [:lasgn, :argl, [:lit, 1]],
1995
- [:dstr, "x", [:evstr, [:lvar, :argl]],
1996
- [:str, "y"]]],
1997
1338
  "ParseTree" => s(:block,
1998
1339
  s(:lasgn, :argl, s(:lit, 1)),
1999
1340
  s(:dstr, "x", s(:evstr, s(:lvar, :argl)),
@@ -2001,14 +1342,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2001
1342
 
2002
1343
  add_tests("dstr_2",
2003
1344
  "Ruby" => "argl = 1\n\"x#\{(\"%.2f\" % 3.14159)}y\"\n",
2004
- "RawParseTree" => [:block,
2005
- [:lasgn, :argl, [:lit, 1]],
2006
- [:dstr,
2007
- "x",
2008
- [:evstr,
2009
- [:call, [:str, "%.2f"], :%,
2010
- [:array, [:lit, 3.14159]]]],
2011
- [:str, "y"]]],
2012
1345
  "ParseTree" => s(:block,
2013
1346
  s(:lasgn, :argl, s(:lit, 1)),
2014
1347
  s(:dstr,
@@ -2020,18 +1353,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2020
1353
 
2021
1354
  add_tests("dstr_3",
2022
1355
  "Ruby" => "max = 2\nargl = 1\n\"x#\{(\"%.#\{max}f\" % 3.14159)}y\"\n",
2023
- "RawParseTree" => [:block,
2024
- [:lasgn, :max, [:lit, 2]],
2025
- [:lasgn, :argl, [:lit, 1]],
2026
- [:dstr, "x",
2027
- [:evstr,
2028
- [:call,
2029
- [:dstr, "%.",
2030
- [:evstr, [:lvar, :max]],
2031
- [:str, "f"]],
2032
- :%,
2033
- [:array, [:lit, 3.14159]]]],
2034
- [:str, "y"]]],
2035
1356
  "ParseTree" => s(:block,
2036
1357
  s(:lasgn, :max, s(:lit, 2)),
2037
1358
  s(:lasgn, :argl, s(:lit, 1)),
@@ -2047,14 +1368,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2047
1368
 
2048
1369
  add_tests("dstr_concat",
2049
1370
  "Ruby" => '"#{22}aa" "cd#{44}" "55" "#{66}"',
2050
- "RawParseTree" => [:dstr,
2051
- "",
2052
- [:evstr, [:lit, 22]],
2053
- [:str, "aa"],
2054
- [:str, "cd"],
2055
- [:evstr, [:lit, 44]],
2056
- [:str, "55"],
2057
- [:evstr, [:lit, 66]]],
2058
1371
  "ParseTree" => s(:dstr,
2059
1372
  "",
2060
1373
  s(:evstr, s(:lit, 22)),
@@ -2067,13 +1380,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2067
1380
 
2068
1381
  add_tests("dstr_gross",
2069
1382
  "Ruby" => '"a #$global b #@ivar c #@@cvar d"',
2070
- "RawParseTree" => [:dstr, "a ",
2071
- [:evstr, [:gvar, :$global]],
2072
- [:str, " b "],
2073
- [:evstr, [:ivar, :@ivar]],
2074
- [:str, " c "],
2075
- [:evstr, [:cvar, :@@cvar]],
2076
- [:str, " d"]],
2077
1383
  "ParseTree" => s(:dstr, "a ",
2078
1384
  s(:evstr, s(:gvar, :$global)),
2079
1385
  s(:str, " b "),
@@ -2085,10 +1391,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2085
1391
 
2086
1392
  add_tests("dstr_heredoc_expand",
2087
1393
  "Ruby" => "<<EOM\n blah\n#\{1 + 1}blah\nEOM\n",
2088
- "RawParseTree" => [:dstr, " blah\n",
2089
- [:evstr, [:call, [:lit, 1], :+,
2090
- [:array, [:lit, 1]]]],
2091
- [:str, "blah\n"]],
2092
1394
  "ParseTree" => s(:dstr, " blah\n",
2093
1395
  s(:evstr, s(:call, s(:lit, 1), :+,
2094
1396
  s(:arglist, s(:lit, 1)))),
@@ -2097,10 +1399,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2097
1399
 
2098
1400
  add_tests("dstr_heredoc_windoze_sucks",
2099
1401
  "Ruby" => "<<-EOF\r\ndef test_#\{action}_valid_feed\r\n EOF\r\n",
2100
- "RawParseTree" => [:dstr,
2101
- 'def test_',
2102
- [:evstr, [:vcall, :action]],
2103
- [:str, "_valid_feed\n"]],
2104
1402
  "ParseTree" => s(:dstr,
2105
1403
  'def test_',
2106
1404
  s(:evstr, s(:call, nil, :action, s(:arglist))),
@@ -2109,11 +1407,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2109
1407
 
2110
1408
  add_tests("dstr_heredoc_yet_again",
2111
1409
  "Ruby" => "<<-EOF\ns1 '#\{RUBY_PLATFORM}' s2\n#\{__FILE__}\n EOF\n",
2112
- "RawParseTree" => [:dstr, "s1 '",
2113
- [:evstr, [:const, :RUBY_PLATFORM]],
2114
- [:str, "' s2\n"],
2115
- [:str, "(string)"],
2116
- [:str, "\n"]],
2117
1410
  "ParseTree" => s(:dstr, "s1 '",
2118
1411
  s(:evstr, s(:const, :RUBY_PLATFORM)),
2119
1412
  s(:str, "' s2\n"),
@@ -2123,8 +1416,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2123
1416
 
2124
1417
  add_tests("dstr_nest",
2125
1418
  "Ruby" => "%Q[before [#\{nest}] after]",
2126
- "RawParseTree" => [:dstr, "before [",
2127
- [:evstr, [:vcall, :nest]], [:str, "] after"]],
2128
1419
  "ParseTree" => s(:dstr, "before [",
2129
1420
  s(:evstr, s(:call, nil, :nest, s(:arglist))),
2130
1421
  s(:str, "] after")),
@@ -2132,14 +1423,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2132
1423
 
2133
1424
  add_tests("dstr_str_lit_start",
2134
1425
  "Ruby" => '"#{"blah"}#{__FILE__}:#{__LINE__}: warning: #{$!.message} (#{$!.class})"',
2135
- "RawParseTree" => [:dstr,
2136
- "blah(string):",
2137
- [:evstr, [:lit, 1]],
2138
- [:str, ": warning: "],
2139
- [:evstr, [:call, [:gvar, :$!], :message]],
2140
- [:str, " ("],
2141
- [:evstr, [:call, [:gvar, :$!], :class]],
2142
- [:str, ")"]],
2143
1426
  "ParseTree" => s(:dstr,
2144
1427
  "blah(string):",
2145
1428
  s(:evstr, s(:lit, 1)),
@@ -2154,16 +1437,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2154
1437
 
2155
1438
  add_tests("dstr_the_revenge",
2156
1439
  "Ruby" => '"before #{from} middle #{to} (#{__FILE__}:#{__LINE__})"',
2157
- "RawParseTree" => [:dstr,
2158
- "before ",
2159
- [:evstr, [:vcall, :from]],
2160
- [:str, " middle "],
2161
- [:evstr, [:vcall, :to]],
2162
- [:str, " ("],
2163
- [:str, "(string)"],
2164
- [:str, ":"],
2165
- [:evstr, [:lit, 1]],
2166
- [:str, ")"]],
2167
1440
  "ParseTree" => s(:dstr,
2168
1441
  "before ",
2169
1442
  s(:evstr, s(:call, nil, :from, s(:arglist))),
@@ -2178,37 +1451,18 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2178
1451
 
2179
1452
  add_tests("dsym",
2180
1453
  "Ruby" => ":\"x#\{(1 + 1)}y\"",
2181
- "RawParseTree" => [:dsym, "x",
2182
- [:evstr, [:call, [:lit, 1], :+,
2183
- [:array, [:lit, 1]]]], [:str, "y"]],
2184
1454
  "ParseTree" => s(:dsym, "x",
2185
1455
  s(:evstr, s(:call, s(:lit, 1), :+,
2186
1456
  s(:arglist, s(:lit, 1)))), s(:str, "y")))
2187
1457
 
2188
1458
  add_tests("dxstr",
2189
1459
  "Ruby" => "t = 5\n`touch #\{t}`\n",
2190
- "RawParseTree" => [:block,
2191
- [:lasgn, :t, [:lit, 5]],
2192
- [:dxstr, 'touch ', [:evstr, [:lvar, :t]]]],
2193
1460
  "ParseTree" => s(:block,
2194
1461
  s(:lasgn, :t, s(:lit, 5)),
2195
1462
  s(:dxstr, 'touch ', s(:evstr, s(:lvar, :t)))))
2196
1463
 
2197
1464
  add_tests("ensure",
2198
1465
  "Ruby" => "begin\n (1 + 1)\nrescue SyntaxError => e1\n 2\nrescue Exception => e2\n 3\nelse\n 4\nensure\n 5\nend",
2199
- "RawParseTree" => [:ensure,
2200
- [:rescue,
2201
- [:call, [:lit, 1], :+, [:array, [:lit, 1]]],
2202
- [:resbody,
2203
- [:array, [:const, :SyntaxError]],
2204
- [:block,
2205
- [:lasgn, :e1, [:gvar, :$!]], [:lit, 2]],
2206
- [:resbody,
2207
- [:array, [:const, :Exception]],
2208
- [:block,
2209
- [:lasgn, :e2, [:gvar, :$!]], [:lit, 3]]]],
2210
- [:lit, 4]],
2211
- [:lit, 5]],
2212
1466
  "ParseTree" => s(:ensure,
2213
1467
  s(:rescue,
2214
1468
  s(:call, s(:lit, 1), :+,
@@ -2228,18 +1482,10 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2228
1482
 
2229
1483
  add_tests("false",
2230
1484
  "Ruby" => "false",
2231
- "RawParseTree" => [:false],
2232
1485
  "ParseTree" => s(:false))
2233
1486
 
2234
1487
  add_tests("fbody",
2235
1488
  "Ruby" => [Examples, :an_alias],
2236
- "RawParseTree" => [:defn, :an_alias,
2237
- [:fbody,
2238
- [:scope,
2239
- [:block,
2240
- [:args, :x],
2241
- [:call, [:lvar, :x], :+,
2242
- [:array, [:lit, 1]]]]]]],
2243
1489
  "ParseTree" => s(:defn, :an_alias,
2244
1490
  s(:args, :x),
2245
1491
  s(:scope,
@@ -2250,16 +1496,10 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2250
1496
 
2251
1497
  add_tests("fcall_arglist",
2252
1498
  "Ruby" => "m(42)",
2253
- "RawParseTree" => [:fcall, :m, [:array, [:lit, 42]]],
2254
1499
  "ParseTree" => s(:call, nil, :m, s(:arglist, s(:lit, 42))))
2255
1500
 
2256
1501
  add_tests("fcall_arglist_hash",
2257
1502
  "Ruby" => "m(:a => 1, :b => 2)",
2258
- "RawParseTree" => [:fcall, :m,
2259
- [:array,
2260
- [:hash,
2261
- [:lit, :a], [:lit, 1],
2262
- [:lit, :b], [:lit, 2]]]],
2263
1503
  "ParseTree" => s(:call, nil, :m,
2264
1504
  s(:arglist,
2265
1505
  s(:hash,
@@ -2268,12 +1508,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2268
1508
 
2269
1509
  add_tests("fcall_arglist_norm_hash",
2270
1510
  "Ruby" => "m(42, :a => 1, :b => 2)",
2271
- "RawParseTree" => [:fcall, :m,
2272
- [:array,
2273
- [:lit, 42],
2274
- [:hash,
2275
- [:lit, :a], [:lit, 1],
2276
- [:lit, :b], [:lit, 2]]]],
2277
1511
  "ParseTree" => s(:call, nil, :m,
2278
1512
  s(:arglist,
2279
1513
  s(:lit, 42),
@@ -2283,14 +1517,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2283
1517
 
2284
1518
  add_tests("fcall_arglist_norm_hash_splat",
2285
1519
  "Ruby" => "m(42, :a => 1, :b => 2, *c)",
2286
- "RawParseTree" => [:fcall, :m,
2287
- [:argscat,
2288
- [:array,
2289
- [:lit, 42],
2290
- [:hash,
2291
- [:lit, :a], [:lit, 1],
2292
- [:lit, :b], [:lit, 2]]],
2293
- [:vcall, :c]]],
2294
1520
  "ParseTree" => s(:call, nil, :m,
2295
1521
  s(:arglist,
2296
1522
  s(:lit, 42),
@@ -2301,9 +1527,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2301
1527
 
2302
1528
  add_tests("fcall_block",
2303
1529
  "Ruby" => "a(:b) { :c }",
2304
- "RawParseTree" => [:iter,
2305
- [:fcall, :a, [:array, [:lit, :b]]], nil,
2306
- [:lit, :c]],
2307
1530
  "ParseTree" => s(:iter,
2308
1531
  s(:call, nil, :a,
2309
1532
  s(:arglist, s(:lit, :b))), nil,
@@ -2311,43 +1534,28 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2311
1534
 
2312
1535
  add_tests("fcall_index_space",
2313
1536
  "Ruby" => "a [42]",
2314
- "RawParseTree" => [:fcall, :a, [:array, [:array, [:lit, 42]]]],
2315
1537
  "ParseTree" => s(:call, nil, :a,
2316
1538
  s(:arglist, s(:array, s(:lit, 42)))),
2317
1539
  "Ruby2Ruby" => "a([42])")
2318
1540
 
2319
1541
  add_tests("fcall_keyword",
2320
1542
  "Ruby" => "42 if block_given?",
2321
- "RawParseTree" => [:if, [:fcall, :block_given?], [:lit, 42], nil],
2322
1543
  "ParseTree" => s(:if,
2323
1544
  s(:call, nil, :block_given?, s(:arglist)),
2324
1545
  s(:lit, 42), nil))
2325
1546
 
2326
1547
  add_tests("fcall_inside_parens",
2327
- "Ruby" => "( c (d), e)",
1548
+ "Ruby" => "( a (b), c)",
2328
1549
  "ParseTree" => s(:call,
2329
- nil,
2330
- :c,
2331
- s(:arglist, s(:call, nil, :d, s(:arglist)), s(:call, nil, :e, s(:arglist)))))
1550
+ nil,
1551
+ :a,
1552
+ s(:arglist,
1553
+ s(:call, nil, :b, s(:arglist)),
1554
+ s(:call, nil, :c, s(:arglist)))),
1555
+ "Ruby2Ruby" => "a(b, c)")
2332
1556
 
2333
1557
  add_tests("flip2",
2334
1558
  "Ruby" => "x = if ((i % 4) == 0)..((i % 3) == 0) then\n i\nelse\n nil\nend",
2335
- "RawParseTree" => [:lasgn,
2336
- :x,
2337
- [:if,
2338
- [:flip2,
2339
- [:call,
2340
- [:call, [:vcall, :i], :%,
2341
- [:array, [:lit, 4]]],
2342
- :==,
2343
- [:array, [:lit, 0]]],
2344
- [:call,
2345
- [:call, [:vcall, :i], :%,
2346
- [:array, [:lit, 3]]],
2347
- :==,
2348
- [:array, [:lit, 0]]]],
2349
- [:vcall, :i],
2350
- [:nil]]],
2351
1559
  "ParseTree" => s(:lasgn,
2352
1560
  :x,
2353
1561
  s(:if,
@@ -2369,14 +1577,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2369
1577
 
2370
1578
  add_tests("flip2_method",
2371
1579
  "Ruby" => "if 1..2.a?(b) then\n nil\nend",
2372
- "RawParseTree" => [:if,
2373
- [:flip2,
2374
- [:call, [:lit, 1], :==,
2375
- [:array, [:gvar, :$.]]],
2376
- [:call, [:lit, 2], :a?,
2377
- [:array, [:vcall, :b]]]],
2378
- [:nil],
2379
- nil],
2380
1580
  "ParseTree" => s(:if,
2381
1581
  s(:flip2,
2382
1582
  s(:lit, 1),
@@ -2388,22 +1588,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2388
1588
 
2389
1589
  add_tests("flip3",
2390
1590
  "Ruby" => "x = if ((i % 4) == 0)...((i % 3) == 0) then\n i\nelse\n nil\nend",
2391
- "RawParseTree" => [:lasgn,
2392
- :x,
2393
- [:if,
2394
- [:flip3,
2395
- [:call,
2396
- [:call, [:vcall, :i], :%,
2397
- [:array, [:lit, 4]]],
2398
- :==,
2399
- [:array, [:lit, 0]]],
2400
- [:call,
2401
- [:call, [:vcall, :i], :%,
2402
- [:array, [:lit, 3]]],
2403
- :==,
2404
- [:array, [:lit, 0]]]],
2405
- [:vcall, :i],
2406
- [:nil]]],
2407
1591
  "ParseTree" => s(:lasgn,
2408
1592
  :x,
2409
1593
  s(:if,
@@ -2425,10 +1609,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2425
1609
 
2426
1610
  add_tests("for",
2427
1611
  "Ruby" => "for o in ary do\n puts(o)\nend",
2428
- "RawParseTree" => [:for,
2429
- [:vcall, :ary],
2430
- [:lasgn, :o],
2431
- [:fcall, :puts, [:array, [:lvar, :o]]]],
2432
1612
  "ParseTree" => s(:for,
2433
1613
  s(:call, nil, :ary, s(:arglist)),
2434
1614
  s(:lasgn, :o),
@@ -2437,9 +1617,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2437
1617
 
2438
1618
  add_tests("for_no_body",
2439
1619
  "Ruby" => "for i in (0..max) do\n # do nothing\nend",
2440
- "RawParseTree" => [:for,
2441
- [:dot2, [:lit, 0], [:vcall, :max]],
2442
- [:lasgn, :i]],
2443
1620
  "ParseTree" => s(:for,
2444
1621
  s(:dot2,
2445
1622
  s(:lit, 0),
@@ -2448,45 +1625,32 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2448
1625
 
2449
1626
  add_tests("gasgn",
2450
1627
  "Ruby" => "$x = 42",
2451
- "RawParseTree" => [:gasgn, :$x, [:lit, 42]],
2452
1628
  "ParseTree" => s(:gasgn, :$x, s(:lit, 42)))
2453
1629
 
2454
1630
  add_tests("global",
2455
1631
  "Ruby" => "$stderr",
2456
- "RawParseTree" => [:gvar, :$stderr],
2457
1632
  "ParseTree" => s(:gvar, :$stderr))
2458
1633
 
2459
1634
  add_tests("gvar",
2460
1635
  "Ruby" => "$x",
2461
- "RawParseTree" => [:gvar, :$x],
2462
1636
  "ParseTree" => s(:gvar, :$x))
2463
1637
 
2464
1638
  add_tests("gvar_underscore",
2465
1639
  "Ruby" => "$_",
2466
- "RawParseTree" => [:gvar, :$_],
2467
1640
  "ParseTree" => s(:gvar, :$_))
2468
1641
 
2469
1642
  add_tests("gvar_underscore_blah",
2470
1643
  "Ruby" => "$__blah",
2471
- "RawParseTree" => [:gvar, :$__blah],
2472
1644
  "ParseTree" => s(:gvar, :$__blah))
2473
1645
 
2474
1646
  add_tests("hash",
2475
1647
  "Ruby" => "{ 1 => 2, 3 => 4 }",
2476
- "RawParseTree" => [:hash,
2477
- [:lit, 1], [:lit, 2],
2478
- [:lit, 3], [:lit, 4]],
2479
1648
  "ParseTree" => s(:hash,
2480
1649
  s(:lit, 1), s(:lit, 2),
2481
1650
  s(:lit, 3), s(:lit, 4)))
2482
1651
 
2483
1652
  add_tests("hash_rescue",
2484
1653
  "Ruby" => "{ 1 => (2 rescue 3) }",
2485
- "RawParseTree" => [:hash,
2486
- [:lit, 1],
2487
- [:rescue,
2488
- [:lit, 2],
2489
- [:resbody, nil, [:lit, 3]]]],
2490
1654
  "ParseTree" => s(:hash,
2491
1655
  s(:lit, 1),
2492
1656
  s(:rescue,
@@ -2495,20 +1659,10 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2495
1659
 
2496
1660
  add_tests("iasgn",
2497
1661
  "Ruby" => "@a = 4",
2498
- "RawParseTree" => [:iasgn, :@a, [:lit, 4]],
2499
1662
  "ParseTree" => s(:iasgn, :@a, s(:lit, 4)))
2500
1663
 
2501
1664
  add_tests("if_block_condition",
2502
1665
  "Ruby" => "if (x = 5\n(x + 1)) then\n nil\nend",
2503
- "RawParseTree" => [:if,
2504
- [:block,
2505
- [:lasgn, :x, [:lit, 5]],
2506
- [:call,
2507
- [:lvar, :x],
2508
- :+,
2509
- [:array, [:lit, 1]]]],
2510
- [:nil],
2511
- nil],
2512
1666
  "ParseTree" => s(:if,
2513
1667
  s(:block,
2514
1668
  s(:lasgn, :x, s(:lit, 5)),
@@ -2521,12 +1675,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2521
1675
 
2522
1676
  add_tests("if_lasgn_short",
2523
1677
  "Ruby" => "if x = obj.x then\n x.do_it\nend",
2524
- "RawParseTree" => [:if,
2525
- [:lasgn, :x,
2526
- [:call, [:vcall, :obj], :x]],
2527
- [:call,
2528
- [:lvar, :x], :do_it],
2529
- nil],
2530
1678
  "ParseTree" => s(:if,
2531
1679
  s(:lasgn, :x,
2532
1680
  s(:call,
@@ -2537,44 +1685,34 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2537
1685
 
2538
1686
  add_tests("if_nested",
2539
1687
  "Ruby" => "return if false unless true",
2540
- "RawParseTree" => [:if, [:true], nil,
2541
- [:if, [:false], [:return], nil]],
2542
1688
  "ParseTree" => s(:if, s(:true), nil,
2543
1689
  s(:if, s(:false), s(:return), nil)))
2544
1690
 
2545
1691
  add_tests("if_post",
2546
1692
  "Ruby" => "a if b",
2547
- "RawParseTree" => [:if, [:vcall, :b], [:vcall, :a], nil],
2548
1693
  "ParseTree" => s(:if, s(:call, nil, :b, s(:arglist)),
2549
1694
  s(:call, nil, :a, s(:arglist)), nil))
2550
1695
 
2551
1696
  add_tests("if_post_not",
2552
1697
  "Ruby" => "a if not b",
2553
- "RawParseTree" => [:if, [:vcall, :b], nil, [:vcall, :a]],
2554
1698
  "ParseTree" => s(:if, s(:call, nil, :b, s(:arglist)), nil,
2555
1699
  s(:call, nil, :a, s(:arglist))),
2556
1700
  "Ruby2Ruby" => "a unless b")
2557
1701
 
2558
1702
  add_tests("if_pre",
2559
1703
  "Ruby" => "if b then a end",
2560
- "RawParseTree" => [:if, [:vcall, :b], [:vcall, :a], nil],
2561
1704
  "ParseTree" => s(:if, s(:call, nil, :b, s(:arglist)),
2562
1705
  s(:call, nil, :a, s(:arglist)), nil),
2563
1706
  "Ruby2Ruby" => "a if b")
2564
1707
 
2565
1708
  add_tests("if_pre_not",
2566
1709
  "Ruby" => "if not b then a end",
2567
- "RawParseTree" => [:if, [:vcall, :b], nil, [:vcall, :a]],
2568
1710
  "ParseTree" => s(:if, s(:call, nil, :b, s(:arglist)), nil,
2569
1711
  s(:call, nil, :a, s(:arglist))),
2570
1712
  "Ruby2Ruby" => "a unless b")
2571
1713
 
2572
1714
  add_tests("iter_call_arglist_space",
2573
1715
  "Ruby" => "a (1) {|c|d}",
2574
- "RawParseTree" => [:iter,
2575
- [:fcall, :a, [:array, [:lit, 1]]],
2576
- [:dasgn_curr, :c],
2577
- [:vcall, :d]],
2578
1716
  "ParseTree" => s(:iter,
2579
1717
  s(:call, nil, :a, s(:arglist, s(:lit, 1))),
2580
1718
  s(:lasgn, :c),
@@ -2583,17 +1721,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2583
1721
 
2584
1722
  add_tests("iter_dasgn_curr_dasgn_madness",
2585
1723
  "Ruby" => "as.each { |a|\n b += a.b(false) }",
2586
- "RawParseTree" => [:iter,
2587
- [:call, [:vcall, :as], :each],
2588
- [:dasgn_curr, :a],
2589
- [:dasgn_curr,
2590
- :b,
2591
- [:call,
2592
- [:dvar, :b],
2593
- :+,
2594
- [:array,
2595
- [:call, [:dvar, :a], :b,
2596
- [:array, [:false]]]]]]],
2597
1724
  "ParseTree" => s(:iter,
2598
1725
  s(:call,
2599
1726
  s(:call, nil, :as, s(:arglist)),
@@ -2610,11 +1737,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2610
1737
 
2611
1738
  add_tests("iter_downto",
2612
1739
  "Ruby" => "3.downto(1) { |n| puts(n.to_s) }",
2613
- "RawParseTree" => [:iter,
2614
- [:call, [:lit, 3], :downto, [:array, [:lit, 1]]],
2615
- [:dasgn_curr, :n],
2616
- [:fcall, :puts,
2617
- [:array, [:call, [:dvar, :n], :to_s]]]],
2618
1740
  "ParseTree" => s(:iter,
2619
1741
  s(:call, s(:lit, 3), :downto,
2620
1742
  s(:arglist, s(:lit, 1))),
@@ -2626,14 +1748,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2626
1748
 
2627
1749
  add_tests("iter_each_lvar",
2628
1750
  "Ruby" => "array = [1, 2, 3]\narray.each { |x| puts(x.to_s) }\n",
2629
- "RawParseTree" => [:block,
2630
- [:lasgn, :array,
2631
- [:array, [:lit, 1], [:lit, 2], [:lit, 3]]],
2632
- [:iter,
2633
- [:call, [:lvar, :array], :each],
2634
- [:dasgn_curr, :x],
2635
- [:fcall, :puts,
2636
- [:array, [:call, [:dvar, :x], :to_s]]]]],
2637
1751
  "ParseTree" => s(:block,
2638
1752
  s(:lasgn, :array,
2639
1753
  s(:array,
@@ -2648,25 +1762,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2648
1762
 
2649
1763
  add_tests("iter_each_nested",
2650
1764
  "Ruby" => "array1 = [1, 2, 3]\narray2 = [4, 5, 6, 7]\narray1.each do |x|\n array2.each do |y|\n puts(x.to_s)\n puts(y.to_s)\n end\nend\n",
2651
- "RawParseTree" => [:block,
2652
- [:lasgn, :array1,
2653
- [:array, [:lit, 1], [:lit, 2], [:lit, 3]]],
2654
- [:lasgn, :array2,
2655
- [:array,
2656
- [:lit, 4], [:lit, 5], [:lit, 6], [:lit, 7]]],
2657
- [:iter,
2658
- [:call,
2659
- [:lvar, :array1], :each],
2660
- [:dasgn_curr, :x],
2661
- [:iter,
2662
- [:call,
2663
- [:lvar, :array2], :each],
2664
- [:dasgn_curr, :y],
2665
- [:block,
2666
- [:fcall, :puts,
2667
- [:array, [:call, [:dvar, :x], :to_s]]],
2668
- [:fcall, :puts,
2669
- [:array, [:call, [:dvar, :y], :to_s]]]]]]],
2670
1765
  "ParseTree" => s(:block,
2671
1766
  s(:lasgn, :array1,
2672
1767
  s(:array,
@@ -2695,17 +1790,10 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2695
1790
 
2696
1791
  add_tests("iter_loop_empty",
2697
1792
  "Ruby" => "loop { }",
2698
- "RawParseTree" => [:iter, [:fcall, :loop], nil],
2699
1793
  "ParseTree" => s(:iter, s(:call, nil, :loop, s(:arglist)), nil))
2700
1794
 
2701
1795
  add_tests("iter_masgn_2",
2702
1796
  "Ruby" => "a { |b, c| p(c) }",
2703
- "RawParseTree" => [:iter,
2704
- [:fcall, :a],
2705
- [:masgn,
2706
- [:array, [:dasgn_curr, :b], [:dasgn_curr, :c]],
2707
- nil, nil],
2708
- [:fcall, :p, [:array, [:dvar, :c]]]],
2709
1797
  "ParseTree" => s(:iter,
2710
1798
  s(:call, nil, :a, s(:arglist)),
2711
1799
  s(:masgn,
@@ -2714,12 +1802,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2714
1802
 
2715
1803
  add_tests("iter_masgn_args_splat",
2716
1804
  "Ruby" => "a { |b, c, *d| p(c) }",
2717
- "RawParseTree" => [:iter,
2718
- [:fcall, :a],
2719
- [:masgn,
2720
- [:array, [:dasgn_curr, :b], [:dasgn_curr, :c]],
2721
- [:dasgn_curr, :d], nil],
2722
- [:fcall, :p, [:array, [:dvar, :c]]]],
2723
1805
  "ParseTree" => s(:iter,
2724
1806
  s(:call, nil, :a, s(:arglist)),
2725
1807
  s(:masgn,
@@ -2731,12 +1813,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2731
1813
 
2732
1814
  add_tests("iter_masgn_args_splat_no_name",
2733
1815
  "Ruby" => "a { |b, c, *| p(c) }",
2734
- "RawParseTree" => [:iter,
2735
- [:fcall, :a],
2736
- [:masgn,
2737
- [:array, [:dasgn_curr, :b], [:dasgn_curr, :c]],
2738
- [:splat], nil],
2739
- [:fcall, :p, [:array, [:dvar, :c]]]],
2740
1816
  "ParseTree" => s(:iter,
2741
1817
  s(:call, nil, :a, s(:arglist)),
2742
1818
  s(:masgn,
@@ -2748,10 +1824,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2748
1824
 
2749
1825
  add_tests("iter_masgn_splat",
2750
1826
  "Ruby" => "a { |*c| p(c) }",
2751
- "RawParseTree" => [:iter,
2752
- [:fcall, :a],
2753
- [:masgn, nil, [:dasgn_curr, :c], nil],
2754
- [:fcall, :p, [:array, [:dvar, :c]]]],
2755
1827
  "ParseTree" => s(:iter,
2756
1828
  s(:call, nil, :a, s(:arglist)),
2757
1829
  s(:masgn, s(:array, s(:splat, s(:lasgn, :c)))),
@@ -2759,10 +1831,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2759
1831
 
2760
1832
  add_tests("iter_masgn_splat_no_name",
2761
1833
  "Ruby" => "a { |*| p(c) }",
2762
- "RawParseTree" => [:iter,
2763
- [:fcall, :a],
2764
- [:masgn, nil, [:splat], nil],
2765
- [:fcall, :p, [:array, [:vcall, :c]]]],
2766
1834
  "ParseTree" => s(:iter,
2767
1835
  s(:call, nil, :a, s(:arglist)),
2768
1836
  s(:masgn, s(:array, s(:splat))),
@@ -2771,13 +1839,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2771
1839
 
2772
1840
  add_tests("iter_shadowed_var",
2773
1841
  "Ruby" => "a do |x|\n b do |x|\n puts x\n end\nend",
2774
- "RawParseTree" => [:iter,
2775
- [:fcall, :a],
2776
- [:dasgn_curr, :x],
2777
- [:iter,
2778
- [:fcall, :b],
2779
- [:dasgn, :x],
2780
- [:fcall, :puts, [:array, [:dvar, :x]]]]],
2781
1842
  "ParseTree" => s(:iter,
2782
1843
  s(:call, nil, :a, s(:arglist)),
2783
1844
  s(:lasgn, :x),
@@ -2790,11 +1851,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2790
1851
 
2791
1852
  add_tests("iter_upto",
2792
1853
  "Ruby" => "1.upto(3) { |n| puts(n.to_s) }",
2793
- "RawParseTree" => [:iter,
2794
- [:call, [:lit, 1], :upto, [:array, [:lit, 3]]],
2795
- [:dasgn_curr, :n],
2796
- [:fcall, :puts,
2797
- [:array, [:call, [:dvar, :n], :to_s]]]],
2798
1854
  "ParseTree" => s(:iter,
2799
1855
  s(:call, s(:lit, 1), :upto,
2800
1856
  s(:arglist, s(:lit, 3))),
@@ -2806,17 +1862,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2806
1862
 
2807
1863
  add_tests("iter_while",
2808
1864
  "Ruby" => "argl = 10\nwhile (argl >= 1) do\n puts(\"hello\")\n argl = (argl - 1)\nend\n",
2809
- "RawParseTree" => [:block,
2810
- [:lasgn, :argl, [:lit, 10]],
2811
- [:while,
2812
- [:call, [:lvar, :argl], :">=",
2813
- [:array, [:lit, 1]]],
2814
- [:block,
2815
- [:fcall, :puts, [:array, [:str, "hello"]]],
2816
- [:lasgn,
2817
- :argl,
2818
- [:call, [:lvar, :argl],
2819
- :"-", [:array, [:lit, 1]]]]], true]],
2820
1865
  "ParseTree" => s(:block,
2821
1866
  s(:lasgn, :argl, s(:lit, 10)),
2822
1867
  s(:while,
@@ -2832,7 +1877,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2832
1877
 
2833
1878
  add_tests("ivar",
2834
1879
  "Ruby" => [Examples, :reader],
2835
- "RawParseTree" => [:defn, :reader, [:ivar, :@reader]],
2836
1880
  "ParseTree" => s(:defn, :reader, # FIX should be unified?
2837
1881
  s(:args),
2838
1882
  s(:ivar, :@reader)),
@@ -2840,10 +1884,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2840
1884
 
2841
1885
  add_tests("lasgn_array",
2842
1886
  "Ruby" => "var = [\"foo\", \"bar\"]",
2843
- "RawParseTree" => [:lasgn, :var,
2844
- [:array,
2845
- [:str, "foo"],
2846
- [:str, "bar"]]],
2847
1887
  "ParseTree" => s(:lasgn, :var,
2848
1888
  s(:array,
2849
1889
  s(:str, "foo"),
@@ -2851,44 +1891,35 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2851
1891
 
2852
1892
  add_tests("lasgn_call",
2853
1893
  "Ruby" => "c = (2 + 3)",
2854
- "RawParseTree" => [:lasgn, :c, [:call, [:lit, 2], :+,
2855
- [:array, [:lit, 3]]]],
2856
1894
  "ParseTree" => s(:lasgn, :c, s(:call, s(:lit, 2), :+,
2857
1895
  s(:arglist, s(:lit, 3)))))
2858
1896
 
2859
1897
  add_tests("lit_bool_false",
2860
1898
  "Ruby" => "false",
2861
- "RawParseTree" => [:false],
2862
1899
  "ParseTree" => s(:false))
2863
1900
 
2864
1901
  add_tests("lit_bool_true",
2865
1902
  "Ruby" => "true",
2866
- "RawParseTree" => [:true],
2867
1903
  "ParseTree" => s(:true))
2868
1904
 
2869
1905
  add_tests("lit_float",
2870
1906
  "Ruby" => "1.1",
2871
- "RawParseTree" => [:lit, 1.1],
2872
1907
  "ParseTree" => s(:lit, 1.1))
2873
1908
 
2874
1909
  add_tests("lit_long",
2875
1910
  "Ruby" => "1",
2876
- "RawParseTree" => [:lit, 1],
2877
1911
  "ParseTree" => s(:lit, 1))
2878
1912
 
2879
1913
  add_tests("lit_long_negative",
2880
1914
  "Ruby" => "-1",
2881
- "RawParseTree" => [:lit, -1],
2882
1915
  "ParseTree" => s(:lit, -1))
2883
1916
 
2884
1917
  add_tests("lit_range2",
2885
1918
  "Ruby" => "(1..10)",
2886
- "RawParseTree" => [:lit, 1..10],
2887
1919
  "ParseTree" => s(:lit, 1..10))
2888
1920
 
2889
1921
  add_tests("lit_range3",
2890
1922
  "Ruby" => "(1...10)",
2891
- "RawParseTree" => [:lit, 1...10],
2892
1923
  "ParseTree" => s(:lit, 1...10))
2893
1924
 
2894
1925
  # TODO: discuss and decide which lit we like
@@ -2900,57 +1931,33 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2900
1931
 
2901
1932
  add_tests("lit_regexp",
2902
1933
  "Ruby" => "/x/",
2903
- "RawParseTree" => [:lit, /x/],
2904
1934
  "ParseTree" => s(:lit, /x/))
2905
1935
 
2906
1936
  add_tests("lit_regexp_i_wwtt",
2907
1937
  "Ruby" => 'str.split(//i)',
2908
- "RawParseTree" => [:call, [:vcall, :str], :split,
2909
- [:array, [:lit, //i]]],
2910
1938
  "ParseTree" => s(:call, s(:call, nil, :str, s(:arglist)), :split,
2911
1939
  s(:arglist, s(:lit, //i))))
2912
1940
 
2913
1941
  add_tests("lit_regexp_n",
2914
1942
  "Ruby" => "/x/n", # HACK differs on 1.9 - this is easiest
2915
- "RawParseTree" => [:lit, /x/n],
2916
1943
  "ParseTree" => s(:lit, /x/n),
2917
1944
  "Ruby2Ruby" => /x/n.inspect)
2918
1945
 
2919
1946
  add_tests("lit_regexp_once",
2920
1947
  "Ruby" => "/x/o",
2921
- "RawParseTree" => [:lit, /x/],
2922
1948
  "ParseTree" => s(:lit, /x/),
2923
1949
  "Ruby2Ruby" => "/x/")
2924
1950
 
2925
1951
  add_tests("lit_sym",
2926
1952
  "Ruby" => ":x",
2927
- "RawParseTree" => [:lit, :x],
2928
1953
  "ParseTree" => s(:lit, :x))
2929
1954
 
2930
1955
  add_tests("lit_sym_splat",
2931
1956
  "Ruby" => ":\"*args\"",
2932
- "RawParseTree" => [:lit, :"*args"],
2933
1957
  "ParseTree" => s(:lit, :"*args"))
2934
1958
 
2935
1959
  add_tests("lvar_def_boundary",
2936
1960
  "Ruby" => "b = 42\ndef a\n c do\n begin\n do_stuff\n rescue RuntimeError => b\n puts(b)\n end\n end\nend\n",
2937
- "RawParseTree" => [:block,
2938
- [:lasgn, :b, [:lit, 42]],
2939
- [:defn, :a,
2940
- [:scope,
2941
- [:block,
2942
- [:args],
2943
- [:iter,
2944
- [:fcall, :c],
2945
- nil,
2946
- [:rescue,
2947
- [:vcall, :do_stuff],
2948
- [:resbody,
2949
- [:array, [:const, :RuntimeError]],
2950
- [:block,
2951
- [:dasgn_curr, :b, [:gvar, :$!]],
2952
- [:fcall, :puts,
2953
- [:array, [:dvar, :b]]]]]]]]]]],
2954
1961
  "ParseTree" => s(:block,
2955
1962
  s(:lasgn, :b, s(:lit, 42)),
2956
1963
  s(:defn, :a,
@@ -2972,9 +1979,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2972
1979
 
2973
1980
  add_tests("masgn",
2974
1981
  "Ruby" => "a, b = c, d",
2975
- "RawParseTree" => [:masgn,
2976
- [:array, [:lasgn, :a], [:lasgn, :b]], nil,
2977
- [:array, [:vcall, :c], [:vcall, :d]]],
2978
1982
  "ParseTree" => s(:masgn,
2979
1983
  s(:array, s(:lasgn, :a), s(:lasgn, :b)),
2980
1984
  s(:array, s(:call, nil, :c, s(:arglist)),
@@ -2982,12 +1986,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
2982
1986
 
2983
1987
  add_tests("masgn_argscat",
2984
1988
  "Ruby" => "a, b, *c = 1, 2, *[3, 4]",
2985
- "RawParseTree" => [:masgn,
2986
- [:array, [:lasgn, :a], [:lasgn, :b]],
2987
- [:lasgn, :c],
2988
- [:argscat,
2989
- [:array, [:lit, 1], [:lit, 2]],
2990
- [:array, [:lit, 3], [:lit, 4]]]],
2991
1989
  "ParseTree" => s(:masgn,
2992
1990
  s(:array,
2993
1991
  s(:lasgn, :a),
@@ -3000,10 +1998,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3000
1998
 
3001
1999
  add_tests("masgn_attrasgn",
3002
2000
  "Ruby" => "a, b.c = d, e",
3003
- "RawParseTree" => [:masgn,
3004
- [:array, [:lasgn, :a],
3005
- [:attrasgn, [:vcall, :b], :c=]], nil,
3006
- [:array, [:vcall, :d], [:vcall, :e]]],
3007
2001
  "ParseTree" => s(:masgn,
3008
2002
  s(:array,
3009
2003
  s(:lasgn, :a),
@@ -3016,12 +2010,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3016
2010
 
3017
2011
  add_tests("masgn_attrasgn_array_rhs",
3018
2012
  "Ruby" => "a.b, a.c, _ = q",
3019
- "RawParseTree" => [:masgn,
3020
- [:array,
3021
- [:attrasgn, [:vcall, :a], :b=],
3022
- [:attrasgn, [:vcall, :a], :c=],
3023
- [:lasgn, :_]], nil,
3024
- [:to_ary, [:vcall, :q]]],
3025
2013
  "ParseTree" => s(:masgn,
3026
2014
  s(:array,
3027
2015
  s(:attrasgn,
@@ -3036,23 +2024,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3036
2024
 
3037
2025
  add_tests("masgn_attrasgn_idx",
3038
2026
  "Ruby" => "a, i, j = [], 1, 2\na[i], a[j] = a[j], a[i]\n",
3039
- "RawParseTree" => [:block,
3040
- [:masgn,
3041
- [:array,
3042
- [:lasgn, :a], [:lasgn, :i], [:lasgn, :j]], nil,
3043
- [:array, [:zarray], [:lit, 1], [:lit, 2]]],
3044
- [:masgn,
3045
- [:array,
3046
- [:attrasgn,
3047
- [:lvar, :a], :[]=, [:array, [:lvar, :i]]],
3048
- [:attrasgn,
3049
- [:lvar, :a], :[]=, [:array, [:lvar, :j]]]],
3050
- nil,
3051
- [:array,
3052
- [:call, [:lvar, :a], :[],
3053
- [:array, [:lvar, :j]]],
3054
- [:call, [:lvar, :a], :[],
3055
- [:array, [:lvar, :i]]]]]],
3056
2027
  "ParseTree" => s(:block,
3057
2028
  s(:masgn,
3058
2029
  s(:array,
@@ -3073,10 +2044,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3073
2044
 
3074
2045
  add_tests("masgn_cdecl",
3075
2046
  "Ruby" => "A, B, C = 1, 2, 3",
3076
- "RawParseTree" => [:masgn,
3077
- [:array, [:cdecl, :A], [:cdecl, :B],
3078
- [:cdecl, :C]], nil,
3079
- [:array, [:lit, 1], [:lit, 2], [:lit, 3]]],
3080
2047
  "ParseTree" => s(:masgn,
3081
2048
  s(:array, s(:cdecl, :A), s(:cdecl, :B),
3082
2049
  s(:cdecl, :C)),
@@ -3085,9 +2052,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3085
2052
 
3086
2053
  add_tests("masgn_iasgn",
3087
2054
  "Ruby" => "a, @b = c, d",
3088
- "RawParseTree" => [:masgn,
3089
- [:array, [:lasgn, :a], [:iasgn, :"@b"]], nil,
3090
- [:array, [:vcall, :c], [:vcall, :d]]],
3091
2055
  "ParseTree" => s(:masgn,
3092
2056
  s(:array, s(:lasgn, :a), s(:iasgn, :"@b")),
3093
2057
  s(:array,
@@ -3096,20 +2060,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3096
2060
 
3097
2061
  add_tests("masgn_masgn",
3098
2062
  "Ruby" => "a, (b, c) = [1, [2, 3]]",
3099
- "RawParseTree" => [:masgn,
3100
- [:array,
3101
- [:lasgn, :a],
3102
- [:masgn,
3103
- [:array,
3104
- [:lasgn, :b],
3105
- [:lasgn, :c]], nil, nil]],
3106
- nil,
3107
- [:to_ary,
3108
- [:array,
3109
- [:lit, 1],
3110
- [:array,
3111
- [:lit, 2],
3112
- [:lit, 3]]]]],
3113
2063
  "ParseTree" => s(:masgn,
3114
2064
  s(:array,
3115
2065
  s(:lasgn, :a),
@@ -3126,12 +2076,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3126
2076
 
3127
2077
  add_tests("masgn_splat_lhs",
3128
2078
  "Ruby" => "a, b, *c = d, e, f, g",
3129
- "RawParseTree" => [:masgn,
3130
- [:array, [:lasgn, :a], [:lasgn, :b]],
3131
- [:lasgn, :c],
3132
- [:array,
3133
- [:vcall, :d], [:vcall, :e],
3134
- [:vcall, :f], [:vcall, :g]]],
3135
2079
  "ParseTree" => s(:masgn,
3136
2080
  s(:array,
3137
2081
  s(:lasgn, :a),
@@ -3145,10 +2089,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3145
2089
 
3146
2090
  add_tests("masgn_splat_rhs_1",
3147
2091
  "Ruby" => "a, b = *c",
3148
- "RawParseTree" => [:masgn,
3149
- [:array, [:lasgn, :a], [:lasgn, :b]],
3150
- nil,
3151
- [:splat, [:vcall, :c]]],
3152
2092
  "ParseTree" => s(:masgn,
3153
2093
  s(:array,
3154
2094
  s(:lasgn, :a),
@@ -3157,12 +2097,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3157
2097
 
3158
2098
  add_tests("masgn_splat_rhs_n",
3159
2099
  "Ruby" => "a, b = c, d, *e",
3160
- "RawParseTree" => [:masgn,
3161
- [:array, [:lasgn, :a], [:lasgn, :b]],
3162
- nil,
3163
- [:argscat,
3164
- [:array, [:vcall, :c], [:vcall, :d]],
3165
- [:vcall, :e]]],
3166
2100
  "ParseTree" => s(:masgn,
3167
2101
  s(:array,
3168
2102
  s(:lasgn, :a),
@@ -3174,10 +2108,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3174
2108
 
3175
2109
  add_tests("masgn_splat_no_name_to_ary",
3176
2110
  "Ruby" => "a, b, * = c",
3177
- "RawParseTree" => [:masgn,
3178
- [:array, [:lasgn, :a], [:lasgn, :b]],
3179
- [:splat],
3180
- [:to_ary, [:vcall, :c]]],
3181
2111
  "ParseTree" => s(:masgn,
3182
2112
  s(:array,
3183
2113
  s(:lasgn, :a),
@@ -3187,9 +2117,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3187
2117
 
3188
2118
  add_tests("masgn_splat_no_name_trailing",
3189
2119
  "Ruby" => "a, b, = c",
3190
- "RawParseTree" => [:masgn,
3191
- [:array, [:lasgn, :a], [:lasgn, :b]], nil,
3192
- [:to_ary, [:vcall, :c]]],
3193
2120
  "ParseTree" => s(:masgn,
3194
2121
  s(:array, s(:lasgn, :a), s(:lasgn, :b)),
3195
2122
  s(:to_ary, s(:call, nil, :c, s(:arglist)))),
@@ -3197,10 +2124,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3197
2124
 
3198
2125
  add_tests("masgn_splat_to_ary",
3199
2126
  "Ruby" => "a, b, *c = d",
3200
- "RawParseTree" => [:masgn,
3201
- [:array, [:lasgn, :a], [:lasgn, :b]],
3202
- [:lasgn, :c],
3203
- [:to_ary, [:vcall, :d]]],
3204
2127
  "ParseTree" => s(:masgn,
3205
2128
  s(:array,
3206
2129
  s(:lasgn, :a),
@@ -3210,12 +2133,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3210
2133
 
3211
2134
  add_tests("masgn_splat_to_ary2",
3212
2135
  "Ruby" => "a, b, *c = d.e(\"f\")",
3213
- "RawParseTree" => [:masgn,
3214
- [:array, [:lasgn, :a], [:lasgn, :b]],
3215
- [:lasgn, :c],
3216
- [:to_ary,
3217
- [:call, [:vcall, :d], :e,
3218
- [:array, [:str, 'f']]]]],
3219
2136
  "ParseTree" => s(:masgn,
3220
2137
  s(:array,
3221
2138
  s(:lasgn, :a),
@@ -3229,25 +2146,18 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3229
2146
 
3230
2147
  add_tests("match",
3231
2148
  "Ruby" => "1 if /x/",
3232
- "RawParseTree" => [:if, [:match, [:lit, /x/]], [:lit, 1], nil],
3233
2149
  "ParseTree" => s(:if, s(:match, s(:lit, /x/)), s(:lit, 1), nil))
3234
2150
 
3235
2151
  add_tests("match2",
3236
2152
  "Ruby" => "/x/ =~ \"blah\"",
3237
- "RawParseTree" => [:match2, [:lit, /x/], [:str, "blah"]],
3238
2153
  "ParseTree" => s(:match2, s(:lit, /x/), s(:str, "blah")))
3239
2154
 
3240
2155
  add_tests("match3",
3241
2156
  "Ruby" => "\"blah\" =~ /x/",
3242
- "RawParseTree" => [:match3, [:lit, /x/], [:str, "blah"]],
3243
2157
  "ParseTree" => s(:match3, s(:lit, /x/), s(:str, "blah")))
3244
2158
 
3245
2159
  add_tests("module",
3246
2160
  "Ruby" => "module X\n def y\n # do nothing\n end\nend",
3247
- "RawParseTree" => [:module, :X,
3248
- [:scope,
3249
- [:defn, :y,
3250
- [:scope, [:block, [:args], [:nil]]]]]],
3251
2161
  "ParseTree" => s(:module, :X,
3252
2162
  s(:scope,
3253
2163
  s(:defn, :y,
@@ -3256,24 +2166,17 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3256
2166
 
3257
2167
  add_tests("module_scoped",
3258
2168
  "Ruby" => "module X::Y\n c\nend",
3259
- "RawParseTree" => [:module, [:colon2, [:const, :X], :Y],
3260
- [:scope, [:vcall, :c]]],
3261
2169
  "ParseTree" => s(:module, s(:colon2, s(:const, :X), :Y),
3262
2170
  s(:scope, s(:call, nil, :c, s(:arglist)))))
3263
2171
 
3264
2172
  add_tests("module_scoped3",
3265
2173
  "Ruby" => "module ::Y\n c\nend",
3266
- "RawParseTree" => [:module, [:colon3, :Y], [:scope, [:vcall, :c]]],
3267
2174
  "ParseTree" => s(:module,
3268
2175
  s(:colon3, :Y),
3269
2176
  s(:scope, s(:call, nil, :c, s(:arglist)))))
3270
2177
 
3271
2178
  add_tests("next",
3272
2179
  "Ruby" => "loop { next if false }",
3273
- "RawParseTree" => [:iter,
3274
- [:fcall, :loop],
3275
- nil,
3276
- [:if, [:false], [:next], nil]],
3277
2180
  "ParseTree" => s(:iter,
3278
2181
  s(:call, nil, :loop, s(:arglist)),
3279
2182
  nil,
@@ -3281,10 +2184,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3281
2184
 
3282
2185
  add_tests("next_arg",
3283
2186
  "Ruby" => "loop { next 42 if false }",
3284
- "RawParseTree" => [:iter,
3285
- [:fcall, :loop],
3286
- nil,
3287
- [:if, [:false], [:next, [:lit, 42]], nil]],
3288
2187
  "ParseTree" => s(:iter,
3289
2188
  s(:call, nil, :loop, s(:arglist)),
3290
2189
  nil,
@@ -3292,24 +2191,14 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3292
2191
 
3293
2192
  add_tests("not",
3294
2193
  "Ruby" => "(not true)",
3295
- "RawParseTree" => [:not, [:true]],
3296
2194
  "ParseTree" => s(:not, s(:true)))
3297
2195
 
3298
2196
  add_tests("nth_ref",
3299
2197
  "Ruby" => "$1",
3300
- "RawParseTree" => [:nth_ref, 1],
3301
2198
  "ParseTree" => s(:nth_ref, 1))
3302
2199
 
3303
2200
  add_tests("op_asgn1",
3304
2201
  "Ruby" => "b = []\nb[1] ||= 10\nb[2] &&= 11\nb[3] += 12\n",
3305
- "RawParseTree" => [:block,
3306
- [:lasgn, :b, [:zarray]],
3307
- [:op_asgn1, [:lvar, :b],
3308
- [:array, [:lit, 1]], :"||", [:lit, 10]],
3309
- [:op_asgn1, [:lvar, :b],
3310
- [:array, [:lit, 2]], :"&&", [:lit, 11]],
3311
- [:op_asgn1, [:lvar, :b],
3312
- [:array, [:lit, 3]], :+, [:lit, 12]]],
3313
2202
  "ParseTree" => s(:block,
3314
2203
  s(:lasgn, :b, s(:array)),
3315
2204
  s(:op_asgn1, s(:lvar, :b),
@@ -3321,14 +2210,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3321
2210
 
3322
2211
  add_tests("op_asgn1_ivar",
3323
2212
  "Ruby" => "@b = []\n@b[1] ||= 10\n@b[2] &&= 11\n@b[3] += 12\n",
3324
- "RawParseTree" => [:block,
3325
- [:iasgn, :@b, [:zarray]],
3326
- [:op_asgn1, [:ivar, :@b],
3327
- [:array, [:lit, 1]], :"||", [:lit, 10]],
3328
- [:op_asgn1, [:ivar, :@b],
3329
- [:array, [:lit, 2]], :"&&", [:lit, 11]],
3330
- [:op_asgn1, [:ivar, :@b],
3331
- [:array, [:lit, 3]], :+, [:lit, 12]]],
3332
2213
  "ParseTree" => s(:block,
3333
2214
  s(:iasgn, :@b, s(:array)),
3334
2215
  s(:op_asgn1, s(:ivar, :@b),
@@ -3340,23 +2221,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3340
2221
 
3341
2222
  add_tests("op_asgn2",
3342
2223
  "Ruby" => "s = Struct.new(:var)\nc = s.new(nil)\nc.var ||= 20\nc.var &&= 21\nc.var += 22\nc.d.e.f ||= 42\n",
3343
- "RawParseTree" => [:block,
3344
- [:lasgn, :s,
3345
- [:call, [:const, :Struct],
3346
- :new, [:array, [:lit, :var]]]],
3347
- [:lasgn, :c,
3348
- [:call, [:lvar, :s], :new, [:array, [:nil]]]],
3349
-
3350
- [:op_asgn2, [:lvar, :c], :var=, :"||",
3351
- [:lit, 20]],
3352
- [:op_asgn2, [:lvar, :c], :var=, :"&&",
3353
- [:lit, 21]],
3354
- [:op_asgn2, [:lvar, :c], :var=, :+, [:lit, 22]],
3355
-
3356
- [:op_asgn2,
3357
- [:call,
3358
- [:call, [:lvar, :c], :d], :e], :f=, :"||",
3359
- [:lit, 42]]],
3360
2224
  "ParseTree" => s(:block,
3361
2225
  s(:lasgn, :s,
3362
2226
  s(:call, s(:const, :Struct),
@@ -3378,17 +2242,11 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3378
2242
 
3379
2243
  add_tests("op_asgn2_self",
3380
2244
  "Ruby" => "self.Bag ||= Bag.new",
3381
- "RawParseTree" => [:op_asgn2, [:self], :"Bag=", :"||",
3382
- [:call, [:const, :Bag], :new]],
3383
2245
  "ParseTree" => s(:op_asgn2, s(:self), :"Bag=", :"||",
3384
2246
  s(:call, s(:const, :Bag), :new, s(:arglist))))
3385
2247
 
3386
2248
  add_tests("op_asgn_and",
3387
2249
  "Ruby" => "a = 0\na &&= 2\n",
3388
- "RawParseTree" => [:block,
3389
- [:lasgn, :a, [:lit, 0]],
3390
- [:op_asgn_and,
3391
- [:lvar, :a], [:lasgn, :a, [:lit, 2]]]],
3392
2250
  "ParseTree" => s(:block,
3393
2251
  s(:lasgn, :a, s(:lit, 0)),
3394
2252
  s(:op_asgn_and,
@@ -3396,17 +2254,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3396
2254
 
3397
2255
  add_tests("op_asgn_and_ivar2",
3398
2256
  "Ruby" => "@fetcher &&= new(Gem.configuration[:http_proxy])",
3399
- "RawParseTree" => [:op_asgn_and,
3400
- [:ivar, :@fetcher],
3401
- [:iasgn,
3402
- :@fetcher,
3403
- [:fcall,
3404
- :new,
3405
- [:array,
3406
- [:call,
3407
- [:call, [:const, :Gem], :configuration],
3408
- :[],
3409
- [:array, [:lit, :http_proxy]]]]]]],
3410
2257
  "ParseTree" => s(:op_asgn_and,
3411
2258
  s(:ivar, :@fetcher),
3412
2259
  s(:iasgn,
@@ -3423,10 +2270,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3423
2270
 
3424
2271
  add_tests("op_asgn_or",
3425
2272
  "Ruby" => "a = 0\na ||= 1\n",
3426
- "RawParseTree" => [:block,
3427
- [:lasgn, :a, [:lit, 0]],
3428
- [:op_asgn_or,
3429
- [:lvar, :a], [:lasgn, :a, [:lit, 1]]]],
3430
2273
  "ParseTree" => s(:block,
3431
2274
  s(:lasgn, :a, s(:lit, 0)),
3432
2275
  s(:op_asgn_or,
@@ -3434,12 +2277,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3434
2277
 
3435
2278
  add_tests("op_asgn_or_block",
3436
2279
  "Ruby" => "a ||= begin\n b\n rescue\n c\n end",
3437
- "RawParseTree" => [:op_asgn_or,
3438
- [:lvar, :a],
3439
- [:lasgn, :a,
3440
- [:rescue,
3441
- [:vcall, :b],
3442
- [:resbody, nil, [:vcall, :c]]]]],
3443
2280
  "ParseTree" => s(:op_asgn_or,
3444
2281
  s(:lvar, :a),
3445
2282
  s(:lasgn, :a,
@@ -3451,26 +2288,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3451
2288
 
3452
2289
  add_tests("op_asgn_or_ivar",
3453
2290
  "Ruby" => "@v ||= { }",
3454
- "RawParseTree" => [:op_asgn_or,
3455
- [:ivar, :@v],
3456
- [:iasgn, :@v, [:hash]]],
3457
2291
  "ParseTree" => s(:op_asgn_or,
3458
2292
  s(:ivar, :@v),
3459
2293
  s(:iasgn, :@v, s(:hash))))
3460
2294
 
3461
2295
  add_tests("op_asgn_or_ivar2",
3462
2296
  "Ruby" => "@fetcher ||= new(Gem.configuration[:http_proxy])",
3463
- "RawParseTree" => [:op_asgn_or,
3464
- [:ivar, :@fetcher],
3465
- [:iasgn,
3466
- :@fetcher,
3467
- [:fcall,
3468
- :new,
3469
- [:array,
3470
- [:call,
3471
- [:call, [:const, :Gem], :configuration],
3472
- :[],
3473
- [:array, [:lit, :http_proxy]]]]]]],
3474
2297
  "ParseTree" => s(:op_asgn_or,
3475
2298
  s(:ivar, :@fetcher),
3476
2299
  s(:iasgn,
@@ -3486,16 +2309,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3486
2309
 
3487
2310
  add_tests("or",
3488
2311
  "Ruby" => "(a or b)",
3489
- "RawParseTree" => [:or, [:vcall, :a], [:vcall, :b]],
3490
2312
  "ParseTree" => s(:or,
3491
2313
  s(:call, nil, :a, s(:arglist)),
3492
2314
  s(:call, nil, :b, s(:arglist))))
3493
2315
 
3494
2316
  add_tests("or_big",
3495
2317
  "Ruby" => "((a or b) or (c and d))",
3496
- "RawParseTree" => [:or,
3497
- [:or, [:vcall, :a], [:vcall, :b]],
3498
- [:and, [:vcall, :c], [:vcall, :d]]],
3499
2318
  "ParseTree" => s(:or,
3500
2319
  s(:or,
3501
2320
  s(:call, nil, :a, s(:arglist)),
@@ -3506,9 +2325,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3506
2325
 
3507
2326
  add_tests("or_big2",
3508
2327
  "Ruby" => "((a || b) || (c && d))",
3509
- "RawParseTree" => [:or,
3510
- [:or, [:vcall, :a], [:vcall, :b]],
3511
- [:and, [:vcall, :c], [:vcall, :d]]],
3512
2328
  "ParseTree" => s(:or,
3513
2329
  s(:or,
3514
2330
  s(:call, nil, :a, s(:arglist)),
@@ -3520,15 +2336,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3520
2336
 
3521
2337
  add_tests("parse_floats_as_args",
3522
2338
  "Ruby" => "def x(a=0.0,b=0.0)\n a+b\nend",
3523
- "RawParseTree" => [:defn, :x,
3524
- [:scope,
3525
- [:block,
3526
- [:args, :a, :b,
3527
- [:block,
3528
- [:lasgn, :a, [:lit, 0.0]],
3529
- [:lasgn, :b, [:lit, 0.0]]]],
3530
- [:call, [:lvar, :a], :+,
3531
- [:array, [:lvar, :b]]]]]],
3532
2339
  "ParseTree" => s(:defn, :x,
3533
2340
  s(:args, :a, :b,
3534
2341
  s(:block,
@@ -3542,15 +2349,10 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3542
2349
 
3543
2350
  add_tests("postexe",
3544
2351
  "Ruby" => "END { 1 }",
3545
- "RawParseTree" => [:iter, [:postexe], nil, [:lit, 1]],
3546
2352
  "ParseTree" => s(:iter, s(:postexe), nil, s(:lit, 1)))
3547
2353
 
3548
2354
  add_tests("proc_args_0",
3549
2355
  "Ruby" => "proc { || (x + 1) }",
3550
- "RawParseTree" => [:iter,
3551
- [:fcall, :proc],
3552
- 0,
3553
- [:call, [:vcall, :x], :+, [:array, [:lit, 1]]]],
3554
2356
  "ParseTree" => s(:iter,
3555
2357
  s(:call, nil, :proc, s(:arglist)),
3556
2358
  0,
@@ -3561,10 +2363,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3561
2363
 
3562
2364
  add_tests("proc_args_1",
3563
2365
  "Ruby" => "proc { |x| (x + 1) }",
3564
- "RawParseTree" => [:iter,
3565
- [:fcall, :proc],
3566
- [:dasgn_curr, :x],
3567
- [:call, [:dvar, :x], :+, [:array, [:lit, 1]]]],
3568
2366
  "ParseTree" => s(:iter,
3569
2367
  s(:call, nil, :proc, s(:arglist)),
3570
2368
  s(:lasgn, :x),
@@ -3573,12 +2371,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3573
2371
 
3574
2372
  add_tests("proc_args_2",
3575
2373
  "Ruby" => "proc { |x, y| (x + y) }",
3576
- "RawParseTree" => [:iter,
3577
- [:fcall, :proc],
3578
- [:masgn, [:array,
3579
- [:dasgn_curr, :x],
3580
- [:dasgn_curr, :y]], nil, nil],
3581
- [:call, [:dvar, :x], :+, [:array, [:dvar, :y]]]],
3582
2374
  "ParseTree" => s(:iter,
3583
2375
  s(:call, nil, :proc, s(:arglist)),
3584
2376
  s(:masgn,
@@ -3590,10 +2382,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3590
2382
 
3591
2383
  add_tests("proc_args_no",
3592
2384
  "Ruby" => "proc { (x + 1) }",
3593
- "RawParseTree" => [:iter,
3594
- [:fcall, :proc],
3595
- nil,
3596
- [:call, [:vcall, :x], :+, [:array, [:lit, 1]]]],
3597
2385
  "ParseTree" => s(:iter,
3598
2386
  s(:call, nil, :proc, s(:arglist)),
3599
2387
  nil,
@@ -3602,9 +2390,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3602
2390
 
3603
2391
  add_tests("redo",
3604
2392
  "Ruby" => "loop { redo if false }",
3605
- "RawParseTree" => [:iter,
3606
- [:fcall, :loop], nil,
3607
- [:if, [:false], [:redo], nil]],
3608
2393
  "ParseTree" => s(:iter,
3609
2394
  s(:call, nil, :loop, s(:arglist)),
3610
2395
  nil,
@@ -3614,21 +2399,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3614
2399
 
3615
2400
  add_tests("rescue",
3616
2401
  "Ruby" => "blah rescue nil",
3617
- "RawParseTree" => [:rescue,
3618
- [:vcall, :blah], [:resbody, nil, [:nil]]],
3619
2402
  "ParseTree" => s(:rescue,
3620
2403
  s(:call, nil, :blah, s(:arglist)),
3621
2404
  s(:resbody, s(:array), s(:nil))))
3622
2405
 
3623
2406
  add_tests("rescue_block_body",
3624
2407
  "Ruby" => "begin\n a\nrescue => e\n c\n d\nend",
3625
- "RawParseTree" => [:rescue,
3626
- [:vcall, :a],
3627
- [:resbody, nil,
3628
- [:block,
3629
- [:lasgn, :e, [:gvar, :$!]],
3630
- [:vcall, :c],
3631
- [:vcall, :d]]]],
3632
2408
  "ParseTree" => s(:rescue,
3633
2409
  s(:call, nil, :a, s(:arglist)),
3634
2410
  s(:resbody,
@@ -3639,14 +2415,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3639
2415
 
3640
2416
  add_tests("rescue_block_body_3",
3641
2417
  "Ruby" => "begin\n a\nrescue A\n b\nrescue B\n c\nrescue C\n d\nend",
3642
- "RawParseTree" => [:rescue,
3643
- [:vcall, :a],
3644
- [:resbody, [:array, [:const, :A]],
3645
- [:vcall, :b],
3646
- [:resbody, [:array, [:const, :B]],
3647
- [:vcall, :c],
3648
- [:resbody, [:array, [:const, :C]],
3649
- [:vcall, :d]]]]],
3650
2418
  "ParseTree" => s(:rescue,
3651
2419
  s(:call, nil, :a, s(:arglist)),
3652
2420
  s(:resbody, s(:array, s(:const, :A)),
@@ -3658,13 +2426,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3658
2426
 
3659
2427
  add_tests("rescue_block_body_ivar",
3660
2428
  "Ruby" => "begin\n a\nrescue => @e\n c\n d\nend",
3661
- "RawParseTree" => [:rescue,
3662
- [:vcall, :a],
3663
- [:resbody, nil,
3664
- [:block,
3665
- [:iasgn, :@e, [:gvar, :$!]],
3666
- [:vcall, :c],
3667
- [:vcall, :d]]]],
3668
2429
  "ParseTree" => s(:rescue,
3669
2430
  s(:call, nil, :a, s(:arglist)),
3670
2431
  s(:resbody,
@@ -3675,18 +2436,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3675
2436
 
3676
2437
  add_tests("rescue_block_nada",
3677
2438
  "Ruby" => "begin\n blah\nrescue\n # do nothing\nend",
3678
- "RawParseTree" => [:rescue, [:vcall, :blah], [:resbody, nil]],
3679
2439
  "ParseTree" => s(:rescue,
3680
2440
  s(:call, nil, :blah, s(:arglist)),
3681
2441
  s(:resbody, s(:array), nil)))
3682
2442
 
3683
2443
  add_tests("rescue_exceptions",
3684
2444
  "Ruby" => "begin\n blah\nrescue RuntimeError => r\n # do nothing\nend",
3685
- "RawParseTree" => [:rescue,
3686
- [:vcall, :blah],
3687
- [:resbody,
3688
- [:array, [:const, :RuntimeError]],
3689
- [:lasgn, :r, [:gvar, :$!]]]],
3690
2445
  "ParseTree" => s(:rescue,
3691
2446
  s(:call, nil, :blah, s(:arglist)),
3692
2447
  s(:resbody,
@@ -3698,9 +2453,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3698
2453
 
3699
2454
  add_tests("rescue_iasgn_var_empty",
3700
2455
  "Ruby" => "begin\n 1\nrescue => @e\n # do nothing\nend",
3701
- "RawParseTree" => [:rescue,
3702
- [:lit, 1],
3703
- [:resbody, nil, [:iasgn, :@e, [:gvar, :$!]]]],
3704
2456
  "ParseTree" => s(:rescue,
3705
2457
  s(:lit, 1),
3706
2458
  s(:resbody,
@@ -3709,9 +2461,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3709
2461
 
3710
2462
  add_tests("rescue_lasgn",
3711
2463
  "Ruby" => "begin\n 1\nrescue\n var = 2\nend",
3712
- "RawParseTree" => [:rescue,
3713
- [:lit, 1],
3714
- [:resbody, nil, [:lasgn, :var, [:lit, 2]]]],
3715
2464
  "ParseTree" => s(:rescue,
3716
2465
  s(:lit, 1),
3717
2466
  s(:resbody,
@@ -3721,12 +2470,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3721
2470
 
3722
2471
  add_tests("rescue_lasgn_var",
3723
2472
  "Ruby" => "begin\n 1\nrescue => e\n var = 2\nend",
3724
- "RawParseTree" => [:rescue,
3725
- [:lit, 1],
3726
- [:resbody, nil,
3727
- [:block,
3728
- [:lasgn, :e, [:gvar, :$!]],
3729
- [:lasgn, :var, [:lit, 2]]]]],
3730
2473
  "ParseTree" => s(:rescue,
3731
2474
  s(:lit, 1),
3732
2475
  s(:resbody,
@@ -3735,9 +2478,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3735
2478
 
3736
2479
  add_tests("rescue_lasgn_var_empty",
3737
2480
  "Ruby" => "begin\n 1\nrescue => e\n # do nothing\nend",
3738
- "RawParseTree" => [:rescue,
3739
- [:lit, 1],
3740
- [:resbody, nil, [:lasgn, :e, [:gvar, :$!]]]],
3741
2481
  "ParseTree" => s(:rescue,
3742
2482
  s(:lit, 1),
3743
2483
  s(:resbody,
@@ -3746,44 +2486,32 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3746
2486
 
3747
2487
  add_tests("retry",
3748
2488
  "Ruby" => "retry",
3749
- "RawParseTree" => [:retry],
3750
2489
  "ParseTree" => s(:retry))
3751
2490
 
3752
2491
  add_tests("return_0",
3753
2492
  "Ruby" => "return",
3754
- "RawParseTree" => [:return],
3755
2493
  "ParseTree" => s(:return))
3756
2494
 
3757
2495
  add_tests("return_1",
3758
2496
  "Ruby" => "return 1",
3759
- "RawParseTree" => [:return, [:lit, 1]],
3760
2497
  "ParseTree" => s(:return, s(:lit, 1)))
3761
2498
 
3762
2499
  add_tests("return_1_splatted",
3763
2500
  "Ruby" => "return *1",
3764
- "RawParseTree" => [:return, [:svalue, [:splat, [:lit, 1]]]],
3765
2501
  "ParseTree" => s(:return, s(:svalue, s(:splat, s(:lit, 1)))))
3766
2502
 
3767
2503
  add_tests("return_n",
3768
2504
  "Ruby" => "return 1, 2, 3",
3769
- "RawParseTree" => [:return, [:array,
3770
- [:lit, 1], [:lit, 2], [:lit, 3]]],
3771
2505
  "ParseTree" => s(:return, s(:array,
3772
2506
  s(:lit, 1), s(:lit, 2), s(:lit, 3))),
3773
2507
  "Ruby2Ruby" => "return [1, 2, 3]")
3774
2508
 
3775
2509
  add_tests("sclass",
3776
2510
  "Ruby" => "class << self\n 42\nend",
3777
- "RawParseTree" => [:sclass, [:self], [:scope, [:lit, 42]]],
3778
2511
  "ParseTree" => s(:sclass, s(:self), s(:scope, s(:lit, 42))))
3779
2512
 
3780
2513
  add_tests("sclass_trailing_class",
3781
2514
  "Ruby" => "class A\n class << self\n a\n end\n class B\n end\nend",
3782
- "RawParseTree" => [:class, :A, nil,
3783
- [:scope,
3784
- [:block,
3785
- [:sclass, [:self], [:scope, [:vcall, :a]]],
3786
- [:class, :B, nil, [:scope]]]]],
3787
2515
  "ParseTree" => s(:class, :A, nil,
3788
2516
  s(:scope,
3789
2517
  s(:block,
@@ -3794,11 +2522,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3794
2522
 
3795
2523
  add_tests("splat",
3796
2524
  "Ruby" => "def x(*b)\n a(*b)\nend",
3797
- "RawParseTree" => [:defn, :x,
3798
- [:scope,
3799
- [:block,
3800
- [:args, :"*b"],
3801
- [:fcall, :a, [:splat, [:lvar, :b]]]]]],
3802
2525
  "ParseTree" => s(:defn, :x,
3803
2526
  s(:args, :"*b"),
3804
2527
  s(:scope,
@@ -3808,137 +2531,104 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3808
2531
 
3809
2532
  add_tests("splat_array",
3810
2533
  "Ruby" => "[*[1]]",
3811
- "RawParseTree" => [:splat, [:array, [:lit, 1]]],
3812
2534
  "ParseTree" => s(:array, s(:splat, s(:array, s(:lit, 1)))))
3813
2535
 
3814
2536
  add_tests("splat_break",
3815
2537
  "Ruby" => "break *[1]",
3816
- "RawParseTree" => [:break, [:svalue, [:splat, [:array, [:lit, 1]]]]],
3817
2538
  "ParseTree" => s(:break, s(:svalue, s(:splat, s(:array, s(:lit, 1))))))
3818
2539
 
3819
2540
  add_tests("splat_break_array",
3820
2541
  "Ruby" => "break [*[1]]",
3821
- "RawParseTree" => [:break, [:splat, [:array, [:lit, 1]]]],
3822
2542
  "ParseTree" => s(:break, s(:array, s(:splat, s(:array, s(:lit, 1))))))
3823
2543
 
3824
2544
  add_tests("splat_fcall",
3825
2545
  "Ruby" => "meth(*[1])",
3826
- "RawParseTree" => [:fcall, :meth,
3827
- [:splat, [:array, [:lit, 1]]]],
3828
2546
  "ParseTree" => s(:call, nil, :meth,
3829
2547
  s(:arglist, s(:splat, s(:array, s(:lit, 1))))))
3830
2548
 
3831
2549
  add_tests("splat_fcall_array",
3832
2550
  "Ruby" => "meth([*[1]])",
3833
- "RawParseTree" => [:fcall, :meth,
3834
- [:array, [:splat, [:array, [:lit, 1]]]]],
3835
2551
  "ParseTree" => s(:call, nil, :meth,
3836
2552
  s(:arglist,
3837
2553
  s(:array, s(:splat, s(:array, s(:lit, 1)))))))
3838
2554
 
3839
2555
  add_tests("splat_lasgn",
3840
2556
  "Ruby" => "x = *[1]",
3841
- "RawParseTree" => [:lasgn, :x, [:svalue, [:splat, [:array, [:lit, 1]]]]],
3842
2557
  "ParseTree" => s(:lasgn, :x, s(:svalue, s(:splat, s(:array, s(:lit, 1))))))
3843
2558
 
3844
2559
  add_tests("splat_lasgn_array",
3845
2560
  "Ruby" => "x = [*[1]]",
3846
- "RawParseTree" => [:lasgn, :x, [:splat, [:array, [:lit, 1]]]],
3847
2561
  "ParseTree" => s(:lasgn, :x, s(:array, s(:splat, s(:array, s(:lit, 1))))))
3848
2562
 
3849
2563
  add_tests("splat_lit_1",
3850
2564
  "Ruby" => "[*1]",
3851
- "RawParseTree" => [:splat, [:lit, 1]], # UGH - damn MRI
2565
+ # UGH - damn MRI
3852
2566
  "ParseTree" => s(:array, s(:splat, s(:lit, 1))))
3853
2567
 
3854
2568
  add_tests("splat_lit_n",
3855
2569
  "Ruby" => "[1, *2]",
3856
- "RawParseTree" => [:argscat, [:array, [:lit, 1]], [:lit, 2]],
3857
2570
  "ParseTree" => s(:array, s(:lit, 1), s(:splat, s(:lit, 2))))
3858
2571
 
3859
2572
  add_tests("splat_next",
3860
2573
  "Ruby" => "next *[1]",
3861
- "RawParseTree" => [:next, [:svalue, [:splat, [:array, [:lit, 1]]]]],
3862
2574
  "ParseTree" => s(:next, s(:svalue, s(:splat, s(:array, s(:lit, 1))))))
3863
2575
 
3864
2576
  add_tests("splat_next_array",
3865
2577
  "Ruby" => "next [*[1]]",
3866
- "RawParseTree" => [:next, [:splat, [:array, [:lit, 1]]]],
3867
2578
  "ParseTree" => s(:next, s(:array, s(:splat, s(:array, s(:lit, 1))))))
3868
2579
 
3869
2580
  add_tests("splat_return",
3870
2581
  "Ruby" => "return *[1]",
3871
- "RawParseTree" => [:return, [:svalue, [:splat, [:array, [:lit, 1]]]]],
3872
2582
  "ParseTree" => s(:return, s(:svalue, s(:splat, s(:array, s(:lit, 1))))))
3873
2583
 
3874
2584
  add_tests("splat_return_array",
3875
2585
  "Ruby" => "return [*[1]]",
3876
- "RawParseTree" => [:return, [:splat, [:array, [:lit, 1]]]],
3877
2586
  "ParseTree" => s(:return, s(:array, s(:splat, s(:array, s(:lit, 1))))))
3878
2587
 
3879
2588
  add_tests("splat_super",
3880
2589
  "Ruby" => "super(*[1])",
3881
- "RawParseTree" => [:super, [:splat, [:array, [:lit, 1]]]],
3882
2590
  "ParseTree" => s(:super, s(:splat, s(:array, s(:lit, 1)))))
3883
2591
 
3884
2592
  add_tests("splat_super_array",
3885
2593
  "Ruby" => "super([*[1]])",
3886
- "RawParseTree" => [:super, [:array, [:splat, [:array, [:lit, 1]]]]],
3887
2594
  "ParseTree" => s(:super, s(:array, s(:splat, s(:array, s(:lit, 1))))))
3888
2595
 
3889
2596
  add_tests("splat_yield",
3890
2597
  "Ruby" => "yield(*[1])",
3891
- "RawParseTree" => [:yield, [:splat, [:array, [:lit, 1]]]],
3892
2598
  "ParseTree" => s(:yield, s(:splat, s(:array, s(:lit, 1)))))
3893
2599
 
3894
2600
  add_tests("splat_yield_array",
3895
2601
  "Ruby" => "yield([*[1]])",
3896
- "RawParseTree" => [:yield, [:splat, [:array, [:lit, 1]]], true],
3897
2602
  "ParseTree" => s(:yield, s(:array, s(:splat, s(:array, s(:lit, 1))))))
3898
2603
 
3899
2604
  add_tests("str",
3900
2605
  "Ruby" => '"x"',
3901
- "RawParseTree" => [:str, "x"],
3902
2606
  "ParseTree" => s(:str, "x"))
3903
2607
 
3904
2608
  add_tests("str_concat_newline", # FIX? make prettier? possible?
3905
2609
  "Ruby" => '"before" \\
3906
2610
  " after"',
3907
- "RawParseTree" => [:str, "before after"],
3908
2611
  "ParseTree" => s(:str, "before after"),
3909
2612
  "Ruby2Ruby" => '"before after"')
3910
2613
 
3911
2614
  add_tests("str_concat_space",
3912
2615
  "Ruby" => '"before" " after"',
3913
- "RawParseTree" => [:str, "before after"],
3914
2616
  "ParseTree" => s(:str, "before after"),
3915
2617
  "Ruby2Ruby" => '"before after"')
3916
2618
 
3917
2619
  add_tests("str_heredoc",
3918
2620
  "Ruby" => "<<'EOM'\n blah\nblah\nEOM",
3919
- "RawParseTree" => [:str, " blah\nblah\n"],
3920
2621
  "ParseTree" => s(:str, " blah\nblah\n"),
3921
2622
  "Ruby2Ruby" => "\" blah\\nblah\\n\"")
3922
2623
 
3923
2624
  add_tests("str_heredoc_call",
3924
2625
  "Ruby" => "<<'EOM'.strip\n blah\nblah\nEOM",
3925
- "RawParseTree" => [:call, [:str, " blah\nblah\n"], :strip],
3926
2626
  "ParseTree" => s(:call, s(:str, " blah\nblah\n"),
3927
2627
  :strip, s(:arglist)),
3928
2628
  "Ruby2Ruby" => "\" blah\\nblah\\n\".strip")
3929
2629
 
3930
2630
  add_tests("str_heredoc_double",
3931
2631
  "Ruby" => "a += <<-H1 + b + <<-H2\n first\nH1\n second\nH2",
3932
- "RawParseTree" => [:lasgn, :a,
3933
- [:call,
3934
- [:lvar, :a],
3935
- :+,
3936
- [:array,
3937
- [:call,
3938
- [:call, [:str, " first\n"], :+,
3939
- [:array, [:vcall, :b]]],
3940
- :+,
3941
- [:array, [:str, " second\n"]]]]]],
3942
2632
  "ParseTree" => s(:lasgn, :a,
3943
2633
  s(:call,
3944
2634
  s(:lvar, :a),
@@ -3954,41 +2644,21 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
3954
2644
 
3955
2645
  add_tests("str_heredoc_empty", # yes... tarded
3956
2646
  "Ruby" => "<<'EOM'\nEOM",
3957
- "RawParseTree" => [:str, ""],
3958
2647
  "ParseTree" => s(:str, ""),
3959
2648
  "Ruby2Ruby" => '""')
3960
2649
 
3961
2650
  add_tests("str_heredoc_indent",
3962
2651
  "Ruby" => "<<-EOM\n blah\nblah\n\n EOM",
3963
- "RawParseTree" => [:str, " blah\nblah\n\n"],
3964
2652
  "ParseTree" => s(:str, " blah\nblah\n\n"),
3965
2653
  "Ruby2Ruby" => "\" blah\\nblah\\n\\n\"")
3966
2654
 
3967
2655
  add_tests("str_interp_file",
3968
2656
  "Ruby" => '"file = #{__FILE__}\n"',
3969
- "RawParseTree" => [:str, "file = (string)\n"],
3970
2657
  "ParseTree" => s(:str, "file = (string)\n"),
3971
2658
  "Ruby2Ruby" => '"file = (string)\\n"')
3972
2659
 
3973
2660
  add_tests("structure_extra_block_for_dvar_scoping",
3974
2661
  "Ruby" => "a.b do |c, d|\n unless e.f(c) then\n g = false\n d.h { |x, i| g = true }\n end\nend",
3975
- "RawParseTree" => [:iter,
3976
- [:call, [:vcall, :a], :b],
3977
- [:masgn, [:array,
3978
- [:dasgn_curr, :c],
3979
- [:dasgn_curr, :d]], nil, nil],
3980
- [:if,
3981
- [:call, [:vcall, :e], :f,
3982
- [:array, [:dvar, :c]]],
3983
- nil,
3984
- [:block,
3985
- [:dasgn_curr, :g, [:false]],
3986
- [:iter,
3987
- [:call, [:dvar, :d], :h],
3988
- [:masgn, [:array,
3989
- [:dasgn_curr, :x],
3990
- [:dasgn_curr, :i]], nil, nil],
3991
- [:dasgn, :g, [:true]]]]]],
3992
2662
  "ParseTree" => s(:iter,
3993
2663
  s(:call,
3994
2664
  s(:call, nil, :a, s(:arglist)),
@@ -4011,9 +2681,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4011
2681
 
4012
2682
  add_tests("structure_remove_begin_1",
4013
2683
  "Ruby" => "a << begin\n b\n rescue\n c\n end",
4014
- "RawParseTree" => [:call, [:vcall, :a], :<<,
4015
- [:array, [:rescue, [:vcall, :b],
4016
- [:resbody, nil, [:vcall, :c]]]]],
4017
2684
  "ParseTree" => s(:call, s(:call, nil, :a, s(:arglist)), :<<,
4018
2685
  s(:arglist,
4019
2686
  s(:rescue,
@@ -4024,15 +2691,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4024
2691
 
4025
2692
  add_tests("structure_remove_begin_2",
4026
2693
  "Ruby" => "a = if c\n begin\n b\n rescue\n nil\n end\n end\na",
4027
- "RawParseTree" => [:block,
4028
- [:lasgn,
4029
- :a,
4030
- [:if, [:vcall, :c],
4031
- [:rescue,
4032
- [:vcall, :b],
4033
- [:resbody, nil, [:nil]]],
4034
- nil]],
4035
- [:lvar, :a]],
4036
2694
  "ParseTree" => s(:block,
4037
2695
  s(:lasgn,
4038
2696
  :a,
@@ -4046,26 +2704,17 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4046
2704
 
4047
2705
  add_tests("structure_unused_literal_wwtt",
4048
2706
  "Ruby" => "\"prevent the above from infecting rdoc\"\n\nmodule Graffle\nend",
4049
- "RawParseTree" => [:module, :Graffle, [:scope]],
4050
2707
  "ParseTree" => s(:module, :Graffle, s(:scope)),
4051
2708
  "Ruby2Ruby" => "module Graffle\nend")
4052
2709
 
4053
2710
  add_tests("super_0",
4054
2711
  "Ruby" => "def x\n super()\nend",
4055
- "RawParseTree" => [:defn, :x,
4056
- [:scope,
4057
- [:block, [:args], [:super]]]],
4058
2712
  "ParseTree" => s(:defn, :x,
4059
2713
  s(:args),
4060
2714
  s(:scope, s(:block, s(:super)))))
4061
2715
 
4062
2716
  add_tests("super_1",
4063
2717
  "Ruby" => "def x\n super(4)\nend",
4064
- "RawParseTree" => [:defn, :x,
4065
- [:scope,
4066
- [:block,
4067
- [:args],
4068
- [:super, [:array, [:lit, 4]]]]]],
4069
2718
  "ParseTree" => s(:defn, :x,
4070
2719
  s(:args),
4071
2720
  s(:scope,
@@ -4074,13 +2723,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4074
2723
 
4075
2724
  add_tests("super_1_array",
4076
2725
  "Ruby" => "def x\n super([24, 42])\nend",
4077
- "RawParseTree" => [:defn, :x,
4078
- [:scope,
4079
- [:block,
4080
- [:args],
4081
- [:super,
4082
- [:array,
4083
- [:array, [:lit, 24], [:lit, 42]]]]]]],
4084
2726
  "ParseTree" => s(:defn, :x,
4085
2727
  s(:args),
4086
2728
  s(:scope,
@@ -4091,8 +2733,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4091
2733
 
4092
2734
  add_tests("super_block_pass",
4093
2735
  "Ruby" => "super(a, &b)",
4094
- "RawParseTree" => [:block_pass,
4095
- [:vcall, :b], [:super, [:array, [:vcall, :a]]]],
4096
2736
  "ParseTree" => s(:super,
4097
2737
  s(:call, nil, :a, s(:arglist)),
4098
2738
  s(:block_pass,
@@ -4100,21 +2740,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4100
2740
 
4101
2741
  add_tests("super_block_splat",
4102
2742
  "Ruby" => "super(a, *b)",
4103
- "RawParseTree" => [:super,
4104
- [:argscat,
4105
- [:array, [:vcall, :a]],
4106
- [:vcall, :b]]],
4107
2743
  "ParseTree" => s(:super,
4108
2744
  s(:call, nil, :a, s(:arglist)),
4109
2745
  s(:splat, s(:call, nil, :b, s(:arglist)))))
4110
2746
 
4111
2747
  add_tests("super_n",
4112
2748
  "Ruby" => "def x\n super(24, 42)\nend",
4113
- "RawParseTree" => [:defn, :x,
4114
- [:scope,
4115
- [:block,
4116
- [:args],
4117
- [:super, [:array, [:lit, 24], [:lit, 42]]]]]],
4118
2749
  "ParseTree" => s(:defn, :x,
4119
2750
  s(:args),
4120
2751
  s(:scope,
@@ -4123,35 +2754,26 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4123
2754
 
4124
2755
  add_tests("svalue",
4125
2756
  "Ruby" => "a = *b",
4126
- "RawParseTree" => [:lasgn, :a, [:svalue, [:splat, [:vcall, :b]]]],
4127
2757
  "ParseTree" => s(:lasgn, :a,
4128
2758
  s(:svalue,
4129
2759
  s(:splat, s(:call, nil, :b, s(:arglist))))))
4130
2760
 
4131
2761
  add_tests("to_ary",
4132
2762
  "Ruby" => "a, b = c",
4133
- "RawParseTree" => [:masgn,
4134
- [:array, [:lasgn, :a], [:lasgn, :b]], nil,
4135
- [:to_ary, [:vcall, :c]]],
4136
2763
  "ParseTree" => s(:masgn,
4137
2764
  s(:array, s(:lasgn, :a), s(:lasgn, :b)),
4138
2765
  s(:to_ary, s(:call, nil, :c, s(:arglist)))))
4139
2766
 
4140
2767
  add_tests("true",
4141
2768
  "Ruby" => "true",
4142
- "RawParseTree" => [:true],
4143
2769
  "ParseTree" => s(:true))
4144
2770
 
4145
2771
  add_tests("undef",
4146
2772
  "Ruby" => "undef :x",
4147
- "RawParseTree" => [:undef, [:lit, :x]],
4148
2773
  "ParseTree" => s(:undef, s(:lit, :x)))
4149
2774
 
4150
2775
  add_tests("undef_2",
4151
2776
  "Ruby" => "undef :x, :y",
4152
- "RawParseTree" => [:block,
4153
- [:undef, [:lit, :x]],
4154
- [:undef, [:lit, :y]]],
4155
2777
  "ParseTree" => s(:block,
4156
2778
  s(:undef, s(:lit, :x)),
4157
2779
  s(:undef, s(:lit, :y))),
@@ -4159,10 +2781,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4159
2781
 
4160
2782
  add_tests("undef_3",
4161
2783
  "Ruby" => "undef :x, :y, :z",
4162
- "RawParseTree" => [:block,
4163
- [:undef, [:lit, :x]],
4164
- [:undef, [:lit, :y]],
4165
- [:undef, [:lit, :z]]],
4166
2784
  "ParseTree" => s(:block,
4167
2785
  s(:undef, s(:lit, :x)),
4168
2786
  s(:undef, s(:lit, :y)),
@@ -4171,21 +2789,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4171
2789
 
4172
2790
  add_tests("undef_block_1",
4173
2791
  "Ruby" => "f1\nundef :x\n", # TODO: don't like the extra return
4174
- "RawParseTree" => [:block,
4175
- [:vcall, :f1],
4176
- [:undef, [:lit, :x]]],
4177
2792
  "ParseTree" => s(:block,
4178
2793
  s(:call, nil, :f1, s(:arglist)),
4179
2794
  s(:undef, s(:lit, :x))))
4180
2795
 
4181
2796
  add_tests("undef_block_2",
4182
2797
  "Ruby" => "f1\nundef :x, :y",
4183
- "RawParseTree" => [:block,
4184
- [:vcall, :f1],
4185
- [:block,
4186
- [:undef, [:lit, :x]],
4187
- [:undef, [:lit, :y]],
4188
- ]],
4189
2798
  "ParseTree" => s(:block,
4190
2799
  s(:call, nil, :f1, s(:arglist)),
4191
2800
  s(:block,
@@ -4195,13 +2804,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4195
2804
 
4196
2805
  add_tests("undef_block_3",
4197
2806
  "Ruby" => "f1\nundef :x, :y, :z",
4198
- "RawParseTree" => [:block,
4199
- [:vcall, :f1],
4200
- [:block,
4201
- [:undef, [:lit, :x]],
4202
- [:undef, [:lit, :y]],
4203
- [:undef, [:lit, :z]],
4204
- ]],
4205
2807
  "ParseTree" => s(:block,
4206
2808
  s(:call, nil, :f1, s(:arglist)),
4207
2809
  s(:block,
@@ -4212,11 +2814,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4212
2814
 
4213
2815
  add_tests("undef_block_3_post",
4214
2816
  "Ruby" => "undef :x, :y, :z\nf2",
4215
- "RawParseTree" => [:block,
4216
- [:undef, [:lit, :x]],
4217
- [:undef, [:lit, :y]],
4218
- [:undef, [:lit, :z]],
4219
- [:vcall, :f2]],
4220
2817
  "ParseTree" => s(:block,
4221
2818
  s(:undef, s(:lit, :x)),
4222
2819
  s(:undef, s(:lit, :y)),
@@ -4226,13 +2823,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4226
2823
 
4227
2824
  add_tests("undef_block_wtf",
4228
2825
  "Ruby" => "f1\nundef :x, :y, :z\nf2",
4229
- "RawParseTree" => [:block,
4230
- [:vcall, :f1],
4231
- [:block,
4232
- [:undef, [:lit, :x]],
4233
- [:undef, [:lit, :y]],
4234
- [:undef, [:lit, :z]]],
4235
- [:vcall, :f2]],
4236
2826
  "ParseTree" => s(:block,
4237
2827
  s(:call, nil, :f1, s(:arglist)),
4238
2828
  s(:block,
@@ -4245,45 +2835,35 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4245
2835
 
4246
2836
  add_tests("unless_post",
4247
2837
  "Ruby" => "a unless b",
4248
- "RawParseTree" => [:if, [:vcall, :b], nil, [:vcall, :a]],
4249
2838
  "ParseTree" => s(:if, s(:call, nil, :b, s(:arglist)), nil,
4250
2839
  s(:call, nil, :a, s(:arglist))))
4251
2840
 
4252
2841
  add_tests("unless_post_not",
4253
2842
  "Ruby" => "a unless not b",
4254
- "RawParseTree" => [:if, [:vcall, :b], [:vcall, :a], nil],
4255
2843
  "ParseTree" => s(:if, s(:call, nil, :b, s(:arglist)),
4256
2844
  s(:call, nil, :a, s(:arglist)), nil),
4257
2845
  "Ruby2Ruby" => "a if b")
4258
2846
 
4259
2847
  add_tests("unless_pre",
4260
2848
  "Ruby" => "unless b then a end",
4261
- "RawParseTree" => [:if, [:vcall, :b], nil, [:vcall, :a]],
4262
2849
  "ParseTree" => s(:if, s(:call, nil, :b, s(:arglist)), nil,
4263
2850
  s(:call, nil, :a, s(:arglist))),
4264
2851
  "Ruby2Ruby" => "a unless b")
4265
2852
 
4266
2853
  add_tests("unless_pre_not",
4267
2854
  "Ruby" => "unless not b then a end",
4268
- "RawParseTree" => [:if, [:vcall, :b], [:vcall, :a], nil],
4269
2855
  "ParseTree" => s(:if, s(:call, nil, :b, s(:arglist)),
4270
2856
  s(:call, nil, :a, s(:arglist)), nil),
4271
2857
  "Ruby2Ruby" => "a if b")
4272
2858
 
4273
2859
  add_tests("until_post",
4274
2860
  "Ruby" => "begin\n (1 + 1)\nend until false",
4275
- "RawParseTree" => [:until, [:false],
4276
- [:call, [:lit, 1], :+,
4277
- [:array, [:lit, 1]]], false],
4278
2861
  "ParseTree" => s(:until, s(:false),
4279
2862
  s(:call, s(:lit, 1), :+,
4280
2863
  s(:arglist, s(:lit, 1))), false))
4281
2864
 
4282
2865
  add_tests("until_post_not",
4283
2866
  "Ruby" => "begin\n (1 + 1)\nend until not true",
4284
- "RawParseTree" => [:while, [:true],
4285
- [:call, [:lit, 1], :+,
4286
- [:array, [:lit, 1]]], false],
4287
2867
  "ParseTree" => s(:while, s(:true),
4288
2868
  s(:call, s(:lit, 1), :+,
4289
2869
  s(:arglist, s(:lit, 1))), false),
@@ -4291,18 +2871,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4291
2871
 
4292
2872
  add_tests("until_pre",
4293
2873
  "Ruby" => "until false do\n (1 + 1)\nend",
4294
- "RawParseTree" => [:until, [:false],
4295
- [:call, [:lit, 1], :+,
4296
- [:array, [:lit, 1]]], true],
4297
2874
  "ParseTree" => s(:until, s(:false),
4298
2875
  s(:call, s(:lit, 1), :+,
4299
2876
  s(:arglist, s(:lit, 1))), true))
4300
2877
 
4301
2878
  add_tests("until_pre_mod",
4302
2879
  "Ruby" => "(1 + 1) until false",
4303
- "RawParseTree" => [:until, [:false],
4304
- [:call, [:lit, 1], :+,
4305
- [:array, [:lit, 1]]], true],
4306
2880
  "ParseTree" => s(:until, s(:false),
4307
2881
  s(:call, s(:lit, 1), :+,
4308
2882
  s(:arglist, s(:lit, 1))), true),
@@ -4310,9 +2884,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4310
2884
 
4311
2885
  add_tests("until_pre_not",
4312
2886
  "Ruby" => "until not true do\n (1 + 1)\nend",
4313
- "RawParseTree" => [:while, [:true],
4314
- [:call, [:lit, 1], :+,
4315
- [:array, [:lit, 1]]], true],
4316
2887
  "ParseTree" => s(:while, s(:true),
4317
2888
  s(:call, s(:lit, 1), :+,
4318
2889
  s(:arglist, s(:lit, 1))), true),
@@ -4320,9 +2891,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4320
2891
 
4321
2892
  add_tests("until_pre_not_mod",
4322
2893
  "Ruby" => "(1 + 1) until not true",
4323
- "RawParseTree" => [:while, [:true],
4324
- [:call, [:lit, 1], :+,
4325
- [:array, [:lit, 1]]], true],
4326
2894
  "ParseTree" => s(:while, s(:true),
4327
2895
  s(:call, s(:lit, 1), :+,
4328
2896
  s(:arglist, s(:lit, 1))), true),
@@ -4330,30 +2898,20 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4330
2898
 
4331
2899
  add_tests("valias",
4332
2900
  "Ruby" => "alias $y $x",
4333
- "RawParseTree" => [:valias, :$y, :$x],
4334
2901
  "ParseTree" => s(:valias, :$y, :$x))
4335
2902
 
4336
2903
  add_tests("vcall",
4337
2904
  "Ruby" => "method",
4338
- "RawParseTree" => [:vcall, :method],
4339
2905
  "ParseTree" => s(:call, nil, :method, s(:arglist)))
4340
2906
 
4341
2907
  add_tests("while_post",
4342
2908
  "Ruby" => "begin\n (1 + 1)\nend while false",
4343
- "RawParseTree" => [:while, [:false],
4344
- [:call, [:lit, 1], :+,
4345
- [:array, [:lit, 1]]], false],
4346
2909
  "ParseTree" => s(:while, s(:false),
4347
2910
  s(:call, s(:lit, 1), :+,
4348
2911
  s(:arglist, s(:lit, 1))), false))
4349
2912
 
4350
2913
  add_tests("while_post2",
4351
2914
  "Ruby" => "begin\n (1 + 2)\n (3 + 4)\nend while false",
4352
- "RawParseTree" => [:while, [:false],
4353
- [:block,
4354
- [:call, [:lit, 1], :+, [:array, [:lit, 2]]],
4355
- [:call, [:lit, 3], :+, [:array, [:lit, 4]]]],
4356
- false],
4357
2915
  "ParseTree" => s(:while, s(:false),
4358
2916
  s(:block,
4359
2917
  s(:call, s(:lit, 1), :+,
@@ -4364,9 +2922,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4364
2922
 
4365
2923
  add_tests("while_post_not",
4366
2924
  "Ruby" => "begin\n (1 + 1)\nend while not true",
4367
- "RawParseTree" => [:until, [:true],
4368
- [:call, [:lit, 1], :+,
4369
- [:array, [:lit, 1]]], false],
4370
2925
  "ParseTree" => s(:until, s(:true),
4371
2926
  s(:call, s(:lit, 1), :+,
4372
2927
  s(:arglist, s(:lit, 1))), false),
@@ -4374,18 +2929,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4374
2929
 
4375
2930
  add_tests("while_pre",
4376
2931
  "Ruby" => "while false do\n (1 + 1)\nend",
4377
- "RawParseTree" => [:while, [:false],
4378
- [:call, [:lit, 1], :+,
4379
- [:array, [:lit, 1]]], true],
4380
2932
  "ParseTree" => s(:while, s(:false),
4381
2933
  s(:call, s(:lit, 1), :+,
4382
2934
  s(:arglist, s(:lit, 1))), true))
4383
2935
 
4384
2936
  add_tests("while_pre_mod",
4385
2937
  "Ruby" => "(1 + 1) while false",
4386
- "RawParseTree" => [:while, [:false],
4387
- [:call, [:lit, 1], :+,
4388
- [:array, [:lit, 1]]], true],
4389
2938
  "ParseTree" => s(:while, s(:false),
4390
2939
  s(:call, s(:lit, 1), :+,
4391
2940
  s(:arglist, s(:lit, 1))), true),
@@ -4393,14 +2942,10 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4393
2942
 
4394
2943
  add_tests("while_pre_nil",
4395
2944
  "Ruby" => "while false do\nend",
4396
- "RawParseTree" => [:while, [:false], nil, true],
4397
2945
  "ParseTree" => s(:while, s(:false), nil, true))
4398
2946
 
4399
2947
  add_tests("while_pre_not",
4400
2948
  "Ruby" => "while not true do\n (1 + 1)\nend",
4401
- "RawParseTree" => [:until, [:true],
4402
- [:call, [:lit, 1], :+,
4403
- [:array, [:lit, 1]]], true],
4404
2949
  "ParseTree" => s(:until, s(:true),
4405
2950
  s(:call, s(:lit, 1), :+,
4406
2951
  s(:arglist, s(:lit, 1))), true),
@@ -4408,9 +2953,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4408
2953
 
4409
2954
  add_tests("while_pre_not_mod",
4410
2955
  "Ruby" => "(1 + 1) while not true",
4411
- "RawParseTree" => [:until, [:true],
4412
- [:call, [:lit, 1], :+,
4413
- [:array, [:lit, 1]]], true],
4414
2956
  "ParseTree" => s(:until, s(:true),
4415
2957
  s(:call, s(:lit, 1), :+,
4416
2958
  s(:arglist, s(:lit, 1))), true),
@@ -4418,48 +2960,38 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4418
2960
 
4419
2961
  add_tests("xstr",
4420
2962
  "Ruby" => "`touch 5`",
4421
- "RawParseTree" => [:xstr, 'touch 5'],
4422
2963
  "ParseTree" => s(:xstr, 'touch 5'))
4423
2964
 
4424
2965
  add_tests("yield_0",
4425
2966
  "Ruby" => "yield",
4426
- "RawParseTree" => [:yield],
4427
2967
  "ParseTree" => s(:yield))
4428
2968
 
4429
2969
  add_tests("yield_1",
4430
2970
  "Ruby" => "yield(42)",
4431
- "RawParseTree" => [:yield, [:lit, 42]],
4432
2971
  "ParseTree" => s(:yield, s(:lit, 42)))
4433
2972
 
4434
2973
  add_tests("yield_array_0",
4435
2974
  "Ruby" => "yield([])",
4436
- "RawParseTree" => [:yield, [:zarray], true],
4437
2975
  "ParseTree" => s(:yield, s(:array)))
4438
2976
 
4439
2977
  add_tests("yield_array_1",
4440
2978
  "Ruby" => "yield([42])",
4441
- "RawParseTree" => [:yield, [:array, [:lit, 42]], true],
4442
2979
  "ParseTree" => s(:yield, s(:array, s(:lit, 42))))
4443
2980
 
4444
2981
  add_tests("yield_array_n",
4445
2982
  "Ruby" => "yield([42, 24])",
4446
- "RawParseTree" => [:yield, [:array, [:lit, 42], [:lit, 24]], true],
4447
2983
  "ParseTree" => s(:yield, s(:array, s(:lit, 42), s(:lit, 24))))
4448
2984
 
4449
2985
  add_tests("yield_n",
4450
2986
  "Ruby" => "yield(42, 24)",
4451
- "RawParseTree" => [:yield, [:array, [:lit, 42], [:lit, 24]]],
4452
2987
  "ParseTree" => s(:yield, s(:lit, 42), s(:lit, 24)))
4453
2988
 
4454
2989
  add_tests("zarray",
4455
2990
  "Ruby" => "a = []",
4456
- "RawParseTree" => [:lasgn, :a, [:zarray]],
4457
2991
  "ParseTree" => s(:lasgn, :a, s(:array)))
4458
2992
 
4459
2993
  add_tests("zsuper",
4460
2994
  "Ruby" => "def x\n super\nend",
4461
- "RawParseTree" => [:defn, :x,
4462
- [:scope, [:block, [:args], [:zsuper]]]],
4463
2995
  "ParseTree" => s(:defn, :x, s(:args),
4464
2996
  s(:scope, s(:block, s(:zsuper)))))
4465
2997
 
@@ -4468,14 +3000,11 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4468
3000
  "ParseTree" => s(:if,
4469
3001
  s(:call, nil, :y, s(:arglist, s(:lit, :z))),
4470
3002
  s(:call, nil, :x, s(:arglist)),
4471
- nil))
3003
+ nil),
3004
+ "Ruby2Ruby" => "x if y(:z)")
4472
3005
 
4473
3006
  add_18tests("iter_args_ivar",
4474
3007
  "Ruby" => "a { |@a| 42 }",
4475
- "RawParseTree" => [:iter,
4476
- [:fcall, :a],
4477
- [:iasgn, :@a],
4478
- [:lit, 42]],
4479
3008
  "ParseTree" => s(:iter,
4480
3009
  s(:call, nil, :a, s(:arglist)),
4481
3010
  s(:iasgn, :@a),
@@ -4483,12 +3012,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4483
3012
 
4484
3013
  add_18tests("iter_masgn_args_ivar",
4485
3014
  "Ruby" => "a { |a, @b| 42 }",
4486
- "RawParseTree" => [:iter,
4487
- [:fcall, :a],
4488
- [:masgn,
4489
- [:array, [:dasgn_curr, :a], [:iasgn, :@b]],
4490
- nil, nil],
4491
- [:lit, 42]],
4492
3015
  "ParseTree" => s(:iter,
4493
3016
  s(:call, nil, :a, s(:arglist)),
4494
3017
  s(:masgn,
@@ -4497,19 +3020,16 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4497
3020
 
4498
3021
  add_18tests("str_question_control",
4499
3022
  "Ruby" => '?\M-\C-a',
4500
- "RawParseTree" => [:lit, 129],
4501
3023
  "ParseTree" => s(:lit, 129),
4502
3024
  "Ruby2Ruby" => "129")
4503
3025
 
4504
3026
  add_18tests("str_question_escape",
4505
3027
  "Ruby" => '?\n',
4506
- "RawParseTree" => [:lit, 10],
4507
3028
  "ParseTree" => s(:lit, 10),
4508
3029
  "Ruby2Ruby" => "10")
4509
3030
 
4510
3031
  add_18tests("str_question_literal",
4511
3032
  "Ruby" => '?a',
4512
- "RawParseTree" => [:lit, 97],
4513
3033
  "ParseTree" => s(:lit, 97),
4514
3034
  "Ruby2Ruby" => "97")
4515
3035
 
@@ -4531,13 +3051,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4531
3051
 
4532
3052
  add_19tests("call_arglist_norm_hash_colons",
4533
3053
  "Ruby" => "o.m(42, a: 1, b: 2)",
4534
- "RawParseTree" => [:call,
4535
- [:vcall, :o], :m,
4536
- [:array,
4537
- [:lit, 42],
4538
- [:hash,
4539
- [:lit, :a], [:lit, 1],
4540
- [:lit, :b], [:lit, 2]]]],
4541
3054
  "ParseTree" => s(:call,
4542
3055
  s(:call, nil, :o, s(:arglist)),
4543
3056
  :m,
@@ -4555,8 +3068,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4555
3068
 
4556
3069
  add_19tests("call_not_equal",
4557
3070
  "Ruby" => "a != b",
4558
- "RawParseTree" => [:call, [:vcall, :a], :"!=",
4559
- [:array, [:vcall, :b]]],
4560
3071
  "ParseTree" => s(:call,
4561
3072
  s(:call, nil, :a, s(:arglist)),
4562
3073
  :"!=",
@@ -4564,7 +3075,6 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4564
3075
 
4565
3076
  add_19tests("call_unary_not",
4566
3077
  "Ruby" => "!a",
4567
- "RawParseTree" => [:call, [:vcall, :a], :"!@"],
4568
3078
  "ParseTree" => s(:call,
4569
3079
  s(:call, nil, :a, s(:arglist)),
4570
3080
  :"!@", s(:arglist)))
@@ -4609,22 +3119,12 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4609
3119
 
4610
3120
  add_19tests("defn_args_splat_middle",
4611
3121
  "Ruby" => "def f(first, *middle, last)\n # do nothing\nend",
4612
- "RawParseTree" => [:defn, :f,
4613
- [:scope,
4614
- [:block,
4615
- [:args, :first, :"*middle", :last],
4616
- [:nil]]]],
4617
3122
  "ParseTree" => s(:defn, :f,
4618
3123
  s(:args, :first, :"*middle", :last),
4619
3124
  s(:scope, s(:block, s(:nil)))))
4620
3125
 
4621
3126
  add_19tests("fcall_arglist_hash_colons",
4622
3127
  "Ruby" => "m(a: 1, b: 2)",
4623
- "RawParseTree" => [:fcall, :m,
4624
- [:array,
4625
- [:hash,
4626
- [:lit, :a], [:lit, 1],
4627
- [:lit, :b], [:lit, 2]]]],
4628
3128
  "ParseTree" => s(:call, nil, :m,
4629
3129
  s(:arglist,
4630
3130
  s(:hash,
@@ -4633,196 +3133,172 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4633
3133
 
4634
3134
  add_19tests("hash_new",
4635
3135
  "Ruby" => "{ a: 1, b: 2 }",
4636
- "RawParseTree" => [:hash,
4637
- [:lit, :a], [:lit, 1],
4638
- [:lit, :b], [:lit, 2]],
4639
3136
  "ParseTree" => s(:hash,
4640
3137
  s(:lit, :a), s(:lit, 1),
4641
3138
  s(:lit, :b), s(:lit, 2)))
4642
3139
 
4643
3140
  add_19tests("hash_new_no_space",
4644
3141
  "Ruby" => "{a:1,b:2}",
4645
- "RawParseTree" => [:hash,
4646
- [:lit, :a], [:lit, 1],
4647
- [:lit, :b], [:lit, 2]],
4648
3142
  "ParseTree" => s(:hash,
4649
3143
  s(:lit, :a), s(:lit, 1),
4650
3144
  s(:lit, :b), s(:lit, 2)))
4651
3145
 
4652
- add_19tests("lambda_args_block",
4653
- "Ruby" => "lambda { |&block| block }",
4654
- "ParseTree" => s(:iter,
4655
- s(:call, nil, :lambda, s(:arglist)),
4656
- s(:lasgn, :"&block"),
4657
- s(:lvar, :block)))
4658
-
4659
- add_19tests("lambda_args_0",
4660
- "Ruby" => "->(){ (x + 1) }",
4661
- "RawParseTree" => [:iter,
4662
- [:fcall, :lambda],
4663
- 0,
4664
- [:call, [:vcall, :x], :+,
4665
- [:array, [:lit, 1]]]],
4666
- "ParseTree" => s(:iter,
4667
- s(:call, nil, :lambda, s(:arglist)),
4668
- 0,
4669
- s(:call,
4670
- s(:call, nil, :x, s(:arglist)),
4671
- :+,
4672
- s(:arglist, s(:lit, 1)))))
4673
-
4674
- add_19tests("lambda_args_1",
4675
- "Ruby" => "-> (x) { (x + 1) }",
4676
- "RawParseTree" => [:iter,
4677
- [:fcall, :lambda],
4678
- [:dasgn_curr, :x],
4679
- [:call, [:dvar, :x], :+, [:array, [:lit, 1]]]],
4680
- "ParseTree" => s(:iter,
4681
- s(:call, nil, :lambda, s(:arglist)),
4682
- s(:lasgn, :x),
4683
- s(:call, s(:lvar, :x), :+,
4684
- s(:arglist, s(:lit, 1)))))
4685
-
4686
- add_19tests("lambda_args_2",
4687
- "Ruby" => "-> (x, y) { (x + y) }",
4688
- "RawParseTree" => [:iter,
4689
- [:fcall, :lambda],
4690
- [:masgn, [:array,
4691
- [:dasgn_curr, :x],
4692
- [:dasgn_curr, :y]], nil, nil],
4693
- [:call, [:dvar, :x], :+,
4694
- [:array, [:dvar, :y]]]],
4695
- "ParseTree" => s(:iter,
4696
- s(:call, nil, :lambda, s(:arglist)),
4697
- s(:masgn,
4698
- s(:array,
4699
- s(:lasgn, :x),
4700
- s(:lasgn, :y))),
4701
- s(:call, s(:lvar, :x), :+,
4702
- s(:arglist, s(:lvar, :y)))))
4703
-
4704
- add_19tests("lambda_args_2_no_parens",
4705
- "Ruby" => "-> x, y { (x + y) }",
4706
- "RawParseTree" => [:iter,
4707
- [:fcall, :lambda],
4708
- [:masgn, [:array,
4709
- [:dasgn_curr, :x],
4710
- [:dasgn_curr, :y]], nil, nil],
4711
- [:call, [:dvar, :x], :+,
4712
- [:array, [:dvar, :y]]]],
4713
- "ParseTree" => s(:iter,
4714
- s(:call, nil, :lambda, s(:arglist)),
4715
- s(:masgn,
4716
- s(:array,
4717
- s(:lasgn, :x),
4718
- s(:lasgn, :y))),
4719
- s(:call, s(:lvar, :x), :+,
4720
- s(:arglist, s(:lvar, :y)))))
4721
-
4722
- add_19tests("lambda_args_no",
4723
- "Ruby" => "-> { (x + 1) }",
4724
- "RawParseTree" => [:iter,
4725
- [:fcall, :lambda],
4726
- nil,
4727
- [:call, [:vcall, :x], :+,
4728
- [:array, [:lit, 1]]]],
4729
- "ParseTree" => s(:iter,
4730
- s(:call, nil, :lambda, s(:arglist)),
4731
- nil,
4732
- s(:call, s(:call, nil, :x, s(:arglist)),
4733
- :+, s(:arglist, s(:lit, 1)))))
4734
-
4735
- add_19tests("lambda_args_no_do",
4736
- "Ruby" => "-> do (x + 1) end",
4737
- "RawParseTree" => [:iter,
4738
- [:fcall, :lambda],
4739
- nil,
4740
- [:call, [:vcall, :x], :+,
4741
- [:array, [:lit, 1]]]],
4742
- "ParseTree" => s(:iter,
4743
- s(:call, nil, :lambda, s(:arglist)),
4744
- nil,
4745
- s(:call, s(:call, nil, :x, s(:arglist)),
4746
- :+, s(:arglist, s(:lit, 1)))))
4747
-
4748
- add_19tests("lambda_args_0_do",
4749
- "Ruby" => "->() do (x + 1) end",
4750
- "RawParseTree" => [:iter,
4751
- [:fcall, :lambda],
4752
- 0,
4753
- [:call, [:vcall, :x], :+,
4754
- [:array, [:lit, 1]]]],
4755
- "ParseTree" => s(:iter,
4756
- s(:call, nil, :lambda, s(:arglist)),
4757
- 0,
4758
- s(:call,
4759
- s(:call, nil, :x, s(:arglist)),
4760
- :+,
4761
- s(:arglist, s(:lit, 1)))))
4762
-
4763
- add_19tests("lambda_args_1_do",
4764
- "Ruby" => "-> (x) do (x + 1) end",
4765
- "RawParseTree" => [:iter,
4766
- [:fcall, :lambda],
4767
- [:dasgn_curr, :x],
4768
- [:call, [:dvar, :x], :+, [:array, [:lit, 1]]]],
4769
- "ParseTree" => s(:iter,
4770
- s(:call, nil, :lambda, s(:arglist)),
4771
- s(:lasgn, :x),
4772
- s(:call, s(:lvar, :x), :+,
4773
- s(:arglist, s(:lit, 1)))))
4774
-
4775
- add_19tests("lambda_args_2_do",
4776
- "Ruby" => "-> (x, y) do (x + y) end",
4777
- "RawParseTree" => [:iter,
4778
- [:fcall, :lambda],
4779
- [:masgn, [:array,
4780
- [:dasgn_curr, :x],
4781
- [:dasgn_curr, :y]], nil, nil],
4782
- [:call, [:dvar, :x], :+,
4783
- [:array, [:dvar, :y]]]],
4784
- "ParseTree" => s(:iter,
4785
- s(:call, nil, :lambda, s(:arglist)),
4786
- s(:masgn,
4787
- s(:array,
4788
- s(:lasgn, :x),
4789
- s(:lasgn, :y))),
4790
- s(:call, s(:lvar, :x), :+,
4791
- s(:arglist, s(:lvar, :y)))))
4792
-
4793
- add_19tests("lambda_args_2_no_parens_do",
4794
- "Ruby" => "-> x, y do (x + y) end",
4795
- "RawParseTree" => [:iter,
4796
- [:fcall, :lambda],
4797
- [:masgn, [:array,
4798
- [:dasgn_curr, :x],
4799
- [:dasgn_curr, :y]], nil, nil],
4800
- [:call, [:dvar, :x], :+,
4801
- [:array, [:dvar, :y]]]],
4802
- "ParseTree" => s(:iter,
4803
- s(:call, nil, :lambda, s(:arglist)),
4804
- s(:masgn,
4805
- s(:array,
4806
- s(:lasgn, :x),
4807
- s(:lasgn, :y))),
4808
- s(:call, s(:lvar, :x), :+,
4809
- s(:arglist, s(:lvar, :y)))))
3146
+ add_tests("lambda_args_anon_star",
3147
+ "Ruby" => "lambda { |*| nil }",
3148
+ "ParseTree" => s(:iter,
3149
+ s(:call, nil, :lambda, s(:arglist)),
3150
+ s(:masgn, s(:array, s(:splat))),
3151
+ s(:nil)))
3152
+
3153
+ add_tests("lambda_args_anon_star_block",
3154
+ "Ruby" => "lambda { |*, &block| block }",
3155
+ "ParseTree" => s(:iter,
3156
+ s(:call, nil, :lambda, s(:arglist)),
3157
+ s(:masgn, s(:array,
3158
+ s(:splat),
3159
+ s(:lasgn, :"&block"))),
3160
+ s(:lvar, :block)))
3161
+
3162
+ add_tests("lambda_args_block",
3163
+ "Ruby" => "lambda { |&block| block }",
3164
+ "ParseTree" => s(:iter,
3165
+ s(:call, nil, :lambda, s(:arglist)),
3166
+ s(:lasgn, :"&block"),
3167
+ s(:lvar, :block)))
3168
+
3169
+ add_tests("lambda_args_norm_anon_star",
3170
+ "Ruby" => "lambda { |a, *| a }",
3171
+ "ParseTree" => s(:iter,
3172
+ s(:call, nil, :lambda, s(:arglist)),
3173
+ s(:masgn, s(:array,
3174
+ s(:lasgn, :a),
3175
+ s(:splat))),
3176
+ s(:lvar, :a)))
3177
+
3178
+ add_tests("lambda_args_norm_anon_star_block",
3179
+ "Ruby" => "lambda { |a, *, &block| block }",
3180
+ "ParseTree" => s(:iter,
3181
+ s(:call, nil, :lambda, s(:arglist)),
3182
+ s(:masgn, s(:array,
3183
+ s(:lasgn, :a),
3184
+ s(:splat),
3185
+ s(:lasgn, :"&block"))),
3186
+ s(:lvar, :block)))
3187
+
3188
+ add_tests("lambda_args_norm_block",
3189
+ "Ruby" => "lambda { |a, &block| block }",
3190
+ "ParseTree" => s(:iter,
3191
+ s(:call, nil, :lambda, s(:arglist)),
3192
+ s(:masgn, s(:array,
3193
+ s(:lasgn, :a),
3194
+ s(:lasgn, :"&block"))),
3195
+ s(:lvar, :block)))
3196
+
3197
+ add_tests("lambda_args_norm_comma",
3198
+ "Ruby" => "lambda { |a,| a }",
3199
+ "ParseTree" => s(:iter,
3200
+ s(:call, nil, :lambda, s(:arglist)),
3201
+ s(:lasgn, :a),
3202
+ s(:lvar, :a)),
3203
+ "Ruby2Ruby" => "lambda { |a| a }")
3204
+
3205
+ add_tests("lambda_args_norm_comma2",
3206
+ "Ruby" => "lambda { |a,b,| a }",
3207
+ "ParseTree" => s(:iter,
3208
+ s(:call, nil, :lambda, s(:arglist)),
3209
+ s(:masgn,
3210
+ s(:array, s(:lasgn, :a), s(:lasgn, :b))),
3211
+ s(:lvar, :a)),
3212
+ "Ruby2Ruby" => "lambda { |a, b| a }")
3213
+
3214
+ add_tests("lambda_args_norm_star",
3215
+ "Ruby" => "lambda { |a, *star| star }",
3216
+ "ParseTree" => s(:iter,
3217
+ s(:call, nil, :lambda, s(:arglist)),
3218
+ s(:masgn, s(:array,
3219
+ s(:lasgn, :a),
3220
+ s(:splat, s(:lasgn, :star)))),
3221
+ s(:lvar, :star)))
3222
+
3223
+ add_tests("lambda_args_norm_star_block",
3224
+ "Ruby" => "lambda { |a, *star, &block| block }",
3225
+ "ParseTree" => s(:iter,
3226
+ s(:call, nil, :lambda, s(:arglist)),
3227
+ s(:masgn, s(:array,
3228
+ s(:lasgn, :a),
3229
+ s(:splat, s(:lasgn, :star)),
3230
+ s(:lasgn, :"&block"))),
3231
+ s(:lvar, :block)))
3232
+
3233
+ add_tests("lambda_args_star",
3234
+ "Ruby" => "lambda { |*star| star }",
3235
+ "ParseTree" => s(:iter,
3236
+ s(:call, nil, :lambda, s(:arglist)),
3237
+ s(:masgn, s(:array,
3238
+ s(:splat, s(:lasgn, :star)))),
3239
+ s(:lvar, :star)))
3240
+
3241
+ add_tests("lambda_args_star_block",
3242
+ "Ruby" => "lambda { |*star, &block| block }",
3243
+ "ParseTree" => s(:iter,
3244
+ s(:call, nil, :lambda, s(:arglist)),
3245
+ s(:masgn, s(:array,
3246
+ s(:splat, s(:lasgn, :star)),
3247
+ s(:lasgn, :"&block"))),
3248
+ s(:lvar, :block)))
3249
+
3250
+ # REFACTOR: we've got 4 sets of edge cases w/ the same output
3251
+
3252
+ def self.add19_edgecases ruby, sexp, cases
3253
+ cases.each do |name, code|
3254
+ add_19tests name, "Ruby" => code, "ParseTree" => sexp, "Ruby2Ruby" => ruby
3255
+ end
3256
+ end
3257
+
3258
+ add19_edgecases("lambda { (x + 1) }",
3259
+ s(:iter,
3260
+ s(:call, nil, :lambda, s(:arglist)),
3261
+ 0,
3262
+ s(:call, s(:call, nil, :x, s(:arglist)),
3263
+ :+, s(:arglist, s(:lit, 1)))),
3264
+ "stabby_args_0" => "->() { (x + 1) }",
3265
+ "stabby_args_0_doend" => "->() do (x + 1) end",
3266
+ "stabby_args_0_no_parens" => "-> { (x + 1) }",
3267
+ "stabby_args_0_no_parens_doend" => "-> do (x + 1) end",
3268
+ "stabby_args_0_spacebar_broken" => "->{x+1}") # I hate you
3269
+
3270
+ add19_edgecases("lambda { |x| (x + 1) }",
3271
+ s(:iter,
3272
+ s(:call, nil, :lambda, s(:arglist)),
3273
+ s(:lasgn, :x),
3274
+ s(:call, s(:lvar, :x), :+, s(:arglist, s(:lit, 1)))),
3275
+ "stabby_args_1" => "->(x) { (x + 1) }",
3276
+ "stabby_args_1_doend" => "->(x) do (x + 1) end",
3277
+ "stabby_args_1_no_parens" => "-> x { (x + 1) }",
3278
+ "stabby_args_1_no_parens_doend" => "-> x do (x + 1) end")
3279
+
3280
+ add19_edgecases("lambda { |x, y| (x + y) }",
3281
+ s(:iter,
3282
+ s(:call, nil, :lambda, s(:arglist)),
3283
+ s(:masgn,
3284
+ s(:array,
3285
+ s(:lasgn, :x),
3286
+ s(:lasgn, :y))),
3287
+ s(:call, s(:lvar, :x), :+,
3288
+ s(:arglist, s(:lvar, :y)))),
3289
+ "stabby_args_2" => "->(x, y) { (x + y) }",
3290
+ "stabby_args_2_doend" => "->(x, y) do (x + y) end",
3291
+ "stabby_args_2_no_parens" => "-> x, y { (x + y) }",
3292
+ "stabby_args_2_no_parens_doend" => "-> x, y do (x + y) end")
4810
3293
 
4811
3294
  add_19tests("hash_new_with_keyword",
4812
3295
  "Ruby" => "{ true: 1, b: 2 }",
4813
- "RawParseTree" => [:hash,
4814
- [:lit, :true], [:lit, 1],
4815
- [:lit, :b], [:lit, 2]],
4816
3296
  "ParseTree" => s(:hash,
4817
3297
  s(:lit, :true), s(:lit, 1),
4818
3298
  s(:lit, :b), s(:lit, 2)))
4819
3299
 
4820
3300
  add_19tests("splat_fcall_middle",
4821
3301
  "Ruby" => "meth(1, *[2], 3)",
4822
- "RawParseTree" => [:fcall, :meth,
4823
- [:lit, 1],
4824
- [:splat, [:array, [:lit, 2]]],
4825
- [:lit, 3]],
4826
3302
  "ParseTree" => s(:call, nil, :meth,
4827
3303
  s(:arglist,
4828
3304
  s(:lit, 1),
@@ -4831,17 +3307,13 @@ class ParseTreeTestCase < MiniTest::Unit::TestCase
4831
3307
 
4832
3308
  add_19tests("str_question_control",
4833
3309
  "Ruby" => '?\M-\C-a',
4834
- "RawParseTree" => [:str, "\x81"],
4835
3310
  "ParseTree" => s(:str, "\x81"))
4836
3311
 
4837
3312
  add_19tests("str_question_escape",
4838
3313
  "Ruby" => '?\n',
4839
- "RawParseTree" => [:str, "\n"],
4840
3314
  "ParseTree" => s(:str, "\n"))
4841
3315
 
4842
3316
  add_19tests("str_question_literal",
4843
3317
  "Ruby" => '?a',
4844
- "RawParseTree" => [:str, "a"],
4845
3318
  "ParseTree" => s(:str, "a"))
4846
-
4847
3319
  end