rubinius-melbourne 2.0.1.0 → 2.1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +2 -9
  4. data/Gemfile +0 -4
  5. data/Rakefile +26 -19
  6. data/ext/rubinius/melbourne/extconf.rb +4 -3
  7. data/ext/rubinius/melbourne/grammar.cpp +2 -2
  8. data/ext/rubinius/melbourne/grammar.y +2 -2
  9. data/ext/rubinius/melbourne/melbourne.cpp +4 -5
  10. data/lib/rubinius/melbourne/version.rb +2 -2
  11. data/lib/rubinius/melbourne.rb +1 -21
  12. data/rubinius-melbourne.gemspec +6 -3
  13. data/spec/alias_spec.rb +13 -18
  14. data/spec/and_spec.rb +6 -12
  15. data/spec/array_spec.rb +28 -54
  16. data/spec/attrasgn_spec.rb +60 -85
  17. data/spec/back_ref_spec.rb +6 -8
  18. data/spec/call_spec.rb +137 -225
  19. data/spec/case_spec.rb +94 -112
  20. data/spec/cdecl_spec.rb +16 -28
  21. data/spec/class_spec.rb +28 -40
  22. data/spec/colon2_spec.rb +2 -4
  23. data/spec/colon3_spec.rb +2 -4
  24. data/spec/const_spec.rb +2 -4
  25. data/spec/custom/runner/relates.rb +4 -0
  26. data/spec/cvar_spec.rb +6 -12
  27. data/spec/cvasgn_spec.rb +20 -15
  28. data/spec/defined_spec.rb +57 -55
  29. data/spec/defn_spec.rb +218 -280
  30. data/spec/defs_spec.rb +30 -38
  31. data/spec/dot2_spec.rb +2 -4
  32. data/spec/dot3_spec.rb +2 -4
  33. data/spec/dregx_spec.rb +20 -34
  34. data/spec/dstr_spec.rb +87 -111
  35. data/spec/dsym_spec.rb +5 -7
  36. data/spec/dxstr_spec.rb +2 -4
  37. data/spec/ensure_spec.rb +32 -40
  38. data/spec/false_spec.rb +2 -4
  39. data/spec/flip2_spec.rb +22 -26
  40. data/spec/flip3_spec.rb +15 -17
  41. data/spec/for_spec.rb +25 -23
  42. data/spec/gasgn_spec.rb +4 -8
  43. data/spec/gvar_spec.rb +8 -16
  44. data/spec/hash_spec.rb +14 -18
  45. data/spec/iasgn_spec.rb +8 -14
  46. data/spec/if_spec.rb +50 -80
  47. data/spec/iter_spec.rb +328 -402
  48. data/spec/lasgn_spec.rb +143 -200
  49. data/spec/lit_spec.rb +20 -40
  50. data/spec/masgn_spec.rb +278 -309
  51. data/spec/match2_spec.rb +6 -10
  52. data/spec/match3_spec.rb +9 -13
  53. data/spec/match_spec.rb +2 -4
  54. data/spec/module_spec.rb +12 -16
  55. data/spec/nil_spec.rb +2 -4
  56. data/spec/not_spec.rb +6 -8
  57. data/spec/nth_ref_spec.rb +2 -4
  58. data/spec/op_asgn_spec.rb +118 -158
  59. data/spec/or_spec.rb +18 -24
  60. data/spec/postexe_spec.rb +2 -4
  61. data/spec/regex_spec.rb +11 -19
  62. data/spec/rescue_spec.rb +135 -143
  63. data/spec/return_spec.rb +19 -36
  64. data/spec/sclass_spec.rb +26 -25
  65. data/spec/spec_helper.rb +9 -0
  66. data/spec/str_spec.rb +25 -43
  67. data/spec/super_spec.rb +31 -49
  68. data/spec/true_spec.rb +2 -4
  69. data/spec/undef_spec.rb +38 -53
  70. data/spec/until_spec.rb +13 -105
  71. data/spec/valias_spec.rb +2 -4
  72. data/spec/while_spec.rb +35 -117
  73. data/spec/xstr_spec.rb +2 -4
  74. data/spec/yield_spec.rb +22 -42
  75. data/spec/zsuper_spec.rb +8 -16
  76. metadata +64 -22
  77. data/spec/cvdecl_spec.rb +0 -12
data/spec/iasgn_spec.rb CHANGED
@@ -1,25 +1,19 @@
1
1
  describe "A Iasgn node" do
2
- relates "@a = 4" do
3
- parse do
4
- [:iasgn, :@a, [:lit, 4]]
5
- end
2
+ parse "@a = 4" do
3
+ [:iasgn, :@a, [:lit, 4]]
6
4
  end
7
5
 
8
- relates "@a = *[1]" do
9
- parse do
10
- [:iasgn, :@a, [:svalue, [:splat, [:array, [:lit, 1]]]]]
11
- end
6
+ parse "@a = *[1]" do
7
+ [:iasgn, :@a, [:splat, [:array, [:lit, 1]]]]
12
8
  end
13
9
 
14
- relates <<-ruby do
10
+ parse <<-ruby do
15
11
  a = 1
16
12
  @a = a
17
13
  ruby
18
14
 
19
- parse do
20
- [:block,
21
- [:lasgn, :a, [:lit, 1]],
22
- [:iasgn, :@a, [:lvar, :a]]]
23
- end
15
+ [:block,
16
+ [:lasgn, :a, [:lit, 1]],
17
+ [:iasgn, :@a, [:lvar, :a]]]
24
18
  end
25
19
  end
data/spec/if_spec.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  describe "An If node" do
2
- relates <<-ruby do
2
+ parse <<-ruby do
3
3
  if true then
4
4
  10
5
5
  else
@@ -7,125 +7,95 @@ describe "An If node" do
7
7
  end
8
8
  ruby
9
9
 
10
- parse do
11
- [:if, [:true], [:lit, 10], [:lit, 12]]
12
- end
10
+ [:if, [:true], [:lit, 10], [:lit, 12]]
13
11
  end
14
12
 
15
- relates "if b then a end" do
16
- parse do
17
- [:if, [:call, nil, :b, [:arglist]], [:call, nil, :a, [:arglist]], nil]
18
- end
13
+ parse "if b then a end" do
14
+ [:if, [:call, nil, :b, [:arglist]], [:call, nil, :a, [:arglist]], nil]
19
15
  end
20
16
 
21
- relates <<-ruby do
17
+ parse <<-ruby do
22
18
  if (x = 5
23
19
  (x + 1)) then
24
20
  nil
25
21
  end
26
22
  ruby
27
23
 
28
- parse do
29
- [:if,
30
- [:block,
31
- [:lasgn, :x, [:lit, 5]],
32
- [:call, [:lvar, :x], :+, [:arglist, [:lit, 1]]]],
33
- [:nil],
34
- nil]
35
- end
24
+ [:if,
25
+ [:block,
26
+ [:lasgn, :x, [:lit, 5]],
27
+ [:call, [:lvar, :x], :+, [:arglist, [:lit, 1]]]],
28
+ [:nil],
29
+ nil]
36
30
  end
37
31
 
38
- relates <<-ruby do
32
+ parse <<-ruby do
39
33
  if x = obj.x then
40
34
  x.do_it
41
35
  end
42
36
  ruby
43
37
 
44
- parse do
45
- [:if,
46
- [:lasgn, :x, [:call, [:call, nil, :obj, [:arglist]], :x, [:arglist]]],
47
- [:call, [:lvar, :x], :do_it, [:arglist]],
48
- nil]
49
- end
38
+ [:if,
39
+ [:lasgn, :x, [:call, [:call, nil, :obj, [:arglist]], :x, [:arglist]]],
40
+ [:call, [:lvar, :x], :do_it, [:arglist]],
41
+ nil]
50
42
  end
51
43
 
52
- relates "return if false unless true" do
53
- parse do
54
- [:if, [:true], nil, [:if, [:false], [:return], nil]]
55
- end
44
+ parse "return if false unless true" do
45
+ [:if, [:true], [:nil], [:if, [:false], [:return], nil]]
56
46
  end
57
47
 
58
- relates "a if not b" do
59
- parse do
60
- [:if, [:call, nil, :b, [:arglist]], nil, [:call, nil, :a, [:arglist]]]
61
- end
48
+ parse "a if not b" do
49
+ [:if,
50
+ [:call, [:call, nil, :b, [:arglist]], :!, [:arglist]],
51
+ [:call, nil, :a, [:arglist]],
52
+ nil]
62
53
  end
63
54
 
64
- relates "a if b" do
65
- parse do
66
- [:if, [:call, nil, :b, [:arglist]], [:call, nil, :a, [:arglist]], nil]
67
- end
55
+ parse "a if b" do
56
+ [:if, [:call, nil, :b, [:arglist]], [:call, nil, :a, [:arglist]], nil]
68
57
  end
69
58
 
70
- relates "if not b then a end" do
71
- parse do
72
- [:if, [:call, nil, :b, [:arglist]], nil, [:call, nil, :a, [:arglist]]]
73
- end
59
+ parse "if not b then a end" do
60
+ [:if,
61
+ [:call, [:call, nil, :b, [:arglist]], :!, [:arglist]],
62
+ [:call, nil, :a, [:arglist]],
63
+ nil]
74
64
  end
75
65
 
76
- relates "if b then a end" do
77
- parse do
78
- [:if, [:call, nil, :b, [:arglist]], [:call, nil, :a, [:arglist]], nil]
79
- end
66
+ parse "if b then a end" do
67
+ [:if, [:call, nil, :b, [:arglist]], [:call, nil, :a, [:arglist]], nil]
80
68
  end
81
69
 
82
70
  nil_condition_sexp = [:if, [:nil], [:call, nil, :a, [:arglist]], nil]
83
71
 
84
- relates "a if ()" do
85
- parse do
86
- nil_condition_sexp
87
- end
72
+ parse "a if ()" do
73
+ nil_condition_sexp
88
74
  end
89
75
 
90
- relates "if () then a end" do
91
- parse do
92
- nil_condition_sexp
93
- end
76
+ parse "if () then a end" do
77
+ nil_condition_sexp
94
78
  end
95
79
 
96
- relates "a unless not ()" do
97
- parse do
98
- nil_condition_sexp
99
- end
80
+ parse "a unless not b" do
81
+ [:if,
82
+ [:call, [:call, nil, :b, [:arglist]], :!, [:arglist]],
83
+ [:nil],
84
+ [:call, nil, :a, [:arglist]]]
100
85
  end
101
86
 
102
- relates "unless not () then a end" do
103
- parse do
104
- nil_condition_sexp
105
- end
87
+ parse "a unless b" do
88
+ [:if, [:call, nil, :b, [:arglist]], [:nil], [:call, nil, :a, [:arglist]]]
106
89
  end
107
90
 
108
- relates "a unless not b" do
109
- parse do
110
- [:if, [:call, nil, :b, [:arglist]], [:call, nil, :a, [:arglist]], nil]
111
- end
91
+ parse "unless not b then a end" do
92
+ [:if,
93
+ [:call, [:call, nil, :b, [:arglist]], :!, [:arglist]],
94
+ [:nil],
95
+ [:call, nil, :a, [:arglist]]]
112
96
  end
113
97
 
114
- relates "a unless b" do
115
- parse do
116
- [:if, [:call, nil, :b, [:arglist]], nil, [:call, nil, :a, [:arglist]]]
117
- end
118
- end
119
-
120
- relates "unless not b then a end" do
121
- parse do
122
- [:if, [:call, nil, :b, [:arglist]], [:call, nil, :a, [:arglist]], nil]
123
- end
124
- end
125
-
126
- relates "unless b then a end" do
127
- parse do
128
- [:if, [:call, nil, :b, [:arglist]], nil, [:call, nil, :a, [:arglist]]]
129
- end
98
+ parse "unless b then a end" do
99
+ [:if, [:call, nil, :b, [:arglist]], [:nil], [:call, nil, :a, [:arglist]]]
130
100
  end
131
101
  end
data/spec/iter_spec.rb CHANGED
@@ -1,121 +1,113 @@
1
1
  describe "An Iter node" do
2
- relates "m { }" do
3
- parse do
4
- [:iter, [:call, nil, :m, [:arglist]], nil]
5
- end
2
+ parse "m { }" do
3
+ [:call, nil, :m, [:arglist, [:iter, [:args], [:nil]]]]
6
4
  end
7
5
 
8
- relates "m do end" do
9
- parse do
10
- [:iter, [:call, nil, :m, [:arglist]], nil]
11
- end
6
+ parse "m do end" do
7
+ [:call, nil, :m, [:arglist, [:iter, [:args], [:nil]]]]
12
8
  end
13
9
 
14
- relates "m { x }" do
15
- parse do
16
- [:iter,
17
- [:call, nil, :m, [:arglist]],
18
- nil,
19
- [:call, nil, :x, [:arglist]]]
20
- end
10
+ parse "m { x }" do
11
+ [:call, nil, :m, [:arglist, [:iter, [:args], [:call, nil, :x, [:arglist]]]]]
21
12
  end
22
13
 
23
- relates "m { || x }" do
24
- parse do
25
- [:iter,
26
- [:call, nil, :m, [:arglist]],
27
- 0,
28
- [:call, nil, :x, [:arglist]]]
29
- end
14
+ parse "m { || x }" do
15
+ [:call, nil, :m, [:arglist, [:iter, [:args], [:call, nil, :x, [:arglist]]]]]
30
16
  end
31
17
 
32
- relates "m { |a| a + x }" do
33
- parse do
18
+ parse "m { |a| a + x }" do
19
+ [:call,
20
+ nil,
21
+ :m,
22
+ [:arglist,
34
23
  [:iter,
35
- [:call, nil, :m, [:arglist]],
36
- [:lasgn, :a],
37
- [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]
38
- end
24
+ [:args, :a],
25
+ [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]]]
39
26
  end
40
27
 
41
- relates "m { |*| x }" do
42
- parse do
43
- [:iter,
44
- [:call, nil, :m, [:arglist]],
45
- [:masgn, [:array, [:splat]]],
46
- [:call, nil, :x, [:arglist]]]
47
- end
28
+ parse "m { |*| x }" do
29
+ [:call,
30
+ nil,
31
+ :m,
32
+ [:arglist, [:iter, [:args, :*], [:call, nil, :x, [:arglist]]]]]
48
33
  end
49
34
 
50
- relates "m { |*c| x; c }" do
51
- parse do
35
+ parse "m { |*c| x; c }" do
36
+ [:call,
37
+ nil,
38
+ :m,
39
+ [:arglist,
52
40
  [:iter,
53
- [:call, nil, :m, [:arglist]],
54
- [:masgn, [:array, [:splat, [:lasgn, :c]]]],
55
- [:block, [:call, nil, :x, [:arglist]], [:lvar, :c]]]
56
- end
41
+ [:args, :"*c"],
42
+ [:block, [:call, nil, :x, [:arglist]], [:lvar, :c]]]]]
57
43
  end
58
44
 
59
- relates "m { |a, | a + x }" do
60
- parse do
45
+ parse "m { |a, | a + x }" do
46
+ [:call,
47
+ nil,
48
+ :m,
49
+ [:arglist,
61
50
  [:iter,
62
- [:call, nil, :m, [:arglist]],
63
- [:masgn, [:array, [:lasgn, :a]]],
64
- [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]
65
- end
51
+ [:args, :a],
52
+ [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]]]
66
53
  end
67
54
 
68
- relates "m { |a, *| a + x }" do
69
- parse do
55
+ parse "m { |a, *| a + x }" do
56
+ [:call,
57
+ nil,
58
+ :m,
59
+ [:arglist,
70
60
  [:iter,
71
- [:call, nil, :m, [:arglist]],
72
- [:masgn, [:array, [:lasgn, :a], [:splat]]],
73
- [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]
74
- end
61
+ [:args, :a, :*],
62
+ [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]]]
75
63
  end
76
64
 
77
- relates "m { |a, *c| a + x; c }" do
78
- parse do
65
+ parse "m { |a, *c| a + x; c }" do
66
+ [:call,
67
+ nil,
68
+ :m,
69
+ [:arglist,
79
70
  [:iter,
80
- [:call, nil, :m, [:arglist]],
81
- [:masgn, [:array, [:lasgn, :a], [:splat, [:lasgn, :c]]]],
71
+ [:args, :a, :"*c"],
82
72
  [:block,
83
73
  [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]],
84
- [:lvar, :c]]]
85
- end
74
+ [:lvar, :c]]]]]
86
75
  end
87
76
 
88
- relates "m { |a, b| a + x; b }" do
89
- parse do
77
+ parse "m { |a, b| a + x; b }" do
78
+ [:call,
79
+ nil,
80
+ :m,
81
+ [:arglist,
90
82
  [:iter,
91
- [:call, nil, :m, [:arglist]],
92
- [:masgn, [:array, [:lasgn, :a], [:lasgn, :b]]],
83
+ [:args, :a, :b],
93
84
  [:block,
94
85
  [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]],
95
- [:lvar, :b]]]
96
- end
86
+ [:lvar, :b]]]]]
97
87
  end
98
88
 
99
- relates "m { |a, b, | a + x; b }" do
100
- parse do
89
+ parse "m { |a, b, | a + x; b }" do
90
+ [:call,
91
+ nil,
92
+ :m,
93
+ [:arglist,
101
94
  [:iter,
102
- [:call, nil, :m, [:arglist]],
103
- [:masgn, [:array, [:lasgn, :a], [:lasgn, :b]]],
95
+ [:args, :a, :b],
104
96
  [:block,
105
97
  [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]],
106
- [:lvar, :b]]]
107
- end
98
+ [:lvar, :b]]]]]
108
99
  end
109
100
 
110
- relates "m { |a, b, *| a + x; b }" do
111
- parse do
101
+ parse "m { |a, b, *| a + x; b }" do
102
+ [:call,
103
+ nil,
104
+ :m,
105
+ [:arglist,
112
106
  [:iter,
113
- [:call, nil, :m, [:arglist]],
114
- [:masgn, [:array, [:lasgn, :a], [:lasgn, :b], [:splat]]],
107
+ [:args, :a, :b, :*],
115
108
  [:block,
116
109
  [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]],
117
- [:lvar, :b]]]
118
- end
110
+ [:lvar, :b]]]]]
119
111
  end
120
112
 
121
113
  masgn_rest_arg_block = lambda do |g|
@@ -133,144 +125,147 @@ describe "An Iter node" do
133
125
  end
134
126
  end
135
127
 
136
- relates "m { |a, b, *c| a + x; b; c }" do
137
- parse do
128
+ parse "m { |a, b, *c| a + x; b; c }" do
129
+ [:call,
130
+ nil,
131
+ :m,
132
+ [:arglist,
138
133
  [:iter,
139
- [:call, nil, :m, [:arglist]],
140
- [:masgn, [:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]]],
134
+ [:args, :a, :b, :"*c"],
141
135
  [:block,
142
136
  [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]],
143
137
  [:lvar, :b],
144
- [:lvar, :c]]]
145
- end
138
+ [:lvar, :c]]]]]
146
139
  end
147
140
 
148
- relates "m do |a, b, *c| a + x; b; c end" do
149
- parse do
141
+ parse "m do |a, b, *c| a + x; b; c end" do
142
+ [:call,
143
+ nil,
144
+ :m,
145
+ [:arglist,
150
146
  [:iter,
151
- [:call, nil, :m, [:arglist]],
152
- [:masgn, [:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]]],
147
+ [:args, :a, :b, :"*c"],
153
148
  [:block,
154
149
  [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]],
155
150
  [:lvar, :b],
156
- [:lvar, :c]]]
157
- end
151
+ [:lvar, :c]]]]]
158
152
  end
159
153
 
160
- relates "m { n = 1; n }" do
161
- parse do
162
- [:iter,
163
- [:call, nil, :m, [:arglist]],
164
- nil,
165
- [:block, [:lasgn, :n, [:lit, 1]], [:lvar, :n]]]
166
- end
154
+ parse "m { n = 1; n }" do
155
+ [:call,
156
+ nil,
157
+ :m,
158
+ [:arglist, [:iter, [:args], [:block, [:lasgn, :n, [:lit, 1]], [:lvar, :n]]]]]
167
159
  end
168
160
 
169
- relates "m { n = 1; m { n } }" do
170
- parse do
161
+ parse "m { n = 1; m { n } }" do
162
+ [:call,
163
+ nil,
164
+ :m,
165
+ [:arglist,
171
166
  [:iter,
172
- [:call, nil, :m, [:arglist]],
173
- nil,
167
+ [:args],
174
168
  [:block,
175
169
  [:lasgn, :n, [:lit, 1]],
176
- [:iter, [:call, nil, :m, [:arglist]], nil, [:lvar, :n]]]]
177
- end
170
+ [:call, nil, :m, [:arglist, [:iter, [:args], [:lvar, :n]]]]]]]]
178
171
  end
179
172
 
180
- relates "n = 1; m { n = 2 }; n" do
181
- parse do
182
- [:block,
183
- [:lasgn, :n, [:lit, 1]],
184
- [:iter, [:call, nil, :m, [:arglist]], nil, [:lasgn, :n, [:lit, 2]]],
185
- [:lvar, :n]]
186
- end
173
+ parse "n = 1; m { n = 2 }; n" do
174
+ [:block,
175
+ [:lasgn, :n, [:lit, 1]],
176
+ [:call, nil, :m, [:arglist, [:iter, [:args], [:lasgn, :n, [:lit, 2]]]]],
177
+ [:lvar, :n]]
187
178
  end
188
179
 
189
- relates "m(a) { |b| a + x }" do
190
- parse do
180
+ parse "m(a) { |b| a + x }" do
181
+ [:call,
182
+ nil,
183
+ :m,
184
+ [:arglist,
185
+ [:call, nil, :a, [:arglist]],
191
186
  [:iter,
192
- [:call, nil, :m, [:arglist, [:call, nil, :a, [:arglist]]]],
193
- [:lasgn, :b],
187
+ [:args, :b],
194
188
  [:call,
195
189
  [:call, nil, :a, [:arglist]],
196
190
  :+,
197
- [:arglist, [:call, nil, :x, [:arglist]]]]]
198
- end
191
+ [:arglist, [:call, nil, :x, [:arglist]]]]]]]
199
192
  end
200
193
 
201
- relates <<-ruby do
194
+ parse <<-ruby do
202
195
  m { |a|
203
196
  a + x
204
197
  }
205
198
  ruby
206
199
 
207
- parse do
200
+ [:call,
201
+ nil,
202
+ :m,
203
+ [:arglist,
208
204
  [:iter,
209
- [:call, nil, :m, [:arglist]],
210
- [:lasgn, :a],
211
- [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]
212
- end
205
+ [:args, :a],
206
+ [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]]]
213
207
  end
214
208
 
215
- relates <<-ruby do
209
+ parse <<-ruby do
216
210
  m do |a|
217
211
  a + x
218
212
  end
219
213
  ruby
220
214
 
221
- parse do
215
+ [:call,
216
+ nil,
217
+ :m,
218
+ [:arglist,
222
219
  [:iter,
223
- [:call, nil, :m, [:arglist]],
224
- [:lasgn, :a],
225
- [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]
226
- end
220
+ [:args, :a],
221
+ [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]]]
227
222
  end
228
223
 
229
- relates "obj.m { |a| a + x }" do
230
- parse do
224
+ parse "obj.m { |a| a + x }" do
225
+ [:call,
226
+ [:call, nil, :obj, [:arglist]],
227
+ :m,
228
+ [:arglist,
231
229
  [:iter,
232
- [:call, [:call, nil, :obj, [:arglist]], :m, [:arglist]],
233
- [:lasgn, :a],
234
- [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]
235
- end
230
+ [:args, :a],
231
+ [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]]]
236
232
  end
237
233
 
238
- relates "obj.m(x) { |a| a + x }" do
239
- parse do
234
+ parse "obj.m(x) { |a| a + x }" do
235
+ [:call,
236
+ [:call, nil, :obj, [:arglist]],
237
+ :m,
238
+ [:arglist,
239
+ [:call, nil, :x, [:arglist]],
240
240
  [:iter,
241
- [:call,
242
- [:call, nil, :obj, [:arglist]],
243
- :m,
244
- [:arglist, [:call, nil, :x, [:arglist]]]],
245
- [:lasgn, :a],
246
- [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]
247
- end
241
+ [:args, :a],
242
+ [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]]]
248
243
  end
249
244
 
250
- relates "obj.m(a) { |a| a + x }" do
251
- parse do
245
+ parse "obj.m(a) { |a| a + x }" do
246
+ [:call,
247
+ [:call, nil, :obj, [:arglist]],
248
+ :m,
249
+ [:arglist,
250
+ [:call, nil, :a, [:arglist]],
252
251
  [:iter,
253
- [:call,
254
- [:call, nil, :obj, [:arglist]],
255
- :m,
256
- [:arglist, [:call, nil, :a, [:arglist]]]],
257
- [:lasgn, :a],
258
- [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]
259
- end
252
+ [:args, :a],
253
+ [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]]]
260
254
  end
261
255
 
262
- relates "a = 1; m { |a| a + x }" do
263
- parse do
264
- [:block,
265
- [:lasgn, :a, [:lit, 1]],
256
+ parse "a = 1; m { |a| a + x }" do
257
+ [:block,
258
+ [:lasgn, :a, [:lit, 1]],
259
+ [:call,
260
+ nil,
261
+ :m,
262
+ [:arglist,
266
263
  [:iter,
267
- [:call, nil, :m, [:arglist]],
268
- [:lasgn, :a],
269
- [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]]
270
- end
264
+ [:args, :a],
265
+ [:call, [:lvar, :a], :+, [:arglist, [:call, nil, :x, [:arglist]]]]]]]]
271
266
  end
272
267
 
273
- relates <<-ruby do
268
+ parse <<-ruby do
274
269
  x = nil
275
270
  m do |a|
276
271
  begin
@@ -283,331 +278,262 @@ describe "An Iter node" do
283
278
  end
284
279
  ruby
285
280
 
286
- parse do
287
- [:block,
288
- [:lasgn, :x, [:nil]],
281
+ [:block,
282
+ [:lasgn, :x, [:nil]],
283
+ [:call,
284
+ nil,
285
+ :m,
286
+ [:arglist,
289
287
  [:iter,
290
- [:call, nil, :m, [:arglist]],
291
- [:lasgn, :a],
288
+ [:args, :a],
292
289
  [:ensure,
293
290
  [:rescue,
294
291
  [:lvar, :x],
295
292
  [:resbody,
296
293
  [:array, [:const, :Exception], [:lasgn, :x, [:gvar, :$!]]],
297
- [:break]]],
298
- [:lasgn, :x, [:lvar, :a]]]]]
299
- end
294
+ [:break, [:nil]]]],
295
+ [:lasgn, :x, [:lvar, :a]]]]]]]
300
296
  end
301
297
 
302
- relates "m { next }" do
303
- parse do
304
- [:iter, [:call, nil, :m, [:arglist]], nil, [:next]]
305
- end
298
+ parse "m { next }" do
299
+ [:call, nil, :m, [:arglist, [:iter, [:args], [:next]]]]
306
300
  end
307
301
 
308
- relates "m { next if x }" do
309
- parse do
310
- [:iter,
311
- [:call, nil, :m, [:arglist]],
312
- nil,
313
- [:if, [:call, nil, :x, [:arglist]], [:next], nil]]
314
- end
302
+ parse "m { next if x }" do
303
+ [:call,
304
+ nil,
305
+ :m,
306
+ [:arglist,
307
+ [:iter, [:args], [:if, [:call, nil, :x, [:arglist]], [:next], nil]]]]
315
308
  end
316
309
 
317
- relates "m { next x }" do
318
- parse do
319
- [:iter,
320
- [:call, nil, :m, [:arglist]],
321
- nil,
322
- [:next, [:call, nil, :x, [:arglist]]]]
323
- end
310
+ parse "m { next x }" do
311
+ [:call,
312
+ nil,
313
+ :m,
314
+ [:arglist, [:iter, [:args], [:next, [:call, nil, :x, [:arglist]]]]]]
324
315
  end
325
316
 
326
- relates "m { x = 1; next x }" do
327
- parse do
328
- [:iter,
329
- [:call, nil, :m, [:arglist]],
330
- nil,
331
- [:block,
332
- [:lasgn, :x, [:lit, 1]],
333
- [:next, [:lvar, :x]]]]
334
- end
317
+ parse "m { x = 1; next x }" do
318
+ [:call,
319
+ nil,
320
+ :m,
321
+ [:arglist,
322
+ [:iter, [:args], [:block, [:lasgn, :x, [:lit, 1]], [:next, [:lvar, :x]]]]]]
335
323
  end
336
324
 
337
- relates "m { next [1] }" do
338
- parse do
339
- [:iter, [:call, nil, :m, [:arglist]], nil, [:next, [:array, [:lit, 1]]]]
340
- end
325
+ parse "m { next [1] }" do
326
+ [:call, nil, :m, [:arglist, [:iter, [:args], [:next, [:array, [:lit, 1]]]]]]
341
327
  end
342
328
 
343
- relates "m { next *[1] }" do
344
- parse do
345
- [:iter,
346
- [:call, nil, :m, [:arglist]],
347
- nil,
348
- [:next, [:svalue, [:splat, [:array, [:lit, 1]]]]]]
349
- end
329
+ parse "m { next *[1] }" do
330
+ [:call,
331
+ nil,
332
+ :m,
333
+ [:arglist, [:iter, [:args], [:next, [:splat, [:array, [:lit, 1]]]]]]]
350
334
  end
351
335
 
352
- relates "m { next [*[1]] }" do
353
- parse do
354
- [:iter,
355
- [:call, nil, :m, [:arglist]],
356
- nil,
357
- [:next, [:array, [:splat, [:array, [:lit, 1]]]]]]
358
- end
336
+ parse "m { next [*[1]] }" do
337
+ [:call,
338
+ nil,
339
+ :m,
340
+ [:arglist, [:iter, [:args], [:next, [:splat, [:array, [:lit, 1]]]]]]]
359
341
  end
360
342
 
361
- relates "m { next *[1, 2] }" do
362
- parse do
363
- [:iter,
364
- [:call, nil, :m, [:arglist]],
365
- nil,
366
- [:next, [:svalue, [:splat, [:array, [:lit, 1], [:lit, 2]]]]]]
367
- end
343
+ parse "m { next *[1, 2] }" do
344
+ [:call,
345
+ nil,
346
+ :m,
347
+ [:arglist,
348
+ [:iter, [:args], [:next, [:splat, [:array, [:lit, 1], [:lit, 2]]]]]]]
368
349
  end
369
350
 
370
- relates "m { next [*[1, 2]] }" do
371
- parse do
372
- [:iter,
373
- [:call, nil, :m, [:arglist]],
374
- nil,
375
- [:next, [:array, [:splat, [:array, [:lit, 1], [:lit, 2]]]]]]
376
- end
351
+ parse "m { next [*[1, 2]] }" do
352
+ [:call,
353
+ nil,
354
+ :m,
355
+ [:arglist,
356
+ [:iter, [:args], [:next, [:splat, [:array, [:lit, 1], [:lit, 2]]]]]]]
377
357
  end
378
358
 
379
- relates "m { break }" do
380
- parse do
381
- [:iter, [:call, nil, :m, [:arglist]], nil, [:break]]
382
- end
359
+ parse "m { break }" do
360
+ [:call, nil, :m, [:arglist, [:iter, [:args], [:break, [:nil]]]]]
383
361
  end
384
362
 
385
- relates "m { break if x }" do
386
- parse do
363
+ parse "m { break if x }" do
364
+ [:call,
365
+ nil,
366
+ :m,
367
+ [:arglist,
387
368
  [:iter,
388
- [:call, nil, :m, [:arglist]],
389
- nil,
390
- [:if, [:call, nil, :x, [:arglist]], [:break], nil]]
391
- end
369
+ [:args],
370
+ [:if, [:call, nil, :x, [:arglist]], [:break, [:nil]], nil]]]]
392
371
  end
393
372
 
394
- relates "m { break x }" do
395
- parse do
396
- [:iter,
397
- [:call, nil, :m, [:arglist]],
398
- nil,
399
- [:break, [:call, nil, :x, [:arglist]]]]
400
- end
373
+ parse "m { break x }" do
374
+ [:call,
375
+ nil,
376
+ :m,
377
+ [:arglist, [:iter, [:args], [:break, [:call, nil, :x, [:arglist]]]]]]
401
378
  end
402
379
 
403
- relates "m { x = 1; break x }" do
404
- parse do
405
- [:iter,
406
- [:call, nil, :m, [:arglist]],
407
- nil,
408
- [:block,
409
- [:lasgn, :x, [:lit, 1]],
410
- [:break, [:lvar, :x]]]]
411
- end
380
+ parse "m { x = 1; break x }" do
381
+ [:call,
382
+ nil,
383
+ :m,
384
+ [:arglist,
385
+ [:iter, [:args], [:block, [:lasgn, :x, [:lit, 1]], [:break, [:lvar, :x]]]]]]
412
386
  end
413
387
 
414
- relates "m { break [1] }" do
415
- parse do
416
- [:iter,
417
- [:call, nil, :m, [:arglist]],
418
- nil,
419
- [:break, [:array, [:lit, 1]]]]
420
- end
388
+ parse "m { break [1] }" do
389
+ [:call, nil, :m, [:arglist, [:iter, [:args], [:break, [:array, [:lit, 1]]]]]]
421
390
  end
422
391
 
423
- relates "m { break *[1] }" do
424
- parse do
425
- [:iter,
426
- [:call, nil, :m, [:arglist]],
427
- nil,
428
- [:break, [:svalue, [:splat, [:array, [:lit, 1]]]]]]
429
- end
392
+ parse "m { break *[1] }" do
393
+ [:call,
394
+ nil,
395
+ :m,
396
+ [:arglist, [:iter, [:args], [:break, [:splat, [:array, [:lit, 1]]]]]]]
430
397
  end
431
398
 
432
- relates "m { break [*[1]] }" do
433
- parse do
434
- [:iter,
435
- [:call, nil, :m, [:arglist]],
436
- nil,
437
- [:break, [:array, [:splat, [:array, [:lit, 1]]]]]]
438
- end
399
+ parse "m { break [*[1]] }" do
400
+ [:call,
401
+ nil,
402
+ :m,
403
+ [:arglist, [:iter, [:args], [:break, [:splat, [:array, [:lit, 1]]]]]]]
439
404
  end
440
405
 
441
- relates "m { break *[1, 2] }" do
442
- parse do
443
- [:iter,
444
- [:call, nil, :m, [:arglist]],
445
- nil,
446
- [:break, [:svalue, [:splat, [:array, [:lit, 1], [:lit, 2]]]]]]
447
- end
406
+ parse "m { break *[1, 2] }" do
407
+ [:call,
408
+ nil,
409
+ :m,
410
+ [:arglist,
411
+ [:iter, [:args], [:break, [:splat, [:array, [:lit, 1], [:lit, 2]]]]]]]
448
412
  end
449
413
 
450
- relates "m { break [*[1, 2]] }" do
451
- parse do
452
- [:iter,
453
- [:call, nil, :m, [:arglist]],
454
- nil,
455
- [:break, [:array, [:splat, [:array, [:lit, 1], [:lit, 2]]]]]]
456
- end
414
+ parse "m { break [*[1, 2]] }" do
415
+ [:call,
416
+ nil,
417
+ :m,
418
+ [:arglist,
419
+ [:iter, [:args], [:break, [:splat, [:array, [:lit, 1], [:lit, 2]]]]]]]
457
420
  end
458
421
 
459
- relates "m { return }" do
460
- parse do
461
- [:iter, [:call, nil, :m, [:arglist]], nil, [:return]]
462
- end
422
+ parse "m { return }" do
423
+ [:call, nil, :m, [:arglist, [:iter, [:args], [:return]]]]
463
424
  end
464
425
 
465
- relates "m { return if x }" do
466
- parse do
467
- [:iter,
468
- [:call, nil, :m, [:arglist]],
469
- nil,
470
- [:if, [:call, nil, :x, [:arglist]], [:return], nil]]
471
- end
426
+ parse "m { return if x }" do
427
+ [:call,
428
+ nil,
429
+ :m,
430
+ [:arglist,
431
+ [:iter, [:args], [:if, [:call, nil, :x, [:arglist]], [:return], nil]]]]
472
432
  end
473
433
 
474
- relates "m { return x }" do
475
- parse do
476
- [:iter,
477
- [:call, nil, :m, [:arglist]],
478
- nil,
479
- [:return, [:call, nil, :x, [:arglist]]]]
480
- end
434
+ parse "m { return x }" do
435
+ [:call,
436
+ nil,
437
+ :m,
438
+ [:arglist, [:iter, [:args], [:return, [:call, nil, :x, [:arglist]]]]]]
481
439
  end
482
440
 
483
- relates "m { x = 1; return x }" do
484
- parse do
485
- [:iter,
486
- [:call, nil, :m, [:arglist]],
487
- nil,
488
- [:block,
489
- [:lasgn, :x, [:lit, 1]],
490
- [:return, [:lvar, :x]]]]
491
- end
441
+ parse "m { x = 1; return x }" do
442
+ [:call,
443
+ nil,
444
+ :m,
445
+ [:arglist,
446
+ [:iter, [:args], [:block, [:lasgn, :x, [:lit, 1]], [:return, [:lvar, :x]]]]]]
492
447
  end
493
448
 
494
- relates "m { return [1] }" do
495
- parse do
496
- [:iter,
497
- [:call, nil, :m, [:arglist]],
498
- nil,
499
- [:return, [:array, [:lit, 1]]]]
500
- end
449
+ parse "m { return [1] }" do
450
+ [:call, nil, :m, [:arglist, [:iter, [:args], [:return, [:array, [:lit, 1]]]]]]
501
451
  end
502
452
 
503
- relates "m { return *[1] }" do
504
- parse do
505
- [:iter,
506
- [:call, nil, :m, [:arglist]],
507
- nil,
508
- [:return, [:svalue, [:splat, [:array, [:lit, 1]]]]]]
509
- end
453
+ parse "m { return *[1] }" do
454
+ [:call,
455
+ nil,
456
+ :m,
457
+ [:arglist, [:iter, [:args], [:return, [:splat, [:array, [:lit, 1]]]]]]]
510
458
  end
511
459
 
512
- relates "m { return [*[1]] }" do
513
- parse do
514
- [:iter,
515
- [:call, nil, :m, [:arglist]],
516
- nil,
517
- [:return, [:array, [:splat, [:array, [:lit, 1]]]]]]
518
- end
460
+ parse "m { return [*[1]] }" do
461
+ [:call,
462
+ nil,
463
+ :m,
464
+ [:arglist, [:iter, [:args], [:return, [:splat, [:array, [:lit, 1]]]]]]]
519
465
  end
520
466
 
521
- relates "m { return *[1, 2] }" do
522
- parse do
523
- [:iter,
524
- [:call, nil, :m, [:arglist]],
525
- nil,
526
- [:return, [:svalue, [:splat, [:array, [:lit, 1], [:lit, 2]]]]]]
527
- end
467
+ parse "m { return *[1, 2] }" do
468
+ [:call,
469
+ nil,
470
+ :m,
471
+ [:arglist,
472
+ [:iter, [:args], [:return, [:splat, [:array, [:lit, 1], [:lit, 2]]]]]]]
528
473
  end
529
474
 
530
- relates "m { return [*[1, 2]] }" do
531
- parse do
532
- [:iter,
533
- [:call, nil, :m, [:arglist]],
534
- nil,
535
- [:return, [:array, [:splat, [:array, [:lit, 1], [:lit, 2]]]]]]
536
- end
475
+ parse "m { return [*[1, 2]] }" do
476
+ [:call,
477
+ nil,
478
+ :m,
479
+ [:arglist,
480
+ [:iter, [:args], [:return, [:splat, [:array, [:lit, 1], [:lit, 2]]]]]]]
537
481
  end
538
482
 
539
- relates "m { redo }" do
540
- parse do
541
- [:iter, [:call, nil, :m, [:arglist]], nil, [:redo]]
542
- end
483
+ parse "m { redo }" do
484
+ [:call, nil, :m, [:arglist, [:iter, [:args], [:redo]]]]
543
485
  end
544
486
 
545
- relates "m { redo if x }" do
546
- parse do
547
- [:iter,
548
- [:call, nil, :m, [:arglist]],
549
- nil,
550
- [:if, [:call, nil, :x, [:arglist]], [:redo], nil]]
551
- end
487
+ parse "m { redo if x }" do
488
+ [:call,
489
+ nil,
490
+ :m,
491
+ [:arglist,
492
+ [:iter, [:args], [:if, [:call, nil, :x, [:arglist]], [:redo], nil]]]]
552
493
  end
553
494
 
554
- relates "m(a) { retry }" do
555
- parse do
556
- [:iter,
557
- [:call, nil, :m, [:arglist, [:call, nil, :a, [:arglist]]]],
558
- nil,
559
- [:retry]]
560
- end
561
-
562
- # TODO
495
+ parse "m(a) { retry }" do
496
+ [:call,
497
+ nil,
498
+ :m,
499
+ [:arglist, [:call, nil, :a, [:arglist]], [:iter, [:args], [:retry]]]]
563
500
  end
564
501
 
565
- relates "m(a) { retry if x }" do
566
- parse do
567
- [:iter,
568
- [:call, nil, :m, [:arglist, [:call, nil, :a, [:arglist]]]],
569
- nil,
570
- [:if, [:call, nil, :x, [:arglist]], [:retry], nil]]
571
- end
572
-
573
- # TODO
502
+ parse "m(a) { retry if x }" do
503
+ [:call,
504
+ nil,
505
+ :m,
506
+ [:arglist,
507
+ [:call, nil, :a, [:arglist]],
508
+ [:iter, [:args], [:if, [:call, nil, :x, [:arglist]], [:retry], nil]]]]
574
509
  end
575
510
 
576
- relates "break" do
577
- parse do
578
- [:break]
579
- end
511
+ parse "break" do
512
+ [:break, [:nil]]
580
513
  end
581
514
 
582
- relates "redo" do
583
- parse do
584
- [:redo]
585
- end
515
+ parse "redo" do
516
+ [:redo]
586
517
  end
587
518
 
588
- relates "retry" do
589
- parse do
590
- [:retry]
591
- end
519
+ parse "retry" do
520
+ [:retry]
592
521
  end
593
522
 
594
- relates "next" do
595
- parse do
596
- [:next]
597
- end
523
+ parse "next" do
524
+ [:next]
598
525
  end
599
526
 
600
- relates <<-ruby do
527
+ parse <<-ruby do
601
528
  def x(a)
602
529
  bar { super }
603
530
  end
604
531
  ruby
605
532
 
606
- parse do
607
- [:defn,
608
- :x,
609
- [:args, :a],
610
- [:scope, [:block, [:iter, [:call, nil, :bar, [:arglist]], nil, [:zsuper]]]]]
611
- end
533
+ [:defn,
534
+ :x,
535
+ [:args, :a],
536
+ [:scope,
537
+ [:block, [:call, nil, :bar, [:arglist, [:iter, [:args], [:zsuper]]]]]]]
612
538
  end
613
539
  end