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