rubinius-ast 3.2 → 3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubinius/code/ast/constants.rb +9 -5
- data/lib/rubinius/code/ast/control_flow.rb +22 -18
- data/lib/rubinius/code/ast/data.rb +1 -1
- data/lib/rubinius/code/ast/definitions.rb +10 -10
- data/lib/rubinius/code/ast/exceptions.rb +9 -9
- data/lib/rubinius/code/ast/literals.rb +34 -33
- data/lib/rubinius/code/ast/node.rb +3 -3
- data/lib/rubinius/code/ast/operators.rb +18 -18
- data/lib/rubinius/code/ast/self.rb +2 -2
- data/lib/rubinius/code/ast/sends.rb +22 -19
- data/lib/rubinius/code/ast/transforms.rb +2 -2
- data/lib/rubinius/code/ast/values.rb +13 -15
- data/lib/rubinius/code/ast/variables.rb +25 -28
- data/lib/rubinius/code/ast/version.rb +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 441f4803e58f63bef70234bf6cec699b0a5203d4
|
4
|
+
data.tar.gz: 33a871b9c9a23b399aad57e3df7fea74e0564c0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1467bb1c7d966a43e9a40b44eb5afe4063d0ba6f4c9b1421bca8bd12e4607e17c8ee629bdbe5636d971513522389c0eca1cbc03713a9f077044ec4bd244a119b
|
7
|
+
data.tar.gz: 8a12054422776ef10e5fc120bc09f3be60349ecb8315b4eb0295c38243f7ed967a484ecb5e0a344a434e7dccc09750cce28bf81991bb05ae3ca854277a402ae9
|
@@ -69,7 +69,7 @@ module CodeTools
|
|
69
69
|
g.goto done
|
70
70
|
|
71
71
|
f.set!
|
72
|
-
g.
|
72
|
+
g.push_nil
|
73
73
|
|
74
74
|
done.set!
|
75
75
|
end
|
@@ -87,7 +87,11 @@ module CodeTools
|
|
87
87
|
|
88
88
|
@parent.bytecode(g)
|
89
89
|
g.push_literal @name
|
90
|
-
|
90
|
+
if const_missing
|
91
|
+
g.push_true
|
92
|
+
else
|
93
|
+
g.push_false
|
94
|
+
end
|
91
95
|
g.invoke_primitive :vm_const_defined_under, 3
|
92
96
|
|
93
97
|
g.pop_unwind
|
@@ -151,7 +155,7 @@ module CodeTools
|
|
151
155
|
g.goto done
|
152
156
|
|
153
157
|
f.set!
|
154
|
-
g.
|
158
|
+
g.push_nil
|
155
159
|
|
156
160
|
done.set!
|
157
161
|
end
|
@@ -169,7 +173,7 @@ module CodeTools
|
|
169
173
|
|
170
174
|
g.push_cpath_top
|
171
175
|
g.push_literal @name
|
172
|
-
g.
|
176
|
+
g.push_false
|
173
177
|
g.invoke_primitive :vm_const_defined_under, 3
|
174
178
|
|
175
179
|
g.pop_unwind
|
@@ -246,7 +250,7 @@ module CodeTools
|
|
246
250
|
g.goto done
|
247
251
|
|
248
252
|
f.set!
|
249
|
-
g.
|
253
|
+
g.push_nil
|
250
254
|
|
251
255
|
done.set!
|
252
256
|
end
|
@@ -129,12 +129,12 @@ module CodeTools
|
|
129
129
|
|
130
130
|
if @single
|
131
131
|
condition_bytecode(g, @single)
|
132
|
-
g.
|
132
|
+
g.goto_if_false nxt
|
133
133
|
else
|
134
134
|
if @conditions
|
135
135
|
@conditions.body.each do |c|
|
136
136
|
condition_bytecode(g, c)
|
137
|
-
g.
|
137
|
+
g.goto_if_true body
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
@@ -159,12 +159,12 @@ module CodeTools
|
|
159
159
|
|
160
160
|
if @single
|
161
161
|
@single.bytecode(g)
|
162
|
-
g.
|
162
|
+
g.goto_if_false nxt
|
163
163
|
else
|
164
164
|
if @conditions
|
165
165
|
@conditions.body.each do |condition|
|
166
166
|
condition.bytecode(g)
|
167
|
-
g.
|
167
|
+
g.goto_if_true body
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
@@ -209,7 +209,7 @@ module CodeTools
|
|
209
209
|
g.find_const :Runtime
|
210
210
|
g.rotate(3)
|
211
211
|
g.send :matches_when, 2
|
212
|
-
g.
|
212
|
+
g.goto_if_true body
|
213
213
|
end
|
214
214
|
|
215
215
|
def bytecode(g, body, nxt)
|
@@ -243,11 +243,11 @@ module CodeTools
|
|
243
243
|
g.state.push_flip_flop
|
244
244
|
|
245
245
|
get_flip_flop(g, index)
|
246
|
-
g.
|
246
|
+
g.goto_if_true on_label
|
247
247
|
|
248
248
|
@start.bytecode(g)
|
249
249
|
g.dup
|
250
|
-
g.
|
250
|
+
g.goto_if_false done
|
251
251
|
g.pop
|
252
252
|
set_flip_flop(g, index, true)
|
253
253
|
|
@@ -258,9 +258,9 @@ module CodeTools
|
|
258
258
|
end
|
259
259
|
|
260
260
|
on_label.set!
|
261
|
-
g.
|
261
|
+
g.push_true
|
262
262
|
@finish.bytecode(g)
|
263
|
-
g.
|
263
|
+
g.goto_if_false done
|
264
264
|
set_flip_flop(g, index, false)
|
265
265
|
g.pop
|
266
266
|
|
@@ -271,7 +271,7 @@ module CodeTools
|
|
271
271
|
g.push_rubinius
|
272
272
|
g.find_const :Runtime
|
273
273
|
g.push_scope
|
274
|
-
g.
|
274
|
+
g.push_int index
|
275
275
|
g.send(:get_flip_flop, 2)
|
276
276
|
end
|
277
277
|
|
@@ -279,8 +279,12 @@ module CodeTools
|
|
279
279
|
g.push_rubinius
|
280
280
|
g.find_const :Runtime
|
281
281
|
g.push_scope
|
282
|
-
g.
|
283
|
-
|
282
|
+
g.push_int index
|
283
|
+
if value
|
284
|
+
g.push_true
|
285
|
+
else
|
286
|
+
g.push_false
|
287
|
+
end
|
284
288
|
g.send(:set_flip_flop, 3)
|
285
289
|
end
|
286
290
|
|
@@ -316,7 +320,7 @@ module CodeTools
|
|
316
320
|
else_label = g.new_label
|
317
321
|
|
318
322
|
@condition.bytecode(g)
|
319
|
-
g.
|
323
|
+
g.goto_if_false else_label
|
320
324
|
|
321
325
|
@body.bytecode(g)
|
322
326
|
g.goto done
|
@@ -354,9 +358,9 @@ module CodeTools
|
|
354
358
|
def condition_bytecode(g, bottom, use_gif)
|
355
359
|
@condition.bytecode(g)
|
356
360
|
if use_gif
|
357
|
-
g.
|
361
|
+
g.goto_if_false bottom
|
358
362
|
else
|
359
|
-
g.
|
363
|
+
g.goto_if_true bottom
|
360
364
|
end
|
361
365
|
end
|
362
366
|
|
@@ -406,7 +410,7 @@ module CodeTools
|
|
406
410
|
g.set_line 0
|
407
411
|
|
408
412
|
bottom.set!
|
409
|
-
g.
|
413
|
+
g.push_nil
|
410
414
|
g.break.set!
|
411
415
|
|
412
416
|
g.pop_modifiers
|
@@ -606,7 +610,7 @@ module CodeTools
|
|
606
610
|
if @value
|
607
611
|
@value.bytecode(g)
|
608
612
|
else
|
609
|
-
g.
|
613
|
+
g.push_nil
|
610
614
|
end
|
611
615
|
|
612
616
|
if g.state.loop?
|
@@ -697,7 +701,7 @@ module CodeTools
|
|
697
701
|
elsif @value
|
698
702
|
@value.bytecode(g)
|
699
703
|
else
|
700
|
-
g.
|
704
|
+
g.push_nil
|
701
705
|
end
|
702
706
|
|
703
707
|
if lcl = g.state.rescue?
|
@@ -565,7 +565,7 @@ module CodeTools
|
|
565
565
|
done = g.new_label
|
566
566
|
|
567
567
|
arg.variable.get_bytecode(g)
|
568
|
-
g.
|
568
|
+
g.goto_if_not_undefined done
|
569
569
|
arg.bytecode(g)
|
570
570
|
g.pop
|
571
571
|
|
@@ -658,7 +658,7 @@ module CodeTools
|
|
658
658
|
g.send :find_item, 1, true
|
659
659
|
|
660
660
|
g.dup
|
661
|
-
g.
|
661
|
+
g.goto_if_false missing_value
|
662
662
|
|
663
663
|
g.send :value, 0, true
|
664
664
|
|
@@ -684,8 +684,8 @@ module CodeTools
|
|
684
684
|
if @defaults.empty?
|
685
685
|
g.dup
|
686
686
|
g.send :size, 0, true
|
687
|
-
g.
|
688
|
-
g.
|
687
|
+
g.push_int @arguments.size
|
688
|
+
g.goto_if_not_equal extra_keys
|
689
689
|
|
690
690
|
if @kwrest
|
691
691
|
g.push_cpath_top
|
@@ -706,7 +706,7 @@ module CodeTools
|
|
706
706
|
g.send :find_item, 1, true
|
707
707
|
|
708
708
|
g.dup
|
709
|
-
g.
|
709
|
+
g.goto_if_false default_value
|
710
710
|
|
711
711
|
g.send :value, 0, true
|
712
712
|
arg.variable.set_bytecode(g)
|
@@ -729,9 +729,9 @@ module CodeTools
|
|
729
729
|
g.swap
|
730
730
|
|
731
731
|
if @kwrest
|
732
|
-
g.
|
732
|
+
g.push_true
|
733
733
|
else
|
734
|
-
g.
|
734
|
+
g.push_false
|
735
735
|
end
|
736
736
|
|
737
737
|
g.send :keywords_extra, 2, true
|
@@ -941,7 +941,7 @@ module CodeTools
|
|
941
941
|
class EmptyBody < Node
|
942
942
|
def bytecode(g)
|
943
943
|
g.pop
|
944
|
-
g.
|
944
|
+
g.push_nil
|
945
945
|
end
|
946
946
|
|
947
947
|
def to_sexp
|
@@ -1079,7 +1079,7 @@ module CodeTools
|
|
1079
1079
|
attach_and_call g, :__metaclass_init__, true, true
|
1080
1080
|
else
|
1081
1081
|
g.pop
|
1082
|
-
g.
|
1082
|
+
g.push_nil
|
1083
1083
|
end
|
1084
1084
|
end
|
1085
1085
|
end
|
@@ -1225,7 +1225,7 @@ module CodeTools
|
|
1225
1225
|
container_bytecode(g) do
|
1226
1226
|
@body.bytecode(g)
|
1227
1227
|
g.pop
|
1228
|
-
g.
|
1228
|
+
g.push_true
|
1229
1229
|
g.ret
|
1230
1230
|
end
|
1231
1231
|
end
|
@@ -77,7 +77,7 @@ module CodeTools
|
|
77
77
|
new_break.set!
|
78
78
|
g.pop_unwind
|
79
79
|
|
80
|
-
g.
|
80
|
+
g.push_true
|
81
81
|
g.set_stack_local used_break_local
|
82
82
|
g.pop
|
83
83
|
|
@@ -93,7 +93,7 @@ module CodeTools
|
|
93
93
|
new_next.set!
|
94
94
|
g.pop_unwind
|
95
95
|
|
96
|
-
g.
|
96
|
+
g.push_true
|
97
97
|
g.set_stack_local used_next_local
|
98
98
|
g.pop
|
99
99
|
|
@@ -123,7 +123,7 @@ module CodeTools
|
|
123
123
|
ok.set!
|
124
124
|
|
125
125
|
if check_break
|
126
|
-
g.
|
126
|
+
g.push_false
|
127
127
|
g.set_stack_local used_break_local
|
128
128
|
g.pop
|
129
129
|
|
@@ -131,7 +131,7 @@ module CodeTools
|
|
131
131
|
end
|
132
132
|
|
133
133
|
if check_next
|
134
|
-
g.
|
134
|
+
g.push_false
|
135
135
|
g.set_stack_local used_next_local
|
136
136
|
g.pop
|
137
137
|
|
@@ -147,7 +147,7 @@ module CodeTools
|
|
147
147
|
post = g.new_label
|
148
148
|
|
149
149
|
g.push_stack_local used_break_local
|
150
|
-
g.
|
150
|
+
g.goto_if_false post
|
151
151
|
|
152
152
|
if g.break
|
153
153
|
g.goto g.break
|
@@ -161,7 +161,7 @@ module CodeTools
|
|
161
161
|
post = g.new_label
|
162
162
|
|
163
163
|
g.push_stack_local used_next_local
|
164
|
-
g.
|
164
|
+
g.goto_if_false post
|
165
165
|
|
166
166
|
g.next ? g.goto(g.next) : g.ret
|
167
167
|
post.set!
|
@@ -193,7 +193,7 @@ module CodeTools
|
|
193
193
|
if @body.nil?
|
194
194
|
if @else.nil?
|
195
195
|
# Stupid. No body and no else.
|
196
|
-
g.
|
196
|
+
g.push_nil
|
197
197
|
else
|
198
198
|
# Only an else, run it.
|
199
199
|
@else.bytecode(g)
|
@@ -431,7 +431,7 @@ module CodeTools
|
|
431
431
|
c.bytecode(g)
|
432
432
|
g.swap
|
433
433
|
g.send :===, 1
|
434
|
-
g.
|
434
|
+
g.goto_if_true body
|
435
435
|
end
|
436
436
|
end
|
437
437
|
|
@@ -553,7 +553,7 @@ module CodeTools
|
|
553
553
|
g.cast_array
|
554
554
|
g.swap
|
555
555
|
g.send :__rescue_match__, 1
|
556
|
-
g.
|
556
|
+
g.goto_if_true body
|
557
557
|
end
|
558
558
|
|
559
559
|
def to_sexp
|
@@ -25,7 +25,7 @@ module CodeTools
|
|
25
25
|
done = g.new_label
|
26
26
|
@body.each do |x|
|
27
27
|
x.defined(g)
|
28
|
-
g.
|
28
|
+
g.goto_if_false not_found
|
29
29
|
end
|
30
30
|
g.push_literal "expression"
|
31
31
|
g.goto done
|
@@ -61,7 +61,7 @@ module CodeTools
|
|
61
61
|
def bytecode(g)
|
62
62
|
pos(g)
|
63
63
|
|
64
|
-
g.
|
64
|
+
g.push_false
|
65
65
|
end
|
66
66
|
|
67
67
|
def defined(g)
|
@@ -77,7 +77,7 @@ module CodeTools
|
|
77
77
|
def bytecode(g)
|
78
78
|
pos(g)
|
79
79
|
|
80
|
-
g.
|
80
|
+
g.push_true
|
81
81
|
end
|
82
82
|
|
83
83
|
def defined(g)
|
@@ -100,7 +100,7 @@ module CodeTools
|
|
100
100
|
def bytecode(g)
|
101
101
|
pos(g)
|
102
102
|
|
103
|
-
g.
|
103
|
+
g.push_literal @value
|
104
104
|
end
|
105
105
|
|
106
106
|
def defined(g)
|
@@ -128,7 +128,7 @@ module CodeTools
|
|
128
128
|
|
129
129
|
g.push_cpath_top
|
130
130
|
g.find_const :Hash
|
131
|
-
g.
|
131
|
+
g.push_int count / 2
|
132
132
|
g.send :new_from_literal, 1
|
133
133
|
|
134
134
|
while i < count
|
@@ -225,7 +225,7 @@ module CodeTools
|
|
225
225
|
def bytecode(g)
|
226
226
|
pos(g)
|
227
227
|
|
228
|
-
g.
|
228
|
+
g.push_nil
|
229
229
|
end
|
230
230
|
|
231
231
|
def defined(g)
|
@@ -248,7 +248,7 @@ module CodeTools
|
|
248
248
|
def bytecode(g)
|
249
249
|
pos(g)
|
250
250
|
|
251
|
-
g.
|
251
|
+
g.push_literal @value
|
252
252
|
end
|
253
253
|
|
254
254
|
def defined(g)
|
@@ -269,7 +269,7 @@ module CodeTools
|
|
269
269
|
def bytecode(g)
|
270
270
|
pos(g)
|
271
271
|
|
272
|
-
g.
|
272
|
+
g.push_int @value
|
273
273
|
end
|
274
274
|
|
275
275
|
def defined(g)
|
@@ -340,7 +340,7 @@ module CodeTools
|
|
340
340
|
g.dup
|
341
341
|
@start.bytecode(g)
|
342
342
|
@finish.bytecode(g)
|
343
|
-
g.
|
343
|
+
g.push_true
|
344
344
|
g.send :initialize, 3, true
|
345
345
|
g.pop
|
346
346
|
end
|
@@ -362,25 +362,25 @@ module CodeTools
|
|
362
362
|
def bytecode(g)
|
363
363
|
pos(g)
|
364
364
|
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
365
|
+
build = g.new_label
|
366
|
+
done = g.new_label
|
367
|
+
|
368
|
+
g.push_nil
|
369
|
+
|
370
|
+
build.set!
|
371
|
+
g.push_memo nil
|
371
372
|
g.dup
|
372
|
-
g.
|
373
|
+
g.goto_if_not_nil done
|
373
374
|
|
374
|
-
lbl = g.new_label
|
375
|
-
g.gif lbl
|
376
375
|
g.pop
|
377
376
|
g.push_cpath_top
|
378
377
|
g.find_const :Regexp
|
379
378
|
g.push_literal @source
|
380
|
-
g.
|
379
|
+
g.push_int @options
|
381
380
|
g.send :new, 2
|
382
|
-
g.
|
383
|
-
|
381
|
+
g.goto build
|
382
|
+
|
383
|
+
done.set!
|
384
384
|
end
|
385
385
|
|
386
386
|
def defined(g)
|
@@ -403,7 +403,6 @@ module CodeTools
|
|
403
403
|
def bytecode(g)
|
404
404
|
pos(g)
|
405
405
|
|
406
|
-
# TODO: change to push_unique_literal
|
407
406
|
g.push_literal @string
|
408
407
|
g.string_dup
|
409
408
|
end
|
@@ -532,7 +531,7 @@ module CodeTools
|
|
532
531
|
|
533
532
|
class DynamicExecuteString < DynamicString
|
534
533
|
def bytecode(g)
|
535
|
-
g.
|
534
|
+
g.push_self
|
536
535
|
super(g)
|
537
536
|
g.send :`, 1, true #`
|
538
537
|
end
|
@@ -552,7 +551,7 @@ module CodeTools
|
|
552
551
|
g.push_cpath_top
|
553
552
|
g.find_const :Regexp
|
554
553
|
super(g)
|
555
|
-
g.
|
554
|
+
g.push_int @options
|
556
555
|
g.send :new, 2
|
557
556
|
end
|
558
557
|
|
@@ -571,19 +570,21 @@ module CodeTools
|
|
571
570
|
def bytecode(g)
|
572
571
|
pos(g)
|
573
572
|
|
574
|
-
|
575
|
-
g.
|
573
|
+
build = g.new_label
|
574
|
+
done = g.new_label
|
575
|
+
|
576
|
+
g.push_nil
|
577
|
+
|
578
|
+
build.set!
|
579
|
+
g.push_memo nil
|
576
580
|
g.dup
|
577
|
-
g.
|
581
|
+
g.goto_if_not_nil done
|
578
582
|
|
579
|
-
lbl = g.new_label
|
580
|
-
g.gif lbl
|
581
583
|
g.pop
|
582
|
-
|
583
584
|
super(g)
|
585
|
+
g.goto build
|
584
586
|
|
585
|
-
|
586
|
-
lbl.set!
|
587
|
+
done.set!
|
587
588
|
end
|
588
589
|
|
589
590
|
def sexp_name
|
@@ -595,7 +596,7 @@ module CodeTools
|
|
595
596
|
def bytecode(g)
|
596
597
|
pos(g)
|
597
598
|
|
598
|
-
g.
|
599
|
+
g.push_self
|
599
600
|
super(g)
|
600
601
|
g.send :`, 1, true # ` (silly vim/emacs)
|
601
602
|
end
|
@@ -95,10 +95,10 @@ module CodeTools
|
|
95
95
|
g.push_rubinius
|
96
96
|
g.push_scope
|
97
97
|
g.send :active_path, 0
|
98
|
-
g.
|
98
|
+
g.push_int @line
|
99
99
|
g.send :unrecognized_defined, 2
|
100
100
|
g.pop
|
101
|
-
g.
|
101
|
+
g.push_nil
|
102
102
|
end
|
103
103
|
|
104
104
|
def value_defined(g, f)
|
@@ -128,7 +128,7 @@ module CodeTools
|
|
128
128
|
found = g.new_label
|
129
129
|
bytecode(g)
|
130
130
|
g.dup
|
131
|
-
g.
|
131
|
+
g.goto_if_true found
|
132
132
|
g.pop
|
133
133
|
yield
|
134
134
|
found.set!
|
@@ -17,9 +17,9 @@ module CodeTools
|
|
17
17
|
lbl = g.new_label
|
18
18
|
|
19
19
|
if use_gif
|
20
|
-
g.
|
20
|
+
g.goto_if_false lbl
|
21
21
|
else
|
22
|
-
g.
|
22
|
+
g.goto_if_true lbl
|
23
23
|
end
|
24
24
|
|
25
25
|
g.pop
|
@@ -64,13 +64,13 @@ module CodeTools
|
|
64
64
|
end_label = g.new_label
|
65
65
|
|
66
66
|
@value.bytecode(g)
|
67
|
-
g.
|
67
|
+
g.goto_if_true true_label
|
68
68
|
|
69
|
-
g.
|
69
|
+
g.push_true
|
70
70
|
g.goto end_label
|
71
71
|
|
72
72
|
true_label.set!
|
73
|
-
g.
|
73
|
+
g.push_false
|
74
74
|
end_label.set!
|
75
75
|
end
|
76
76
|
|
@@ -92,7 +92,7 @@ module CodeTools
|
|
92
92
|
g.goto done
|
93
93
|
|
94
94
|
f.set!
|
95
|
-
g.
|
95
|
+
g.push_nil
|
96
96
|
|
97
97
|
done.set!
|
98
98
|
end
|
@@ -134,7 +134,7 @@ module CodeTools
|
|
134
134
|
# @arguments.size will be 1
|
135
135
|
|
136
136
|
if @arguments.splat?
|
137
|
-
g.
|
137
|
+
g.push_nil
|
138
138
|
g.send_with_splat :[], @arguments.size
|
139
139
|
else
|
140
140
|
g.send :[], @arguments.size
|
@@ -153,9 +153,9 @@ module CodeTools
|
|
153
153
|
|
154
154
|
g.dup
|
155
155
|
if @op == :or
|
156
|
-
g.
|
156
|
+
g.goto_if_true fnd
|
157
157
|
else
|
158
|
-
g.
|
158
|
+
g.goto_if_false fnd
|
159
159
|
end
|
160
160
|
|
161
161
|
# Ok, take the extra copy off and pull the value onto the stack
|
@@ -174,7 +174,7 @@ module CodeTools
|
|
174
174
|
new_break.set!
|
175
175
|
if old_break
|
176
176
|
g.pop_many recv_stack + 1
|
177
|
-
g.
|
177
|
+
g.push_nil
|
178
178
|
g.goto old_break
|
179
179
|
end
|
180
180
|
|
@@ -188,7 +188,7 @@ module CodeTools
|
|
188
188
|
|
189
189
|
if @arguments.splat?
|
190
190
|
g.send :push, 1
|
191
|
-
g.
|
191
|
+
g.push_nil
|
192
192
|
g.send_with_splat :[]=, @arguments.size
|
193
193
|
else
|
194
194
|
g.send :[]=, @arguments.size + 1
|
@@ -222,7 +222,7 @@ module CodeTools
|
|
222
222
|
new_break.set!
|
223
223
|
if old_break
|
224
224
|
g.pop_many recv_stack + 2
|
225
|
-
g.
|
225
|
+
g.push_nil
|
226
226
|
g.goto old_break
|
227
227
|
end
|
228
228
|
|
@@ -247,7 +247,7 @@ module CodeTools
|
|
247
247
|
# X: Call []=(:a, 5) on h
|
248
248
|
if @arguments.splat?
|
249
249
|
g.send :push, 1
|
250
|
-
g.
|
250
|
+
g.push_nil
|
251
251
|
g.send_with_splat :[]=, @arguments.size
|
252
252
|
else
|
253
253
|
g.send :[]=, @arguments.size + 1
|
@@ -307,9 +307,9 @@ module CodeTools
|
|
307
307
|
|
308
308
|
g.dup
|
309
309
|
if @op == :or
|
310
|
-
g.
|
310
|
+
g.goto_if_true fnd
|
311
311
|
else
|
312
|
-
g.
|
312
|
+
g.goto_if_false fnd
|
313
313
|
end
|
314
314
|
|
315
315
|
# Remove the copy of 2 and push @value on the stack
|
@@ -326,7 +326,7 @@ module CodeTools
|
|
326
326
|
new_break.set!
|
327
327
|
if old_break
|
328
328
|
g.pop_many 2
|
329
|
-
g.
|
329
|
+
g.push_nil
|
330
330
|
g.goto old_break
|
331
331
|
end
|
332
332
|
|
@@ -365,7 +365,7 @@ module CodeTools
|
|
365
365
|
new_break.set!
|
366
366
|
if old_break
|
367
367
|
g.pop_many 3
|
368
|
-
g.
|
368
|
+
g.push_nil
|
369
369
|
g.goto old_break
|
370
370
|
end
|
371
371
|
|
@@ -417,7 +417,7 @@ module CodeTools
|
|
417
417
|
@left.bytecode(g)
|
418
418
|
lbl = g.new_label
|
419
419
|
g.dup
|
420
|
-
g.
|
420
|
+
g.goto_if_false lbl
|
421
421
|
g.pop
|
422
422
|
@right.bytecode(g)
|
423
423
|
lbl.set!
|
@@ -23,12 +23,14 @@ module CodeTools
|
|
23
23
|
def bytecode(g)
|
24
24
|
pos(g)
|
25
25
|
|
26
|
-
if @vcall_style
|
27
|
-
|
26
|
+
if @vcall_style
|
27
|
+
if reference = check_local_reference(g)
|
28
|
+
return reference.get_bytecode(g)
|
29
|
+
end
|
30
|
+
else
|
31
|
+
@receiver.bytecode(g)
|
28
32
|
end
|
29
33
|
|
30
|
-
@receiver.bytecode(g)
|
31
|
-
|
32
34
|
if @block
|
33
35
|
@block.bytecode(g)
|
34
36
|
g.send_with_block @name, 0, @privately
|
@@ -83,18 +85,18 @@ module CodeTools
|
|
83
85
|
g.push_literal @name
|
84
86
|
|
85
87
|
if @vcall_style or @privately
|
86
|
-
g.
|
88
|
+
g.push_true
|
87
89
|
g.send :__respond_to_p__, 2
|
88
90
|
else
|
89
91
|
g.push_self
|
90
92
|
g.invoke_primitive :vm_check_callable, 3
|
91
93
|
end
|
92
|
-
g.
|
94
|
+
g.goto_if_false f
|
93
95
|
g.push_literal "method"
|
94
96
|
g.goto done
|
95
97
|
|
96
98
|
f.set!
|
97
|
-
g.
|
99
|
+
g.push_nil
|
98
100
|
|
99
101
|
done.set!
|
100
102
|
end
|
@@ -141,7 +143,7 @@ module CodeTools
|
|
141
143
|
pos(g)
|
142
144
|
|
143
145
|
if @arguments.splat?
|
144
|
-
@block ? @block.bytecode(g) : g.
|
146
|
+
@block ? @block.bytecode(g) : g.push_nil
|
145
147
|
g.send_with_splat @name, @arguments.size, @privately, false
|
146
148
|
elsif @block
|
147
149
|
@block.bytecode(g)
|
@@ -190,7 +192,7 @@ module CodeTools
|
|
190
192
|
if @arguments.splat?
|
191
193
|
g.move_down @arguments.size + 2
|
192
194
|
g.swap
|
193
|
-
g.
|
195
|
+
g.push_nil
|
194
196
|
g.send_with_splat @name, @arguments.size, @privately, true
|
195
197
|
else
|
196
198
|
g.move_down @arguments.size + 1
|
@@ -252,7 +254,7 @@ module CodeTools
|
|
252
254
|
flag = false
|
253
255
|
end
|
254
256
|
|
255
|
-
g.
|
257
|
+
g.push_nil
|
256
258
|
g.send_with_splat @name, @arguments.size, @privately, flag
|
257
259
|
else
|
258
260
|
g.move_down @arguments.size + 1
|
@@ -343,8 +345,7 @@ module CodeTools
|
|
343
345
|
def convert(g)
|
344
346
|
nil_block = g.new_label
|
345
347
|
g.dup
|
346
|
-
g.
|
347
|
-
g.git nil_block
|
348
|
+
g.goto_if_nil nil_block
|
348
349
|
|
349
350
|
g.push_cpath_top
|
350
351
|
g.find_const :Proc
|
@@ -410,7 +411,7 @@ module CodeTools
|
|
410
411
|
g.find_const :Hash
|
411
412
|
g.swap
|
412
413
|
g.kind_of
|
413
|
-
g.
|
414
|
+
g.goto_if_false not_hash
|
414
415
|
|
415
416
|
g.make_array 1
|
416
417
|
g.goto done
|
@@ -909,8 +910,10 @@ module CodeTools
|
|
909
910
|
def bytecode(g)
|
910
911
|
pos(g)
|
911
912
|
|
912
|
-
if @value.kind_of?
|
913
|
-
g.
|
913
|
+
if @value.kind_of? FixnumLiteral
|
914
|
+
g.push_int(-@value.value)
|
915
|
+
elsif @value.kind_of? NumberLiteral
|
916
|
+
g.push_literal(-@value.value)
|
914
917
|
else
|
915
918
|
@value.bytecode(g)
|
916
919
|
g.send :"-@", 0
|
@@ -962,14 +965,14 @@ module CodeTools
|
|
962
965
|
|
963
966
|
g.invoke_primitive :vm_check_super_callable, 0
|
964
967
|
|
965
|
-
g.
|
968
|
+
g.goto_if_false nope
|
966
969
|
|
967
970
|
g.push_literal "super"
|
968
971
|
g.string_dup
|
969
972
|
g.goto done
|
970
973
|
|
971
974
|
nope.set!
|
972
|
-
g.
|
975
|
+
g.push_nil
|
973
976
|
|
974
977
|
done.set!
|
975
978
|
end
|
@@ -1020,8 +1023,8 @@ module CodeTools
|
|
1020
1023
|
f = g.new_label
|
1021
1024
|
|
1022
1025
|
g.push_block
|
1023
|
-
g.
|
1024
|
-
g.
|
1026
|
+
g.goto_if_true t
|
1027
|
+
g.push_nil
|
1025
1028
|
g.goto f
|
1026
1029
|
|
1027
1030
|
t.set!
|
@@ -271,7 +271,7 @@ module CodeTools
|
|
271
271
|
else
|
272
272
|
g.check_serial :new, Rubinius::CompiledCode::KernelMethodSerial
|
273
273
|
end
|
274
|
-
g.
|
274
|
+
g.goto_if_false slow
|
275
275
|
|
276
276
|
# fast path
|
277
277
|
g.send :allocate, 0, true
|
@@ -354,7 +354,7 @@ module CodeTools
|
|
354
354
|
const.bytecode(g)
|
355
355
|
g.swap
|
356
356
|
g.kind_of
|
357
|
-
g.
|
357
|
+
g.goto_if_true done
|
358
358
|
g.pop
|
359
359
|
super(g)
|
360
360
|
|
@@ -23,9 +23,9 @@ module CodeTools
|
|
23
23
|
|
24
24
|
g.dup
|
25
25
|
g.push_literal :to_a
|
26
|
-
g.
|
26
|
+
g.push_true
|
27
27
|
g.send :respond_to?, 2, true
|
28
|
-
g.
|
28
|
+
g.goto_if_true coerce
|
29
29
|
|
30
30
|
make_array.set!
|
31
31
|
g.make_array 1
|
@@ -48,8 +48,7 @@ module CodeTools
|
|
48
48
|
check_array = g.new_label
|
49
49
|
|
50
50
|
g.dup
|
51
|
-
g.
|
52
|
-
g.gif check_array
|
51
|
+
g.goto_if_not_nil check_array
|
53
52
|
|
54
53
|
g.pop
|
55
54
|
g.goto make_array
|
@@ -78,7 +77,7 @@ module CodeTools
|
|
78
77
|
g.find_const :Array
|
79
78
|
g.swap
|
80
79
|
g.instance_of
|
81
|
-
g.
|
80
|
+
g.goto_if_true label
|
82
81
|
end
|
83
82
|
|
84
83
|
def kind_of_array(g, label)
|
@@ -87,7 +86,7 @@ module CodeTools
|
|
87
86
|
g.find_const :Array
|
88
87
|
g.swap
|
89
88
|
g.kind_of
|
90
|
-
g.
|
89
|
+
g.goto_if_true label
|
91
90
|
end
|
92
91
|
|
93
92
|
def to_sexp
|
@@ -127,9 +126,9 @@ module CodeTools
|
|
127
126
|
|
128
127
|
g.dup
|
129
128
|
g.push_literal :to_a
|
130
|
-
g.
|
129
|
+
g.push_true
|
131
130
|
g.send :respond_to?, 2, true
|
132
|
-
g.
|
131
|
+
g.goto_if_true coerce
|
133
132
|
|
134
133
|
make_array.set!
|
135
134
|
g.make_array 1
|
@@ -143,8 +142,7 @@ module CodeTools
|
|
143
142
|
check_array = g.new_label
|
144
143
|
|
145
144
|
g.dup
|
146
|
-
g.
|
147
|
-
g.gif check_array
|
145
|
+
g.goto_if_not_nil check_array
|
148
146
|
|
149
147
|
g.pop
|
150
148
|
g.goto make_array
|
@@ -173,7 +171,7 @@ module CodeTools
|
|
173
171
|
g.find_const :Array
|
174
172
|
g.swap
|
175
173
|
g.kind_of
|
176
|
-
g.
|
174
|
+
g.goto_if_true label
|
177
175
|
end
|
178
176
|
|
179
177
|
# Dive down and try to find an array of regular values
|
@@ -246,11 +244,11 @@ module CodeTools
|
|
246
244
|
|
247
245
|
g.dup
|
248
246
|
g.send :size, 0
|
249
|
-
g.
|
247
|
+
g.push_int 1
|
250
248
|
g.send :>, 1
|
251
|
-
g.
|
249
|
+
g.goto_if_true done
|
252
250
|
|
253
|
-
g.
|
251
|
+
g.push_int 0
|
254
252
|
g.send :at, 1
|
255
253
|
|
256
254
|
done.set!
|
@@ -294,7 +292,7 @@ module CodeTools
|
|
294
292
|
pos(g)
|
295
293
|
|
296
294
|
@value.bytecode(g)
|
297
|
-
g.
|
295
|
+
g.object_to_s :to_s
|
298
296
|
end
|
299
297
|
|
300
298
|
def value_defined(g, f)
|
@@ -42,8 +42,7 @@ module CodeTools
|
|
42
42
|
done = g.new_label
|
43
43
|
|
44
44
|
g.last_match mode, 0
|
45
|
-
g.
|
46
|
-
g.git f
|
45
|
+
g.goto_if_nil f
|
47
46
|
|
48
47
|
g.push_literal "global-variable"
|
49
48
|
g.string_dup
|
@@ -51,7 +50,7 @@ module CodeTools
|
|
51
50
|
g.goto done
|
52
51
|
|
53
52
|
f.set!
|
54
|
-
g.
|
53
|
+
g.push_nil
|
55
54
|
|
56
55
|
done.set!
|
57
56
|
end
|
@@ -84,8 +83,7 @@ module CodeTools
|
|
84
83
|
done = g.new_label
|
85
84
|
|
86
85
|
g.last_match Mode, @which - 1
|
87
|
-
g.
|
88
|
-
g.git f
|
86
|
+
g.goto_if_nil f
|
89
87
|
|
90
88
|
g.push_literal "global-variable"
|
91
89
|
g.string_dup
|
@@ -93,7 +91,7 @@ module CodeTools
|
|
93
91
|
g.goto done
|
94
92
|
|
95
93
|
f.set!
|
96
|
-
g.
|
94
|
+
g.push_nil
|
97
95
|
|
98
96
|
done.set!
|
99
97
|
end
|
@@ -149,7 +147,7 @@ module CodeTools
|
|
149
147
|
# Ok, we know the value exists, get it.
|
150
148
|
bytecode(g)
|
151
149
|
g.dup
|
152
|
-
g.
|
150
|
+
g.goto_if_true done
|
153
151
|
g.pop
|
154
152
|
|
155
153
|
# yield to generate the code for when it's not found
|
@@ -168,7 +166,7 @@ module CodeTools
|
|
168
166
|
|
169
167
|
def push_scope(g)
|
170
168
|
if g.state.scope.module?
|
171
|
-
g.
|
169
|
+
g.push_self
|
172
170
|
else
|
173
171
|
g.push_scope
|
174
172
|
end
|
@@ -178,7 +176,7 @@ module CodeTools
|
|
178
176
|
def variable_defined(g, f)
|
179
177
|
push_scope(g)
|
180
178
|
g.send :class_variable_defined?, 1
|
181
|
-
g.
|
179
|
+
g.goto_if_false f
|
182
180
|
end
|
183
181
|
|
184
182
|
def defined(g)
|
@@ -190,7 +188,7 @@ module CodeTools
|
|
190
188
|
g.goto done
|
191
189
|
|
192
190
|
f.set!
|
193
|
-
g.
|
191
|
+
g.push_nil
|
194
192
|
|
195
193
|
done.set!
|
196
194
|
end
|
@@ -205,7 +203,7 @@ module CodeTools
|
|
205
203
|
pos(g)
|
206
204
|
|
207
205
|
if g.state.scope.module?
|
208
|
-
g.
|
206
|
+
g.push_self
|
209
207
|
else
|
210
208
|
g.push_scope
|
211
209
|
end
|
@@ -287,7 +285,7 @@ module CodeTools
|
|
287
285
|
g.find_const :Globals
|
288
286
|
g.push_literal @name
|
289
287
|
g.send :key?, 1
|
290
|
-
g.
|
288
|
+
g.goto_if_false f
|
291
289
|
end
|
292
290
|
|
293
291
|
def defined(g)
|
@@ -299,7 +297,7 @@ module CodeTools
|
|
299
297
|
g.goto done
|
300
298
|
|
301
299
|
f.set!
|
302
|
-
g.
|
300
|
+
g.push_nil
|
303
301
|
|
304
302
|
done.set!
|
305
303
|
end
|
@@ -391,7 +389,7 @@ module CodeTools
|
|
391
389
|
g.find_const :Array
|
392
390
|
g.swap
|
393
391
|
g.kind_of
|
394
|
-
g.
|
392
|
+
g.goto_if_true assign
|
395
393
|
g.make_array 1
|
396
394
|
|
397
395
|
assign.set!
|
@@ -430,10 +428,10 @@ module CodeTools
|
|
430
428
|
end
|
431
429
|
|
432
430
|
def variable_defined(g, f)
|
433
|
-
g.
|
431
|
+
g.push_self
|
434
432
|
g.push_literal @name
|
435
433
|
g.send :__instance_variable_defined_p__, 1
|
436
|
-
g.
|
434
|
+
g.goto_if_false f
|
437
435
|
end
|
438
436
|
|
439
437
|
def defined(g)
|
@@ -445,7 +443,7 @@ module CodeTools
|
|
445
443
|
g.goto done
|
446
444
|
|
447
445
|
f.set!
|
448
|
-
g.
|
446
|
+
g.push_nil
|
449
447
|
|
450
448
|
done.set!
|
451
449
|
end
|
@@ -635,7 +633,7 @@ module CodeTools
|
|
635
633
|
g.pop
|
636
634
|
|
637
635
|
index = g.new_stack_local
|
638
|
-
g.
|
636
|
+
g.push_int 0
|
639
637
|
g.set_stack_local index
|
640
638
|
g.pop
|
641
639
|
|
@@ -651,7 +649,7 @@ module CodeTools
|
|
651
649
|
|
652
650
|
if @post
|
653
651
|
g.push_stack_local size
|
654
|
-
g.
|
652
|
+
g.push_int @post.body.size
|
655
653
|
g.send :-, 1, true
|
656
654
|
|
657
655
|
g.push_stack_local index
|
@@ -677,9 +675,9 @@ module CodeTools
|
|
677
675
|
|
678
676
|
check_count.set!
|
679
677
|
g.dup
|
680
|
-
g.
|
678
|
+
g.push_int 0
|
681
679
|
g.send :<, 1, true
|
682
|
-
g.
|
680
|
+
g.goto_if_true underflow
|
683
681
|
|
684
682
|
g.dup
|
685
683
|
g.push_stack_local index
|
@@ -720,9 +718,9 @@ module CodeTools
|
|
720
718
|
|
721
719
|
g.dup
|
722
720
|
g.push_literal :to_ary
|
723
|
-
g.
|
721
|
+
g.push_true
|
724
722
|
g.send :respond_to?, 2, true
|
725
|
-
g.
|
723
|
+
g.goto_if_true coerce
|
726
724
|
|
727
725
|
make_array.set!
|
728
726
|
g.make_array 1
|
@@ -745,8 +743,7 @@ module CodeTools
|
|
745
743
|
check_array = g.new_label
|
746
744
|
|
747
745
|
g.dup
|
748
|
-
g.
|
749
|
-
g.gif check_array
|
746
|
+
g.goto_if_not_nil check_array
|
750
747
|
|
751
748
|
g.pop
|
752
749
|
g.goto make_array
|
@@ -775,7 +772,7 @@ module CodeTools
|
|
775
772
|
g.find_const :Array
|
776
773
|
g.swap
|
777
774
|
g.instance_of
|
778
|
-
g.
|
775
|
+
g.goto_if_true label
|
779
776
|
end
|
780
777
|
|
781
778
|
def kind_of_array(g, label)
|
@@ -784,7 +781,7 @@ module CodeTools
|
|
784
781
|
g.find_const :Array
|
785
782
|
g.swap
|
786
783
|
g.kind_of
|
787
|
-
g.
|
784
|
+
g.goto_if_true label
|
788
785
|
end
|
789
786
|
|
790
787
|
def get_element(g, index)
|
@@ -792,7 +789,7 @@ module CodeTools
|
|
792
789
|
g.push_stack_local index
|
793
790
|
|
794
791
|
g.dup
|
795
|
-
g.
|
792
|
+
g.push_int 1
|
796
793
|
g.send :+, 1, true
|
797
794
|
g.set_stack_local index
|
798
795
|
g.pop
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubinius-ast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '3.
|
4
|
+
version: '3.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Shirai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
18
|
version: '1.3'
|
19
19
|
name: bundler
|
20
|
-
|
21
|
-
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - "~>"
|
24
24
|
- !ruby/object:Gem::Version
|
25
25
|
version: '1.3'
|
26
|
-
|
26
|
+
type: :development
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
30
|
- - "~>"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '10.0'
|
33
33
|
name: rake
|
34
|
-
|
35
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '10.0'
|
40
|
-
|
40
|
+
type: :development
|
41
41
|
description: An Abstract Syntax Tree for the Rubinius language platform.
|
42
42
|
email:
|
43
43
|
- brixen@gmail.com
|
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
version: '0'
|
84
84
|
requirements: []
|
85
85
|
rubyforge_project:
|
86
|
-
rubygems_version: 2.
|
86
|
+
rubygems_version: 2.6.2
|
87
87
|
signing_key:
|
88
88
|
specification_version: 4
|
89
89
|
summary: An Abstract Syntax Tree for the Rubinius language platform.
|