rubinius-melbourne 2.0.0.19 → 2.0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +14 -0
- data/Gemfile +4 -0
- data/Rakefile +31 -0
- data/ext/rubinius/melbourne/extconf.rb +9 -2
- data/lib/rubinius/melbourne.rb +1 -1
- data/lib/rubinius/melbourne/version.rb +1 -1
- data/rubinius-melbourne.gemspec +5 -3
- data/spec/alias_spec.rb +40 -0
- data/spec/and_spec.rb +19 -0
- data/spec/array_spec.rb +81 -0
- data/spec/attrasgn_spec.rb +112 -0
- data/spec/back_ref_spec.rb +11 -0
- data/spec/call_spec.rb +298 -0
- data/spec/case_spec.rb +234 -0
- data/spec/cdecl_spec.rb +45 -0
- data/spec/class_spec.rb +83 -0
- data/spec/colon2_spec.rb +7 -0
- data/spec/colon3_spec.rb +7 -0
- data/spec/const_spec.rb +7 -0
- data/spec/custom/matchers/parse_as.rb +27 -0
- data/spec/custom/runner/relates.rb +83 -0
- data/spec/cvar_spec.rb +29 -0
- data/spec/cvasgn_spec.rb +30 -0
- data/spec/cvdecl_spec.rb +12 -0
- data/spec/default.mspec +4 -0
- data/spec/defined_spec.rb +117 -0
- data/spec/defn_spec.rb +554 -0
- data/spec/defs_spec.rb +81 -0
- data/spec/dot2_spec.rb +7 -0
- data/spec/dot3_spec.rb +7 -0
- data/spec/dregx_spec.rb +52 -0
- data/spec/dstr_spec.rb +169 -0
- data/spec/dsym_spec.rb +10 -0
- data/spec/dxstr_spec.rb +11 -0
- data/spec/ensure_spec.rb +117 -0
- data/spec/false_spec.rb +7 -0
- data/spec/flip2_spec.rb +43 -0
- data/spec/flip3_spec.rb +27 -0
- data/spec/for_spec.rb +61 -0
- data/spec/gasgn_spec.rb +13 -0
- data/spec/gvar_spec.rb +25 -0
- data/spec/hash_spec.rb +31 -0
- data/spec/iasgn_spec.rb +25 -0
- data/spec/if_spec.rb +131 -0
- data/spec/iter_spec.rb +613 -0
- data/spec/lasgn_spec.rb +377 -0
- data/spec/lit_spec.rb +61 -0
- data/spec/masgn_spec.rb +406 -0
- data/spec/match2_spec.rb +19 -0
- data/spec/match3_spec.rb +24 -0
- data/spec/match_spec.rb +7 -0
- data/spec/module_spec.rb +47 -0
- data/spec/nil_spec.rb +7 -0
- data/spec/not_spec.rb +17 -0
- data/spec/nth_ref_spec.rb +7 -0
- data/spec/op_asgn_spec.rb +246 -0
- data/spec/or_spec.rb +35 -0
- data/spec/postexe_spec.rb +7 -0
- data/spec/regex_spec.rb +28 -0
- data/spec/rescue_spec.rb +359 -0
- data/spec/return_spec.rb +57 -0
- data/spec/sclass_spec.rb +55 -0
- data/spec/str_spec.rb +97 -0
- data/spec/super_spec.rb +93 -0
- data/spec/true_spec.rb +7 -0
- data/spec/undef_spec.rb +98 -0
- data/spec/until_spec.rb +140 -0
- data/spec/valias_spec.rb +7 -0
- data/spec/while_spec.rb +192 -0
- data/spec/xstr_spec.rb +7 -0
- data/spec/yield_spec.rb +65 -0
- data/spec/zsuper_spec.rb +45 -0
- metadata +171 -13
data/spec/lasgn_spec.rb
ADDED
@@ -0,0 +1,377 @@
|
|
1
|
+
describe "An Lasgn node" do
|
2
|
+
relates "a = 1" do
|
3
|
+
parse do
|
4
|
+
[:lasgn, :a, [:lit, 1]]
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
relates "a = b, c, *d" do
|
9
|
+
parse do
|
10
|
+
[:lasgn,
|
11
|
+
:a,
|
12
|
+
[:svalue,
|
13
|
+
[:array,
|
14
|
+
[:call, nil, :b, [:arglist]],
|
15
|
+
[:call, nil, :c, [:arglist]],
|
16
|
+
[:splat, [:call, nil, :d, [:arglist]]]]]]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
relates "a = [b, *c]" do
|
21
|
+
parse do
|
22
|
+
[:lasgn,
|
23
|
+
:a,
|
24
|
+
[:array,
|
25
|
+
[:call, nil, :b, [:arglist]],
|
26
|
+
[:splat, [:call, nil, :c, [:arglist]]]]]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
relates <<-ruby do
|
31
|
+
x = (y = 1
|
32
|
+
(y + 2))
|
33
|
+
ruby
|
34
|
+
|
35
|
+
parse do
|
36
|
+
[:lasgn,
|
37
|
+
:x,
|
38
|
+
[:block,
|
39
|
+
[:lasgn, :y, [:lit, 1]],
|
40
|
+
[:call, [:lvar, :y], :+, [:arglist, [:lit, 2]]]]]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
relates <<-ruby do
|
45
|
+
a = []
|
46
|
+
a [42]
|
47
|
+
ruby
|
48
|
+
|
49
|
+
parse do
|
50
|
+
[:block,
|
51
|
+
[:lasgn, :a, [:array]],
|
52
|
+
[:call, [:lvar, :a], :[], [:arglist, [:lit, 42]]]]
|
53
|
+
end
|
54
|
+
|
55
|
+
# call index space
|
56
|
+
end
|
57
|
+
|
58
|
+
relates 'var = ["foo", "bar"]' do
|
59
|
+
parse do
|
60
|
+
[:lasgn, :var, [:array, [:str, "foo"], [:str, "bar"]]]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
relates "c = (2 + 3)" do
|
65
|
+
parse do
|
66
|
+
[:lasgn, :c, [:call, [:lit, 2], :+, [:arglist, [:lit, 3]]]]
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
relates "a = *[1]" do
|
71
|
+
parse do
|
72
|
+
[:lasgn, :a, [:svalue, [:splat, [:array, [:lit, 1]]]]]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
relates "a = *b" do
|
77
|
+
parse do
|
78
|
+
[:lasgn, :a, [:svalue, [:splat, [:call, nil, :b, [:arglist]]]]]
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
relates <<-ruby do
|
83
|
+
a = if c
|
84
|
+
begin
|
85
|
+
b
|
86
|
+
rescue
|
87
|
+
nil
|
88
|
+
end
|
89
|
+
end
|
90
|
+
a
|
91
|
+
ruby
|
92
|
+
|
93
|
+
parse do
|
94
|
+
[:block,
|
95
|
+
[:lasgn,
|
96
|
+
:a,
|
97
|
+
[:if,
|
98
|
+
[:call, nil, :c, [:arglist]],
|
99
|
+
[:rescue, [:call, nil, :b, [:arglist]], [:resbody, [:array], [:nil]]],
|
100
|
+
nil]],
|
101
|
+
[:lvar, :a]]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
relates "x = [*[1]]" do
|
106
|
+
parse do
|
107
|
+
[:lasgn, :x, [:array, [:splat, [:array, [:lit, 1]]]]]
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
relates "a = []" do
|
112
|
+
parse do
|
113
|
+
[:lasgn, :a, [:array]]
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
relates <<-ruby do
|
118
|
+
a = 12
|
119
|
+
a
|
120
|
+
ruby
|
121
|
+
|
122
|
+
parse do
|
123
|
+
[:block, [:lasgn, :a, [:lit, 12]], [:lvar, :a]]
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
relates <<-ruby do
|
128
|
+
name
|
129
|
+
name = 3
|
130
|
+
name
|
131
|
+
ruby
|
132
|
+
|
133
|
+
parse do
|
134
|
+
[:block,
|
135
|
+
[:call, nil, :name, [:arglist]],
|
136
|
+
[:lasgn, :name, [:lit, 3]],
|
137
|
+
[:lvar, :name]]
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
relates "a=12; b=13; true" do
|
142
|
+
parse do
|
143
|
+
[:block, [:lasgn, :a, [:lit, 12]], [:lasgn, :b, [:lit, 13]], [:true]]
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
relates <<-ruby do
|
148
|
+
def f
|
149
|
+
a = 1
|
150
|
+
end
|
151
|
+
ruby
|
152
|
+
|
153
|
+
parse do
|
154
|
+
[:defn, :f, [:args], [:scope, [:block, [:lasgn, :a, [:lit, 1]]]]]
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
relates <<-ruby do
|
159
|
+
def f(a)
|
160
|
+
a = 1
|
161
|
+
end
|
162
|
+
ruby
|
163
|
+
|
164
|
+
parse do
|
165
|
+
[:defn, :f, [:args, :a], [:scope, [:block, [:lasgn, :a, [:lit, 1]]]]]
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
relates <<-ruby do
|
170
|
+
def f
|
171
|
+
b { a = 1 }
|
172
|
+
end
|
173
|
+
ruby
|
174
|
+
|
175
|
+
parse do
|
176
|
+
[:defn,
|
177
|
+
:f,
|
178
|
+
[:args],
|
179
|
+
[:scope,
|
180
|
+
[:block,
|
181
|
+
[:iter, [:call, nil, :b, [:arglist]], nil, [:lasgn, :a, [:lit, 1]]]]]]
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
relates <<-ruby do
|
186
|
+
def f(a)
|
187
|
+
b { a = 2 }
|
188
|
+
end
|
189
|
+
ruby
|
190
|
+
|
191
|
+
parse do
|
192
|
+
[:defn,
|
193
|
+
:f,
|
194
|
+
[:args, :a],
|
195
|
+
[:scope,
|
196
|
+
[:block,
|
197
|
+
[:iter, [:call, nil, :b, [:arglist]], nil, [:lasgn, :a, [:lit, 2]]]]]]
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
relates <<-ruby do
|
202
|
+
def f
|
203
|
+
a = 1
|
204
|
+
b { a = 2 }
|
205
|
+
end
|
206
|
+
ruby
|
207
|
+
|
208
|
+
parse do
|
209
|
+
[:defn,
|
210
|
+
:f,
|
211
|
+
[:args],
|
212
|
+
[:scope,
|
213
|
+
[:block,
|
214
|
+
[:lasgn, :a, [:lit, 1]],
|
215
|
+
[:iter, [:call, nil, :b, [:arglist]], nil, [:lasgn, :a, [:lit, 2]]]]]]
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
relates <<-ruby do
|
220
|
+
def f
|
221
|
+
a
|
222
|
+
b { a = 1 }
|
223
|
+
end
|
224
|
+
ruby
|
225
|
+
|
226
|
+
parse do
|
227
|
+
[:defn,
|
228
|
+
:f,
|
229
|
+
[:args],
|
230
|
+
[:scope,
|
231
|
+
[:block,
|
232
|
+
[:call, nil, :a, [:arglist]],
|
233
|
+
[:iter, [:call, nil, :b, [:arglist]], nil, [:lasgn, :a, [:lit, 1]]]]]]
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
relates <<-ruby do
|
238
|
+
def f
|
239
|
+
b { a = 1 }
|
240
|
+
a
|
241
|
+
end
|
242
|
+
ruby
|
243
|
+
|
244
|
+
parse do
|
245
|
+
[:defn,
|
246
|
+
:f,
|
247
|
+
[:args],
|
248
|
+
[:scope,
|
249
|
+
[:block,
|
250
|
+
[:iter, [:call, nil, :b, [:arglist]], nil, [:lasgn, :a, [:lit, 1]]],
|
251
|
+
[:call, nil, :a, [:arglist]]]]]
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
relates <<-ruby do
|
256
|
+
def f
|
257
|
+
a = 1
|
258
|
+
b { a = 2 }
|
259
|
+
a
|
260
|
+
end
|
261
|
+
ruby
|
262
|
+
|
263
|
+
parse do
|
264
|
+
[:defn,
|
265
|
+
:f,
|
266
|
+
[:args],
|
267
|
+
[:scope,
|
268
|
+
[:block,
|
269
|
+
[:lasgn, :a, [:lit, 1]],
|
270
|
+
[:iter, [:call, nil, :b, [:arglist]], nil, [:lasgn, :a, [:lit, 2]]],
|
271
|
+
[:lvar, :a]]]]
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
relates <<-ruby do
|
276
|
+
class F
|
277
|
+
a = 1
|
278
|
+
end
|
279
|
+
ruby
|
280
|
+
|
281
|
+
parse do
|
282
|
+
[:class, :F, nil, [:scope, [:lasgn, :a, [:lit, 1]]]]
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
relates <<-ruby do
|
287
|
+
a = Object
|
288
|
+
class a::F
|
289
|
+
b = 1
|
290
|
+
end
|
291
|
+
ruby
|
292
|
+
|
293
|
+
parse do
|
294
|
+
[:block,
|
295
|
+
[:lasgn, :a, [:const, :Object]],
|
296
|
+
[:class, [:colon2, [:lvar, :a], :F], nil, [:scope, [:lasgn, :b, [:lit, 1]]]]]
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
relates <<-ruby do
|
301
|
+
a = Object
|
302
|
+
class F < a
|
303
|
+
b = 1
|
304
|
+
end
|
305
|
+
ruby
|
306
|
+
|
307
|
+
parse do
|
308
|
+
[:block,
|
309
|
+
[:lasgn, :a, [:const, :Object]],
|
310
|
+
[:class, :F, [:lvar, :a], [:scope, [:lasgn, :b, [:lit, 1]]]]]
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
relates <<-ruby do
|
315
|
+
class F
|
316
|
+
a = 1
|
317
|
+
def f
|
318
|
+
a = 1
|
319
|
+
end
|
320
|
+
end
|
321
|
+
ruby
|
322
|
+
|
323
|
+
parse do
|
324
|
+
[:class,
|
325
|
+
:F,
|
326
|
+
nil,
|
327
|
+
[:scope,
|
328
|
+
[:block,
|
329
|
+
[:lasgn, :a, [:lit, 1]],
|
330
|
+
[:defn, :f, [:args], [:scope, [:block, [:lasgn, :a, [:lit, 1]]]]]]]]
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
relates <<-ruby do
|
335
|
+
module M
|
336
|
+
a = 1
|
337
|
+
end
|
338
|
+
ruby
|
339
|
+
|
340
|
+
parse do
|
341
|
+
[:module, :M, [:scope, [:lasgn, :a, [:lit, 1]]]]
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
relates <<-ruby do
|
346
|
+
module M
|
347
|
+
a = 1
|
348
|
+
def f
|
349
|
+
a = 1
|
350
|
+
end
|
351
|
+
end
|
352
|
+
ruby
|
353
|
+
|
354
|
+
parse do
|
355
|
+
[:module,
|
356
|
+
:M,
|
357
|
+
[:scope,
|
358
|
+
[:block,
|
359
|
+
[:lasgn, :a, [:lit, 1]],
|
360
|
+
[:defn, :f, [:args], [:scope, [:block, [:lasgn, :a, [:lit, 1]]]]]]]]
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
relates <<-ruby do
|
365
|
+
a = Object
|
366
|
+
module a::M
|
367
|
+
b = 1
|
368
|
+
end
|
369
|
+
ruby
|
370
|
+
|
371
|
+
parse do
|
372
|
+
[:block,
|
373
|
+
[:lasgn, :a, [:const, :Object]],
|
374
|
+
[:module, [:colon2, [:lvar, :a], :M], [:scope, [:lasgn, :b, [:lit, 1]]]]]
|
375
|
+
end
|
376
|
+
end
|
377
|
+
end
|
data/spec/lit_spec.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
describe "A Lit node" do
|
2
|
+
relates "0b1111" do
|
3
|
+
parse do
|
4
|
+
[:lit, 15]
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
relates "1.1" do
|
9
|
+
parse do
|
10
|
+
[:lit, 1.1]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
relates "0xffffffffffffffff" do
|
15
|
+
parse do
|
16
|
+
[:lit, 18446744073709551615]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
relates "0xffff_ffff_ffff_ffff" do
|
21
|
+
parse do
|
22
|
+
[:lit, 18446744073709551615]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
relates "07654" do
|
27
|
+
parse do
|
28
|
+
[:lit, 4012]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
relates "-1" do
|
33
|
+
parse do
|
34
|
+
[:lit, -1]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
relates "1" do
|
39
|
+
parse do
|
40
|
+
[:lit, 1]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
relates "8000_0000" do
|
45
|
+
parse do
|
46
|
+
[:lit, 80000000]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
relates ":x" do
|
51
|
+
parse do
|
52
|
+
[:lit, :x]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
relates ":\"*args\"" do
|
57
|
+
parse do
|
58
|
+
[:lit, :"*args"]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/spec/masgn_spec.rb
ADDED
@@ -0,0 +1,406 @@
|
|
1
|
+
describe "A Masgn node" do
|
2
|
+
relates "a, b.c = b.c, true" do
|
3
|
+
parse do
|
4
|
+
[:masgn,
|
5
|
+
[:array,
|
6
|
+
[:lasgn, :a],
|
7
|
+
[:attrasgn, [:call, nil, :b, [:arglist]], :c=, [:arglist]]],
|
8
|
+
[:array, [:call, [:call, nil, :b, [:arglist]], :c, [:arglist]], [:true]]]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
relates "a, b = 1, 2, 3" do
|
13
|
+
parse do
|
14
|
+
[:masgn,
|
15
|
+
[:array, [:lasgn, :a], [:lasgn, :b]],
|
16
|
+
[:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
relates "a, b = c, d" do
|
21
|
+
parse do
|
22
|
+
[:masgn,
|
23
|
+
[:array, [:lasgn, :a], [:lasgn, :b]],
|
24
|
+
[:array, [:call, nil, :c, [:arglist]], [:call, nil, :d, [:arglist]]]]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
relates "a, b, *c = 1, 2, *[3, 4]" do
|
29
|
+
parse do
|
30
|
+
[:masgn,
|
31
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]],
|
32
|
+
[:array, [:lit, 1], [:lit, 2], [:splat, [:array, [:lit, 3], [:lit, 4]]]]]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
relates "a.b, a.c, _ = q" do
|
37
|
+
parse do
|
38
|
+
[:masgn,
|
39
|
+
[:array,
|
40
|
+
[:attrasgn, [:call, nil, :a, [:arglist]], :b=, [:arglist]],
|
41
|
+
[:attrasgn, [:call, nil, :a, [:arglist]], :c=, [:arglist]],
|
42
|
+
[:lasgn, :_]],
|
43
|
+
[:to_ary, [:call, nil, :q, [:arglist]]]]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
relates <<-ruby do
|
48
|
+
a, i, j = [], 1, 2
|
49
|
+
a[i], a[j] = a[j], a[i]
|
50
|
+
ruby
|
51
|
+
|
52
|
+
parse do
|
53
|
+
[:block,
|
54
|
+
[:masgn,
|
55
|
+
[:array, [:lasgn, :a], [:lasgn, :i], [:lasgn, :j]],
|
56
|
+
[:array, [:array], [:lit, 1], [:lit, 2]]],
|
57
|
+
[:masgn,
|
58
|
+
[:array,
|
59
|
+
[:attrasgn, [:lvar, :a], :[]=, [:arglist, [:lvar, :i]]],
|
60
|
+
[:attrasgn, [:lvar, :a], :[]=, [:arglist, [:lvar, :j]]]],
|
61
|
+
[:array,
|
62
|
+
[:call, [:lvar, :a], :[], [:arglist, [:lvar, :j]]],
|
63
|
+
[:call, [:lvar, :a], :[], [:arglist, [:lvar, :i]]]]]]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
relates <<-ruby do
|
68
|
+
c, d, e, f = [], 1, 2, 3
|
69
|
+
a, *b = c[d] = f(e, f, c)
|
70
|
+
ruby
|
71
|
+
|
72
|
+
parse do
|
73
|
+
[:block,
|
74
|
+
[:masgn,
|
75
|
+
[:array, [:lasgn, :c], [:lasgn, :d], [:lasgn, :e], [:lasgn, :f]],
|
76
|
+
[:array, [:array], [:lit, 1], [:lit, 2], [:lit, 3]]],
|
77
|
+
[:masgn,
|
78
|
+
[:array, [:lasgn, :a], [:splat, [:lasgn, :b]]],
|
79
|
+
[:to_ary,
|
80
|
+
[:attrasgn,
|
81
|
+
[:lvar, :c],
|
82
|
+
:[]=,
|
83
|
+
[:arglist,
|
84
|
+
[:lvar, :d],
|
85
|
+
[:call, nil, :f, [:arglist, [:lvar, :e], [:lvar, :f], [:lvar, :c]]]]]]]]
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
relates "a, b.c = d, e" do
|
90
|
+
parse do
|
91
|
+
[:masgn,
|
92
|
+
[:array,
|
93
|
+
[:lasgn, :a],
|
94
|
+
[:attrasgn, [:call, nil, :b, [:arglist]], :c=, [:arglist]]],
|
95
|
+
[:array, [:call, nil, :d, [:arglist]], [:call, nil, :e, [:arglist]]]]
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
relates "*a.m = *b" do
|
100
|
+
parse do
|
101
|
+
[:masgn,
|
102
|
+
[:array,
|
103
|
+
[:splat, [:attrasgn, [:call, nil, :a, [:arglist]], :m=, [:arglist]]]],
|
104
|
+
[:splat, [:call, nil, :b, [:arglist]]]]
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
relates "*a.m = b" do
|
109
|
+
parse do
|
110
|
+
[:masgn,
|
111
|
+
[:array,
|
112
|
+
[:splat, [:attrasgn, [:call, nil, :a, [:arglist]], :m=, [:arglist]]]],
|
113
|
+
[:to_ary, [:call, nil, :b, [:arglist]]]]
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
relates "A, B, C = 1, 2, 3" do
|
118
|
+
parse do
|
119
|
+
[:masgn,
|
120
|
+
[:array, [:cdecl, :A], [:cdecl, :B], [:cdecl, :C]],
|
121
|
+
[:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
relates "* = 1, 2" do
|
126
|
+
parse do
|
127
|
+
[:masgn, [:array, [:splat]], [:array, [:lit, 1], [:lit, 2]]]
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
relates "*$a = b" do
|
132
|
+
parse do
|
133
|
+
[:masgn,
|
134
|
+
[:array, [:splat, [:gasgn, :$a]]],
|
135
|
+
[:to_ary, [:call, nil, :b, [:arglist]]]]
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
relates "*$a = *b" do
|
140
|
+
parse do
|
141
|
+
[:masgn,
|
142
|
+
[:array, [:splat, [:gasgn, :$a]]],
|
143
|
+
[:splat, [:call, nil, :b, [:arglist]]]]
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
relates "a, @b = c, d" do
|
148
|
+
parse do
|
149
|
+
[:masgn,
|
150
|
+
[:array, [:lasgn, :a], [:iasgn, :@b]],
|
151
|
+
[:array, [:call, nil, :c, [:arglist]], [:call, nil, :d, [:arglist]]]]
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
relates "*@a = b" do
|
156
|
+
parse do
|
157
|
+
[:masgn,
|
158
|
+
[:array, [:splat, [:iasgn, :@a]]],
|
159
|
+
[:to_ary, [:call, nil, :b, [:arglist]]]]
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
relates "*@a = *b" do
|
164
|
+
parse do
|
165
|
+
[:masgn,
|
166
|
+
[:array, [:splat, [:iasgn, :@a]]],
|
167
|
+
[:splat, [:call, nil, :b, [:arglist]]]]
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
relates "@a, $b = 1, 2" do
|
172
|
+
parse do
|
173
|
+
[:masgn,
|
174
|
+
[:array, [:iasgn, :@a], [:gasgn, :$b]],
|
175
|
+
[:array, [:lit, 1], [:lit, 2]]]
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
relates "a, b = (@a = 1), @a" do
|
180
|
+
parse do
|
181
|
+
[:masgn,
|
182
|
+
[:array, [:lasgn, :a], [:lasgn, :b]],
|
183
|
+
[:array, [:iasgn, :@a, [:lit, 1]], [:ivar, :@a]]]
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
relates "@@a, @@b = 1, 2" do
|
188
|
+
parse do
|
189
|
+
[:masgn,
|
190
|
+
[:array, [:cvdecl, :@@a], [:cvdecl, :@@b]],
|
191
|
+
[:array, [:lit, 1], [:lit, 2]]]
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
relates "a, b, *c = 1, 2, 3" do
|
196
|
+
parse do
|
197
|
+
[:masgn,
|
198
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]],
|
199
|
+
[:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
relates "a, b, *c = 1, 2" do
|
204
|
+
# TODO
|
205
|
+
end
|
206
|
+
|
207
|
+
relates "a, b, c, *d = 1, 2" do
|
208
|
+
# TODO
|
209
|
+
end
|
210
|
+
|
211
|
+
relates "a, b, c = *d" do
|
212
|
+
parse do
|
213
|
+
[:masgn,
|
214
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:lasgn, :c]],
|
215
|
+
[:splat, [:call, nil, :d, [:arglist]]]]
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
relates "a, b, c = 1, *d" do
|
220
|
+
parse do
|
221
|
+
[:masgn,
|
222
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:lasgn, :c]],
|
223
|
+
[:array, [:lit, 1], [:splat, [:call, nil, :d, [:arglist]]]]]
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
relates "a, b, *c = *d" do
|
228
|
+
parse do
|
229
|
+
[:masgn,
|
230
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]],
|
231
|
+
[:splat, [:call, nil, :d, [:arglist]]]]
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
relates "*a = 1, 2, 3" do
|
236
|
+
parse do
|
237
|
+
[:masgn,
|
238
|
+
[:array, [:splat, [:lasgn, :a]]],
|
239
|
+
[:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
relates "*a = b" do
|
244
|
+
parse do
|
245
|
+
[:masgn,
|
246
|
+
[:array, [:splat, [:lasgn, :a]]],
|
247
|
+
[:to_ary, [:call, nil, :b, [:arglist]]]]
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
relates "*a = *b" do
|
252
|
+
parse do
|
253
|
+
[:masgn,
|
254
|
+
[:array, [:splat, [:lasgn, :a]]],
|
255
|
+
[:splat, [:call, nil, :b, [:arglist]]]]
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
relates "a, (b, c) = [1, [2, 3]]" do
|
260
|
+
parse do
|
261
|
+
[:masgn,
|
262
|
+
[:array, [:lasgn, :a], [:masgn, [:array, [:lasgn, :b], [:lasgn, :c]]]],
|
263
|
+
[:to_ary, [:array, [:lit, 1], [:array, [:lit, 2], [:lit, 3]]]]]
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
relates "a, = *[[[1]]]" do
|
268
|
+
parse do
|
269
|
+
[:masgn,
|
270
|
+
[:array, [:lasgn, :a]],
|
271
|
+
[:splat, [:array, [:array, [:array, [:lit, 1]]]]]]
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
relates "a, b, * = c" do
|
276
|
+
parse do
|
277
|
+
[:masgn,
|
278
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat]],
|
279
|
+
[:to_ary, [:call, nil, :c, [:arglist]]]]
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
relates "a, b, = c" do
|
284
|
+
parse do
|
285
|
+
[:masgn,
|
286
|
+
[:array, [:lasgn, :a], [:lasgn, :b]],
|
287
|
+
[:to_ary, [:call, nil, :c, [:arglist]]]]
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
relates "a, b, c = m d" do
|
292
|
+
parse do
|
293
|
+
[:masgn,
|
294
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:lasgn, :c]],
|
295
|
+
[:to_ary, [:call, nil, :m, [:arglist, [:call, nil, :d, [:arglist]]]]]]
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
relates "a, b, *c = d, e, f, g" do
|
300
|
+
|
301
|
+
parse do
|
302
|
+
[:masgn,
|
303
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]],
|
304
|
+
[:array,
|
305
|
+
[:call, nil, :d, [:arglist]],
|
306
|
+
[:call, nil, :e, [:arglist]],
|
307
|
+
[:call, nil, :f, [:arglist]],
|
308
|
+
[:call, nil, :g, [:arglist]]]]
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
relates "a, b, *c = d.e(\"f\")" do
|
313
|
+
parse do
|
314
|
+
[:masgn,
|
315
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]],
|
316
|
+
[:to_ary, [:call, [:call, nil, :d, [:arglist]], :e, [:arglist, [:str, "f"]]]]]
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
relates "a, b, *c = d" do
|
321
|
+
parse do
|
322
|
+
[:masgn,
|
323
|
+
[:array, [:lasgn, :a], [:lasgn, :b], [:splat, [:lasgn, :c]]],
|
324
|
+
[:to_ary, [:call, nil, :d, [:arglist]]]]
|
325
|
+
end
|
326
|
+
end
|
327
|
+
|
328
|
+
relates "a, b = c" do
|
329
|
+
parse do
|
330
|
+
[:masgn,
|
331
|
+
[:array, [:lasgn, :a], [:lasgn, :b]],
|
332
|
+
[:to_ary, [:call, nil, :c, [:arglist]]]]
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
relates <<-ruby do
|
337
|
+
m do
|
338
|
+
a, b = 1, 2
|
339
|
+
next
|
340
|
+
end
|
341
|
+
ruby
|
342
|
+
|
343
|
+
parse do
|
344
|
+
[:iter,
|
345
|
+
[:call, nil, :m, [:arglist]],
|
346
|
+
nil,
|
347
|
+
[:block,
|
348
|
+
[:masgn,
|
349
|
+
[:array, [:lasgn, :a], [:lasgn, :b]],
|
350
|
+
[:array, [:lit, 1], [:lit, 2]]],
|
351
|
+
[:next]]]
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
relates "a, (b, c) = 1" do
|
356
|
+
# TODO
|
357
|
+
end
|
358
|
+
|
359
|
+
relates "a, (b, c) = *1" do
|
360
|
+
# TODO
|
361
|
+
end
|
362
|
+
|
363
|
+
relates "a, (b, c) = 1, 2, 3" do
|
364
|
+
# TODO
|
365
|
+
end
|
366
|
+
|
367
|
+
relates "a, (b, *c), d = 1, 2, 3, 4" do
|
368
|
+
# TODO
|
369
|
+
end
|
370
|
+
|
371
|
+
relates "a, (b, c) = 1, *2" do
|
372
|
+
# TODO
|
373
|
+
end
|
374
|
+
|
375
|
+
relates "a, (b, *c) = 1" do
|
376
|
+
# TODO
|
377
|
+
end
|
378
|
+
|
379
|
+
relates "a, (b, *c) = 1, 2" do
|
380
|
+
# TODO
|
381
|
+
end
|
382
|
+
|
383
|
+
relates "a, (b, *c) = *1" do
|
384
|
+
# TODO
|
385
|
+
end
|
386
|
+
|
387
|
+
relates "a, (b, *c) = 1, *2" do
|
388
|
+
# TODO
|
389
|
+
end
|
390
|
+
|
391
|
+
relates "a, (*b) = 1" do
|
392
|
+
# TODO
|
393
|
+
end
|
394
|
+
|
395
|
+
relates "a, (*b) = 1, 2" do
|
396
|
+
# TODO
|
397
|
+
end
|
398
|
+
|
399
|
+
relates "a, (*b) = *1" do
|
400
|
+
# TODO
|
401
|
+
end
|
402
|
+
|
403
|
+
relates "a, (*b) = 1, *2" do
|
404
|
+
# TODO
|
405
|
+
end
|
406
|
+
end
|