rubinius-compiler 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +8 -0
- data/lib/rubinius/compiler/compiled_file.rb +32 -32
- data/lib/rubinius/compiler/version.rb +2 -2
- data/rubinius-compiler.gemspec +6 -0
- data/spec/alias_spec.rb +39 -0
- data/spec/and_spec.rb +44 -0
- data/spec/array_spec.rb +110 -0
- data/spec/attrasgn_spec.rb +186 -0
- data/spec/back_ref_spec.rb +11 -0
- data/spec/call_spec.rb +580 -0
- data/spec/case_spec.rb +576 -0
- data/spec/cdecl_spec.rb +70 -0
- data/spec/class_spec.rb +120 -0
- data/spec/colon2_spec.rb +8 -0
- data/spec/colon3_spec.rb +8 -0
- data/spec/const_spec.rb +7 -0
- data/spec/custom/guards/profiler.rb +18 -0
- data/spec/custom/helpers/generator.rb +828 -0
- data/spec/custom/matchers/compile_as.rb +46 -0
- data/spec/custom/mspec.rb +15 -0
- data/spec/custom/runner/actions/debug.rb +10 -0
- data/spec/custom/runner/actions/gcstats.rb +17 -0
- data/spec/custom/runner/actions/memory.rb +11 -0
- data/spec/custom/runner/actions/parser.rb +14 -0
- data/spec/custom/runner/actions/profiler.rb +19 -0
- data/spec/custom/runner/relates.rb +86 -0
- data/spec/custom/utils/options.rb +40 -0
- data/spec/custom/utils/script.rb +50 -0
- data/spec/cvar_spec.rb +39 -0
- data/spec/cvasgn_spec.rb +33 -0
- data/spec/cvdecl_spec.rb +17 -0
- data/spec/defined_spec.rb +616 -0
- data/spec/defn_spec.rb +732 -0
- data/spec/defs_spec.rb +113 -0
- data/spec/dot2_spec.rb +16 -0
- data/spec/dot3_spec.rb +17 -0
- data/spec/dregx_spec.rb +160 -0
- data/spec/dstr_spec.rb +424 -0
- data/spec/dsym_spec.rb +18 -0
- data/spec/dxstr_spec.rb +24 -0
- data/spec/ensure_spec.rb +196 -0
- data/spec/false_spec.rb +7 -0
- data/spec/flip2_spec.rb +21 -0
- data/spec/flip3_spec.rb +12 -0
- data/spec/for_spec.rb +228 -0
- data/spec/gasgn_spec.rb +15 -0
- data/spec/generator/encode_spec.rb +34 -0
- data/spec/gvar_spec.rb +37 -0
- data/spec/hash_spec.rb +108 -0
- data/spec/iasgn_spec.rb +26 -0
- data/spec/if_spec.rb +415 -0
- data/spec/iter_spec.rb +1011 -0
- data/spec/lasgn_spec.rb +561 -0
- data/spec/lit_spec.rb +61 -0
- data/spec/masgn_spec.rb +1558 -0
- data/spec/match2_spec.rb +42 -0
- data/spec/match3_spec.rb +54 -0
- data/spec/match_spec.rb +29 -0
- data/spec/module_spec.rb +73 -0
- data/spec/nil_spec.rb +7 -0
- data/spec/not_spec.rb +47 -0
- data/spec/nth_ref_spec.rb +7 -0
- data/spec/op_asgn_spec.rb +563 -0
- data/spec/or_spec.rb +126 -0
- data/spec/postexe_spec.rb +11 -0
- data/spec/preexe_spec.rb +21 -0
- data/spec/regex_spec.rb +54 -0
- data/spec/rescue_spec.rb +763 -0
- data/spec/return_spec.rb +152 -0
- data/spec/sclass_spec.rb +138 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/str_spec.rb +118 -0
- data/spec/super_spec.rb +170 -0
- data/spec/transforms/assembly_spec.rb +195 -0
- data/spec/transforms/block_given_spec.rb +75 -0
- data/spec/transforms/fast_coerce_spec.rb +112 -0
- data/spec/transforms/fast_new_spec.rb +255 -0
- data/spec/transforms/invoke_primitive_spec.rb +14 -0
- data/spec/transforms/kernel_methods_spec.rb +29 -0
- data/spec/transforms/primitive_spec.rb +33 -0
- data/spec/transforms/privately_spec.rb +24 -0
- data/spec/true_spec.rb +7 -0
- data/spec/undef_spec.rb +133 -0
- data/spec/until_spec.rb +254 -0
- data/spec/valias_spec.rb +11 -0
- data/spec/while_spec.rb +494 -0
- data/spec/xstr_spec.rb +10 -0
- data/spec/yield_spec.rb +92 -0
- data/spec/zsuper_spec.rb +63 -0
- metadata +258 -3
data/spec/or_spec.rb
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
describe "An Or node" do
|
2
|
+
relates "(a or b)" do
|
3
|
+
compile do |g|
|
4
|
+
g.push :self
|
5
|
+
g.send :a, 0, true
|
6
|
+
g.dup
|
7
|
+
|
8
|
+
lhs_true = g.new_label
|
9
|
+
g.git lhs_true
|
10
|
+
|
11
|
+
g.pop
|
12
|
+
g.push :self
|
13
|
+
g.send :b, 0, true
|
14
|
+
|
15
|
+
lhs_true.set!
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
ruby_version_is ""..."1.9" do
|
20
|
+
or_complex = lambda do |g|
|
21
|
+
j1 = g.new_label
|
22
|
+
j2 = g.new_label
|
23
|
+
j3 = g.new_label
|
24
|
+
|
25
|
+
g.push :self
|
26
|
+
g.send :a, 0, true
|
27
|
+
g.dup
|
28
|
+
g.git j1
|
29
|
+
g.pop
|
30
|
+
|
31
|
+
g.push :self
|
32
|
+
g.send :b, 0, true
|
33
|
+
j1.set!
|
34
|
+
g.dup
|
35
|
+
g.git j3
|
36
|
+
g.pop
|
37
|
+
|
38
|
+
g.push :self
|
39
|
+
g.send :c, 0, true
|
40
|
+
g.dup
|
41
|
+
g.gif j2
|
42
|
+
g.pop
|
43
|
+
|
44
|
+
g.push :self
|
45
|
+
g.send :d, 0, true
|
46
|
+
|
47
|
+
j2.set!
|
48
|
+
j3.set!
|
49
|
+
end
|
50
|
+
|
51
|
+
relates "((a || b) || (c && d))" do
|
52
|
+
compile(&or_complex)
|
53
|
+
end
|
54
|
+
|
55
|
+
relates "((a or b) or (c and d))" do
|
56
|
+
compile(&or_complex)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
ruby_version_is "1.9" do
|
61
|
+
or_complex = lambda do |g|
|
62
|
+
j1 = g.new_label
|
63
|
+
j2 = g.new_label
|
64
|
+
j3 = g.new_label
|
65
|
+
|
66
|
+
g.push :self
|
67
|
+
g.send :a, 0, true
|
68
|
+
g.dup
|
69
|
+
g.git j3
|
70
|
+
g.pop
|
71
|
+
|
72
|
+
g.push :self
|
73
|
+
g.send :b, 0, true
|
74
|
+
g.dup
|
75
|
+
g.git j2
|
76
|
+
g.pop
|
77
|
+
|
78
|
+
g.push :self
|
79
|
+
g.send :c, 0, true
|
80
|
+
g.dup
|
81
|
+
g.gif j1
|
82
|
+
g.pop
|
83
|
+
|
84
|
+
g.push :self
|
85
|
+
g.send :d, 0, true
|
86
|
+
|
87
|
+
j1.set!
|
88
|
+
j2.set!
|
89
|
+
j3.set!
|
90
|
+
end
|
91
|
+
|
92
|
+
relates "((a || b) || (c && d))" do
|
93
|
+
compile(&or_complex)
|
94
|
+
end
|
95
|
+
|
96
|
+
relates "((a or b) or (c and d))" do
|
97
|
+
compile(&or_complex)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
relates "() or a" do
|
102
|
+
compile do |g|
|
103
|
+
t = g.new_label
|
104
|
+
g.push :nil
|
105
|
+
g.dup
|
106
|
+
g.git t
|
107
|
+
g.pop
|
108
|
+
g.push :self
|
109
|
+
g.send :a, 0, true
|
110
|
+
t.set!
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
relates "a or ()" do
|
115
|
+
compile do |g|
|
116
|
+
t = g.new_label
|
117
|
+
g.push :self
|
118
|
+
g.send :a, 0, true
|
119
|
+
g.dup
|
120
|
+
g.git t
|
121
|
+
g.pop
|
122
|
+
g.push :nil
|
123
|
+
t.set!
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
data/spec/preexe_spec.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
describe "A Preexe node" do
|
2
|
+
ruby_version_is ""..."1.9" do
|
3
|
+
relates "BEGIN { 1 }" do
|
4
|
+
compile do |g|
|
5
|
+
g.push_literal Rubinius::ToolSets::Runtime::Compiler
|
6
|
+
|
7
|
+
in_block_send :pre_exe, :none, nil, 0, false do |d|
|
8
|
+
d.push 1
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
ruby_version_is "1.9" do
|
15
|
+
relates "BEGIN { 1 }" do
|
16
|
+
compile do |g|
|
17
|
+
g.push 1
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/spec/regex_spec.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
describe "A Regex node" do
|
2
|
+
relates "str.split(//i)" do
|
3
|
+
compile do |g|
|
4
|
+
g.push :self
|
5
|
+
g.send :str, 0, true
|
6
|
+
|
7
|
+
g.memoize do
|
8
|
+
g.push_cpath_top
|
9
|
+
g.find_const :Regexp
|
10
|
+
g.push_literal ""
|
11
|
+
g.push 1
|
12
|
+
g.send :new, 2
|
13
|
+
end
|
14
|
+
|
15
|
+
g.send :split, 1, false
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
relates "/x/n" do
|
20
|
+
compile do |g|
|
21
|
+
g.memoize do
|
22
|
+
g.push_cpath_top
|
23
|
+
g.find_const :Regexp
|
24
|
+
g.push_literal "x"
|
25
|
+
g.push 512
|
26
|
+
g.send :new, 2
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
relates "/x/o" do
|
32
|
+
compile do |g|
|
33
|
+
g.memoize do
|
34
|
+
g.push_cpath_top
|
35
|
+
g.find_const :Regexp
|
36
|
+
g.push_literal "x"
|
37
|
+
g.push 0
|
38
|
+
g.send :new, 2
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
relates "/x/" do
|
44
|
+
compile do |g|
|
45
|
+
g.memoize do
|
46
|
+
g.push_cpath_top
|
47
|
+
g.find_const :Regexp
|
48
|
+
g.push_literal "x"
|
49
|
+
g.push 0
|
50
|
+
g.send :new, 2
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/spec/rescue_spec.rb
ADDED
@@ -0,0 +1,763 @@
|
|
1
|
+
describe "A Rescue node" do
|
2
|
+
rescue_empty = lambda do |g|
|
3
|
+
g.for_rescue do |rb|
|
4
|
+
rb.body do
|
5
|
+
g.push :self
|
6
|
+
g.send :blah, 0, true
|
7
|
+
end
|
8
|
+
|
9
|
+
rb.condition :StandardError, true do
|
10
|
+
g.push :nil
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
relates "blah rescue nil" do
|
16
|
+
compile(&rescue_empty)
|
17
|
+
end
|
18
|
+
|
19
|
+
relates <<-ruby do
|
20
|
+
begin
|
21
|
+
blah
|
22
|
+
rescue
|
23
|
+
end
|
24
|
+
ruby
|
25
|
+
|
26
|
+
compile(&rescue_empty)
|
27
|
+
end
|
28
|
+
|
29
|
+
relates <<-ruby do
|
30
|
+
begin
|
31
|
+
a
|
32
|
+
rescue A
|
33
|
+
b
|
34
|
+
rescue B
|
35
|
+
c
|
36
|
+
rescue C
|
37
|
+
d
|
38
|
+
end
|
39
|
+
ruby
|
40
|
+
|
41
|
+
compile do |g|
|
42
|
+
g.for_rescue do |rb|
|
43
|
+
rb.body do
|
44
|
+
g.push :self
|
45
|
+
g.send :a, 0, true
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
rb.condition :A do
|
50
|
+
g.push :self
|
51
|
+
g.send :b, 0, true
|
52
|
+
end
|
53
|
+
|
54
|
+
rb.condition :B do
|
55
|
+
g.push :self
|
56
|
+
g.send :c, 0, true
|
57
|
+
end
|
58
|
+
|
59
|
+
rb.condition :C do
|
60
|
+
g.push :self
|
61
|
+
g.send :d, 0, true
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
relates <<-ruby do
|
68
|
+
begin
|
69
|
+
a
|
70
|
+
rescue => @e
|
71
|
+
c
|
72
|
+
d
|
73
|
+
end
|
74
|
+
ruby
|
75
|
+
|
76
|
+
compile do |g|
|
77
|
+
g.for_rescue do |rb|
|
78
|
+
rb.body do
|
79
|
+
g.push :self
|
80
|
+
g.send :a, 0, true
|
81
|
+
end
|
82
|
+
|
83
|
+
rb.condition :StandardError, true do
|
84
|
+
g.push_current_exception
|
85
|
+
g.set_ivar :@e
|
86
|
+
g.pop
|
87
|
+
g.push :self
|
88
|
+
g.send :c, 0, true
|
89
|
+
g.pop
|
90
|
+
g.push :self
|
91
|
+
g.send :d, 0, true
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
relates <<-ruby do
|
98
|
+
begin
|
99
|
+
a
|
100
|
+
rescue => e
|
101
|
+
c
|
102
|
+
d
|
103
|
+
end
|
104
|
+
ruby
|
105
|
+
|
106
|
+
compile do |g|
|
107
|
+
g.for_rescue do |rb|
|
108
|
+
rb.body do
|
109
|
+
g.push :self
|
110
|
+
g.send :a, 0, true
|
111
|
+
end
|
112
|
+
|
113
|
+
rb.condition :StandardError, true do
|
114
|
+
g.push_current_exception
|
115
|
+
g.set_local 0
|
116
|
+
g.pop
|
117
|
+
g.push :self
|
118
|
+
g.send :c, 0, true
|
119
|
+
g.pop
|
120
|
+
g.push :self
|
121
|
+
g.send :d, 0, true
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
relates <<-ruby do
|
128
|
+
begin
|
129
|
+
a
|
130
|
+
rescue => mes
|
131
|
+
# do nothing
|
132
|
+
end
|
133
|
+
|
134
|
+
begin
|
135
|
+
b
|
136
|
+
rescue => mes
|
137
|
+
# do nothing
|
138
|
+
end
|
139
|
+
ruby
|
140
|
+
|
141
|
+
compile do |g|
|
142
|
+
g.for_rescue do |rb|
|
143
|
+
rb.body do
|
144
|
+
g.push :self
|
145
|
+
g.send :a, 0, true
|
146
|
+
end
|
147
|
+
|
148
|
+
rb.condition :StandardError, true do
|
149
|
+
g.push_current_exception
|
150
|
+
g.set_local 0
|
151
|
+
g.pop
|
152
|
+
g.push :nil
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
g.pop
|
157
|
+
|
158
|
+
g.for_rescue do |rb|
|
159
|
+
rb.body do
|
160
|
+
g.push :self
|
161
|
+
g.send :b, 0, true
|
162
|
+
end
|
163
|
+
|
164
|
+
rb.condition :StandardError, true do
|
165
|
+
g.push_current_exception
|
166
|
+
g.set_local 0
|
167
|
+
g.pop
|
168
|
+
g.push :nil
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
relates <<-ruby do
|
175
|
+
begin
|
176
|
+
blah
|
177
|
+
rescue RuntimeError => r
|
178
|
+
end
|
179
|
+
ruby
|
180
|
+
|
181
|
+
compile do |g|
|
182
|
+
g.for_rescue do |rb|
|
183
|
+
rb.body do
|
184
|
+
g.push :self
|
185
|
+
g.send :blah, 0, true
|
186
|
+
end
|
187
|
+
|
188
|
+
rb.condition :RuntimeError do
|
189
|
+
g.push_current_exception
|
190
|
+
g.set_local 0
|
191
|
+
g.pop
|
192
|
+
g.push :nil
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
relates <<-ruby do
|
199
|
+
begin
|
200
|
+
1
|
201
|
+
rescue => @e
|
202
|
+
end
|
203
|
+
ruby
|
204
|
+
|
205
|
+
compile do |g|
|
206
|
+
g.for_rescue do |rb|
|
207
|
+
rb.body do
|
208
|
+
g.push 1
|
209
|
+
end
|
210
|
+
|
211
|
+
rb.condition :StandardError, true do
|
212
|
+
g.push_current_exception
|
213
|
+
g.set_ivar :@e
|
214
|
+
g.pop
|
215
|
+
g.push :nil
|
216
|
+
end
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
relates <<-ruby do
|
222
|
+
begin
|
223
|
+
1
|
224
|
+
rescue
|
225
|
+
var = 2
|
226
|
+
end
|
227
|
+
ruby
|
228
|
+
|
229
|
+
compile do |g|
|
230
|
+
g.for_rescue do |rb|
|
231
|
+
rb.body do
|
232
|
+
g.push 1
|
233
|
+
end
|
234
|
+
|
235
|
+
rb.condition :StandardError, true do
|
236
|
+
g.push 2
|
237
|
+
g.set_local 0
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
relates <<-ruby do
|
244
|
+
begin
|
245
|
+
1
|
246
|
+
rescue => e
|
247
|
+
end
|
248
|
+
ruby
|
249
|
+
|
250
|
+
compile do |g|
|
251
|
+
g.for_rescue do |rb|
|
252
|
+
rb.body do
|
253
|
+
g.push 1
|
254
|
+
end
|
255
|
+
|
256
|
+
rb.condition :StandardError, true do
|
257
|
+
g.push_current_exception
|
258
|
+
g.set_local 0
|
259
|
+
g.pop
|
260
|
+
g.push :nil
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
relates <<-ruby do
|
267
|
+
begin
|
268
|
+
1
|
269
|
+
rescue
|
270
|
+
a.b = nil
|
271
|
+
end
|
272
|
+
ruby
|
273
|
+
|
274
|
+
compile do |g|
|
275
|
+
g.for_rescue do |rb|
|
276
|
+
rb.body do
|
277
|
+
g.push 1
|
278
|
+
end
|
279
|
+
|
280
|
+
rb.condition :StandardError, true do
|
281
|
+
g.push :self
|
282
|
+
g.send :a, 0, true
|
283
|
+
g.push :nil
|
284
|
+
g.dup
|
285
|
+
g.move_down 2
|
286
|
+
g.send :b=, 1, false
|
287
|
+
g.pop
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
relates <<-ruby do
|
294
|
+
begin
|
295
|
+
1
|
296
|
+
rescue => e
|
297
|
+
var = 2
|
298
|
+
end
|
299
|
+
ruby
|
300
|
+
|
301
|
+
compile do |g|
|
302
|
+
g.for_rescue do |rb|
|
303
|
+
rb.body do
|
304
|
+
g.push 1
|
305
|
+
end
|
306
|
+
|
307
|
+
rb.condition :StandardError, true do
|
308
|
+
g.push_current_exception
|
309
|
+
g.set_local 0
|
310
|
+
g.pop
|
311
|
+
g.push 2
|
312
|
+
g.set_local 1
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
relates <<-ruby do
|
319
|
+
begin
|
320
|
+
12
|
321
|
+
rescue String
|
322
|
+
13
|
323
|
+
else
|
324
|
+
14
|
325
|
+
end
|
326
|
+
ruby
|
327
|
+
|
328
|
+
compile do |g|
|
329
|
+
g.for_rescue do |rb|
|
330
|
+
rb.body do
|
331
|
+
g.push 12
|
332
|
+
end
|
333
|
+
|
334
|
+
rb.condition :String do
|
335
|
+
g.push 13
|
336
|
+
end
|
337
|
+
|
338
|
+
rb.els do
|
339
|
+
g.pop
|
340
|
+
g.push 14
|
341
|
+
end
|
342
|
+
end
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
relates <<-ruby do
|
347
|
+
begin
|
348
|
+
12
|
349
|
+
rescue *blah
|
350
|
+
13
|
351
|
+
end
|
352
|
+
ruby
|
353
|
+
|
354
|
+
compile do |g|
|
355
|
+
g.for_rescue do |rb|
|
356
|
+
rb.body do
|
357
|
+
g.push 12
|
358
|
+
end
|
359
|
+
|
360
|
+
rb.raw_condition do |bl, nl|
|
361
|
+
g.dup
|
362
|
+
g.push :self
|
363
|
+
g.send :blah, 0, true
|
364
|
+
g.cast_array
|
365
|
+
g.swap
|
366
|
+
g.send :__rescue_match__, 1
|
367
|
+
|
368
|
+
g.git bl
|
369
|
+
g.goto nl
|
370
|
+
|
371
|
+
bl.set!
|
372
|
+
g.pop
|
373
|
+
g.push 13
|
374
|
+
end
|
375
|
+
end
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
relates <<-ruby do
|
380
|
+
begin
|
381
|
+
12
|
382
|
+
rescue String, *blah
|
383
|
+
13
|
384
|
+
end
|
385
|
+
ruby
|
386
|
+
|
387
|
+
compile do |g|
|
388
|
+
g.for_rescue do |rb|
|
389
|
+
rb.body do
|
390
|
+
g.push 12
|
391
|
+
end
|
392
|
+
|
393
|
+
rb.raw_condition do |body_label, next_label|
|
394
|
+
g.dup
|
395
|
+
g.push_const :String
|
396
|
+
g.swap
|
397
|
+
g.send :===, 1
|
398
|
+
g.git body_label
|
399
|
+
|
400
|
+
g.dup
|
401
|
+
g.push :self
|
402
|
+
g.send :blah, 0, true
|
403
|
+
g.cast_array
|
404
|
+
g.swap
|
405
|
+
|
406
|
+
g.send :__rescue_match__, 1
|
407
|
+
g.git body_label
|
408
|
+
|
409
|
+
g.goto next_label
|
410
|
+
|
411
|
+
body_label.set!
|
412
|
+
g.pop
|
413
|
+
|
414
|
+
g.push 13
|
415
|
+
end
|
416
|
+
end
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
relates <<-ruby do
|
421
|
+
begin
|
422
|
+
12
|
423
|
+
rescue *blah => e
|
424
|
+
13
|
425
|
+
end
|
426
|
+
ruby
|
427
|
+
|
428
|
+
compile do |g|
|
429
|
+
g.for_rescue do |rb|
|
430
|
+
rb.body do
|
431
|
+
g.push 12
|
432
|
+
end
|
433
|
+
|
434
|
+
rb.raw_condition do |body_label,next_label|
|
435
|
+
g.dup
|
436
|
+
g.push :self
|
437
|
+
g.send :blah, 0, true
|
438
|
+
g.cast_array
|
439
|
+
g.swap
|
440
|
+
|
441
|
+
g.send :__rescue_match__, 1
|
442
|
+
g.git body_label
|
443
|
+
g.goto next_label
|
444
|
+
|
445
|
+
body_label.set!
|
446
|
+
|
447
|
+
g.pop
|
448
|
+
g.push_current_exception
|
449
|
+
g.set_local 0
|
450
|
+
g.pop
|
451
|
+
|
452
|
+
g.push 13
|
453
|
+
end
|
454
|
+
end
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
relates <<-ruby do
|
459
|
+
begin
|
460
|
+
12
|
461
|
+
rescue String, *blah => e
|
462
|
+
13
|
463
|
+
end
|
464
|
+
ruby
|
465
|
+
|
466
|
+
compile do |g|
|
467
|
+
g.for_rescue do |rb|
|
468
|
+
rb.body do
|
469
|
+
g.push 12
|
470
|
+
end
|
471
|
+
|
472
|
+
rb.raw_condition do |body_label, next_label|
|
473
|
+
g.dup
|
474
|
+
g.push_const :String
|
475
|
+
g.swap
|
476
|
+
g.send :===, 1
|
477
|
+
g.git body_label
|
478
|
+
|
479
|
+
g.dup
|
480
|
+
g.push :self
|
481
|
+
g.send :blah, 0, true
|
482
|
+
g.cast_array
|
483
|
+
g.swap
|
484
|
+
|
485
|
+
g.send :__rescue_match__, 1
|
486
|
+
g.git body_label
|
487
|
+
|
488
|
+
g.goto next_label
|
489
|
+
|
490
|
+
body_label.set!
|
491
|
+
g.pop
|
492
|
+
|
493
|
+
g.push_current_exception
|
494
|
+
g.set_local 0
|
495
|
+
g.pop
|
496
|
+
|
497
|
+
g.push 13
|
498
|
+
end
|
499
|
+
end
|
500
|
+
end
|
501
|
+
end
|
502
|
+
|
503
|
+
relates <<-ruby do
|
504
|
+
begin
|
505
|
+
12
|
506
|
+
rescue String
|
507
|
+
return nil
|
508
|
+
end
|
509
|
+
ruby
|
510
|
+
|
511
|
+
compile do |g|
|
512
|
+
g.for_rescue do |rb|
|
513
|
+
rb.body do
|
514
|
+
g.push 12
|
515
|
+
end
|
516
|
+
|
517
|
+
rb.condition :String do
|
518
|
+
g.push :nil
|
519
|
+
rb.restore_exception
|
520
|
+
g.ret
|
521
|
+
end
|
522
|
+
end
|
523
|
+
end
|
524
|
+
end
|
525
|
+
|
526
|
+
relates <<-ruby do
|
527
|
+
begin
|
528
|
+
1
|
529
|
+
rescue
|
530
|
+
begin
|
531
|
+
2
|
532
|
+
rescue
|
533
|
+
return 3
|
534
|
+
end
|
535
|
+
end
|
536
|
+
ruby
|
537
|
+
|
538
|
+
compile do |g|
|
539
|
+
g.for_rescue do |rb|
|
540
|
+
rb.body do
|
541
|
+
g.push 1
|
542
|
+
end
|
543
|
+
|
544
|
+
rb.condition :StandardError, true do
|
545
|
+
g.for_rescue do |rb2|
|
546
|
+
rb2.body do
|
547
|
+
g.push 2
|
548
|
+
end
|
549
|
+
|
550
|
+
rb2.condition :StandardError, true do
|
551
|
+
g.push 3
|
552
|
+
g.push_stack_local 2
|
553
|
+
g.restore_exception_state
|
554
|
+
g.ret
|
555
|
+
end
|
556
|
+
end
|
557
|
+
end
|
558
|
+
end
|
559
|
+
end
|
560
|
+
end
|
561
|
+
|
562
|
+
relates <<-ruby do
|
563
|
+
begin
|
564
|
+
1
|
565
|
+
rescue
|
566
|
+
def x
|
567
|
+
return 2
|
568
|
+
end
|
569
|
+
x
|
570
|
+
end
|
571
|
+
ruby
|
572
|
+
|
573
|
+
compile do |g|
|
574
|
+
for_rescue do |rb|
|
575
|
+
rb.body do
|
576
|
+
g.push 1
|
577
|
+
end
|
578
|
+
|
579
|
+
rb.condition :StandardError, true do
|
580
|
+
g.push_rubinius
|
581
|
+
g.push_literal :x
|
582
|
+
|
583
|
+
d = new_generator(g, :x)
|
584
|
+
|
585
|
+
d.push 2
|
586
|
+
d.ret
|
587
|
+
d.ret
|
588
|
+
|
589
|
+
g.push_literal(d)
|
590
|
+
|
591
|
+
g.push_scope
|
592
|
+
g.push_variables
|
593
|
+
g.send :method_visibility, 0
|
594
|
+
g.send :add_defn_method, 4
|
595
|
+
g.pop
|
596
|
+
|
597
|
+
g.push :self
|
598
|
+
g.send :x, 0, true
|
599
|
+
end
|
600
|
+
end
|
601
|
+
end
|
602
|
+
end
|
603
|
+
|
604
|
+
relates <<-ruby do
|
605
|
+
begin
|
606
|
+
while 1
|
607
|
+
2
|
608
|
+
break :brk
|
609
|
+
end
|
610
|
+
rescue
|
611
|
+
3
|
612
|
+
end
|
613
|
+
ruby
|
614
|
+
|
615
|
+
compile do |g|
|
616
|
+
g.for_rescue do |rb|
|
617
|
+
rb.body do
|
618
|
+
top = g.new_label
|
619
|
+
post = g.new_label
|
620
|
+
bottom = g.new_label
|
621
|
+
brk = g.new_label
|
622
|
+
|
623
|
+
g.push_modifiers
|
624
|
+
|
625
|
+
top.set!
|
626
|
+
g.push 1
|
627
|
+
g.gif bottom
|
628
|
+
|
629
|
+
# redo
|
630
|
+
g.new_label.set!
|
631
|
+
|
632
|
+
g.push 2
|
633
|
+
g.pop
|
634
|
+
g.push_literal :brk
|
635
|
+
g.goto brk
|
636
|
+
|
637
|
+
post.set!
|
638
|
+
g.pop
|
639
|
+
g.check_interrupts
|
640
|
+
g.goto top
|
641
|
+
|
642
|
+
bottom.set!
|
643
|
+
g.push :nil
|
644
|
+
|
645
|
+
brk.set!
|
646
|
+
g.pop_modifiers
|
647
|
+
end
|
648
|
+
|
649
|
+
rb.condition :StandardError, true do
|
650
|
+
g.push 3
|
651
|
+
end
|
652
|
+
end
|
653
|
+
end
|
654
|
+
end
|
655
|
+
|
656
|
+
relates <<-ruby do
|
657
|
+
1.times do
|
658
|
+
begin
|
659
|
+
1
|
660
|
+
rescue
|
661
|
+
next
|
662
|
+
end
|
663
|
+
end
|
664
|
+
ruby
|
665
|
+
|
666
|
+
compile do |g|
|
667
|
+
g.push 1
|
668
|
+
g.in_block_send :times, :none, nil, 0, false do |d|
|
669
|
+
d.for_rescue do |rb|
|
670
|
+
|
671
|
+
rb.body do
|
672
|
+
d.push 1
|
673
|
+
end
|
674
|
+
|
675
|
+
rb.condition :StandardError, true do
|
676
|
+
d.push :nil
|
677
|
+
rb.next
|
678
|
+
end
|
679
|
+
end
|
680
|
+
end
|
681
|
+
end
|
682
|
+
end
|
683
|
+
|
684
|
+
relates <<-ruby do
|
685
|
+
1.times do
|
686
|
+
begin
|
687
|
+
next
|
688
|
+
rescue
|
689
|
+
2
|
690
|
+
end
|
691
|
+
end
|
692
|
+
ruby
|
693
|
+
|
694
|
+
compile do |g|
|
695
|
+
g.push 1
|
696
|
+
g.in_block_send :times, :none, nil, 0, false do |d|
|
697
|
+
d.for_rescue do |rb|
|
698
|
+
|
699
|
+
rb.body do
|
700
|
+
d.push :nil
|
701
|
+
rb.next
|
702
|
+
end
|
703
|
+
|
704
|
+
rb.condition :StandardError, true do
|
705
|
+
d.push 2
|
706
|
+
end
|
707
|
+
end
|
708
|
+
end
|
709
|
+
end
|
710
|
+
end
|
711
|
+
|
712
|
+
relates <<-ruby do
|
713
|
+
begin
|
714
|
+
1
|
715
|
+
rescue
|
716
|
+
while 2
|
717
|
+
3
|
718
|
+
break :brk
|
719
|
+
end
|
720
|
+
end
|
721
|
+
ruby
|
722
|
+
|
723
|
+
compile do |g|
|
724
|
+
g.for_rescue do |rb|
|
725
|
+
rb.body do
|
726
|
+
g.push 1
|
727
|
+
end
|
728
|
+
|
729
|
+
rb.condition :StandardError, true do
|
730
|
+
top = g.new_label
|
731
|
+
post = g.new_label
|
732
|
+
bottom = g.new_label
|
733
|
+
brk = g.new_label
|
734
|
+
|
735
|
+
g.push_modifiers
|
736
|
+
|
737
|
+
top.set!
|
738
|
+
g.push 2
|
739
|
+
g.gif bottom
|
740
|
+
|
741
|
+
# redo
|
742
|
+
g.new_label.set!
|
743
|
+
|
744
|
+
g.push 3
|
745
|
+
g.pop
|
746
|
+
g.push_literal :brk
|
747
|
+
rb.break
|
748
|
+
|
749
|
+
post.set!
|
750
|
+
g.pop
|
751
|
+
g.check_interrupts
|
752
|
+
g.goto top
|
753
|
+
|
754
|
+
bottom.set!
|
755
|
+
g.push :nil
|
756
|
+
brk.set!
|
757
|
+
|
758
|
+
g.pop_modifiers
|
759
|
+
end
|
760
|
+
end
|
761
|
+
end
|
762
|
+
end
|
763
|
+
end
|