rubinius-ast 2.0.1 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubinius/ast/control_flow.rb +28 -0
- data/lib/rubinius/ast/encoding.rb +4 -0
- data/lib/rubinius/ast/exceptions.rb +12 -0
- data/lib/rubinius/ast/file.rb +4 -0
- data/lib/rubinius/ast/node.rb +13 -0
- data/lib/rubinius/ast/sends.rb +9 -0
- data/lib/rubinius/ast/version.rb +1 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0d44e97202408ba20e775f2078d53222ae1486b
|
4
|
+
data.tar.gz: 3643e451326f459f02a2a58e977e716276963cb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5726d292c18c83fa8021f14204a7433954a947901c78272a8a5348e4d042feca1030dbe890b49328e760a4d6b81a9077474da34803d0ad779e2003b0514b9e65
|
7
|
+
data.tar.gz: c098a11bc2240cfab802347dd3cc896bb6a70cca00545b55edc8d2403b103870d812586c2cc98475a6cf4912c1016a19b223b7236b76401786ef2b2992dfe243
|
@@ -28,6 +28,10 @@ module Rubinius::ToolSet.current::TS
|
|
28
28
|
done.set!
|
29
29
|
end
|
30
30
|
|
31
|
+
def defined(g)
|
32
|
+
g.push_literal "expression"
|
33
|
+
end
|
34
|
+
|
31
35
|
def receiver_sexp
|
32
36
|
nil
|
33
37
|
end
|
@@ -328,6 +332,10 @@ module Rubinius::ToolSet.current::TS
|
|
328
332
|
done.set!
|
329
333
|
end
|
330
334
|
|
335
|
+
def defined(g)
|
336
|
+
g.push_literal "expression"
|
337
|
+
end
|
338
|
+
|
331
339
|
def to_sexp
|
332
340
|
else_sexp = @else.kind_of?(NilLiteral) ? nil : @else.to_sexp
|
333
341
|
[:if, @condition.to_sexp, @body.to_sexp, else_sexp]
|
@@ -405,6 +413,10 @@ module Rubinius::ToolSet.current::TS
|
|
405
413
|
g.pop_modifiers
|
406
414
|
end
|
407
415
|
|
416
|
+
def defined(g)
|
417
|
+
g.push_literal "expression"
|
418
|
+
end
|
419
|
+
|
408
420
|
def sexp_name
|
409
421
|
:while
|
410
422
|
end
|
@@ -539,6 +551,8 @@ module Rubinius::ToolSet.current::TS
|
|
539
551
|
def bytecode(g)
|
540
552
|
pos(g)
|
541
553
|
|
554
|
+
g.pop if g.state.inside_ensure?
|
555
|
+
|
542
556
|
@value.bytecode(g)
|
543
557
|
|
544
558
|
if g.break
|
@@ -549,6 +563,12 @@ module Rubinius::ToolSet.current::TS
|
|
549
563
|
g.pop
|
550
564
|
jump_error g, :break
|
551
565
|
end
|
566
|
+
|
567
|
+
g.push_nil if g.state.inside_ensure?
|
568
|
+
end
|
569
|
+
|
570
|
+
def defined(g)
|
571
|
+
g.push_literal "expression"
|
552
572
|
end
|
553
573
|
|
554
574
|
def sexp_name
|
@@ -571,6 +591,8 @@ module Rubinius::ToolSet.current::TS
|
|
571
591
|
def bytecode(g)
|
572
592
|
pos(g)
|
573
593
|
|
594
|
+
g.pop if g.state.inside_ensure?
|
595
|
+
|
574
596
|
# From "The Ruby Programming Lanuage"
|
575
597
|
# "When next is used in a loop, any values following the next
|
576
598
|
# are ignored"
|
@@ -597,6 +619,8 @@ module Rubinius::ToolSet.current::TS
|
|
597
619
|
|
598
620
|
jump_error g, :next
|
599
621
|
end
|
622
|
+
|
623
|
+
g.push_nil if g.state.inside_ensure?
|
600
624
|
end
|
601
625
|
|
602
626
|
def sexp_name
|
@@ -687,6 +711,10 @@ module Rubinius::ToolSet.current::TS
|
|
687
711
|
end
|
688
712
|
end
|
689
713
|
|
714
|
+
def defined(g)
|
715
|
+
g.push_literal "expression"
|
716
|
+
end
|
717
|
+
|
690
718
|
def to_sexp
|
691
719
|
sexp = [:return]
|
692
720
|
sexp << @value.to_sexp if @value
|
@@ -14,6 +14,11 @@ module Rubinius::ToolSet.current::TS
|
|
14
14
|
@rescue.bytecode(g)
|
15
15
|
end
|
16
16
|
|
17
|
+
def defined(g)
|
18
|
+
return @rescue.defined(g) if @rescue
|
19
|
+
g.push_literal "nil"
|
20
|
+
end
|
21
|
+
|
17
22
|
def to_sexp
|
18
23
|
@rescue.to_sexp
|
19
24
|
end
|
@@ -99,6 +104,7 @@ module Rubinius::ToolSet.current::TS
|
|
99
104
|
|
100
105
|
g.push_exception_state
|
101
106
|
|
107
|
+
g.state.push_inside_ensure
|
102
108
|
g.state.push_rescue(outer_exc_state)
|
103
109
|
@ensure.bytecode(g)
|
104
110
|
g.state.pop_rescue
|
@@ -160,6 +166,7 @@ module Rubinius::ToolSet.current::TS
|
|
160
166
|
g.next ? g.goto(g.next) : g.ret
|
161
167
|
post.set!
|
162
168
|
end
|
169
|
+
g.state.pop_inside_ensure
|
163
170
|
end
|
164
171
|
|
165
172
|
def to_sexp
|
@@ -348,6 +355,11 @@ module Rubinius::ToolSet.current::TS
|
|
348
355
|
g.pop_modifiers
|
349
356
|
end
|
350
357
|
|
358
|
+
def defined(g)
|
359
|
+
@body.defined(g) if @body
|
360
|
+
g.push_literal "nil"
|
361
|
+
end
|
362
|
+
|
351
363
|
def to_sexp
|
352
364
|
sexp = [:rescue, @body.to_sexp, @rescue.to_sexp]
|
353
365
|
sexp << @else.to_sexp if @else
|
data/lib/rubinius/ast/file.rb
CHANGED
data/lib/rubinius/ast/node.rb
CHANGED
@@ -272,6 +272,7 @@ module Rubinius::ToolSet.current::TS
|
|
272
272
|
def initialize(scope)
|
273
273
|
@scope = scope
|
274
274
|
@ensure = 0
|
275
|
+
@inside_ensure = 0
|
275
276
|
@block = 0
|
276
277
|
@masgn = 0
|
277
278
|
@loop = 0
|
@@ -317,6 +318,18 @@ module Rubinius::ToolSet.current::TS
|
|
317
318
|
@ensure > 0
|
318
319
|
end
|
319
320
|
|
321
|
+
def push_inside_ensure
|
322
|
+
@inside_ensure += 1
|
323
|
+
end
|
324
|
+
|
325
|
+
def pop_inside_ensure
|
326
|
+
@inside_ensure -= 1 if inside_ensure?
|
327
|
+
end
|
328
|
+
|
329
|
+
def inside_ensure?
|
330
|
+
@inside_ensure > 0
|
331
|
+
end
|
332
|
+
|
320
333
|
def push_block
|
321
334
|
@block += 1
|
322
335
|
end
|
data/lib/rubinius/ast/sends.rb
CHANGED
@@ -65,6 +65,11 @@ module Rubinius::ToolSet.current::TS
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def defined(g)
|
68
|
+
if @block.kind_of? For
|
69
|
+
@block.defined(g)
|
70
|
+
return
|
71
|
+
end
|
72
|
+
|
68
73
|
if @vcall_style and check_local_reference(g)
|
69
74
|
g.push_literal "local-variable"
|
70
75
|
return
|
@@ -803,6 +808,10 @@ module Rubinius::ToolSet.current::TS
|
|
803
808
|
var.variable = reference
|
804
809
|
end
|
805
810
|
|
811
|
+
def defined(g)
|
812
|
+
g.push_literal "expression"
|
813
|
+
end
|
814
|
+
|
806
815
|
def sexp_name
|
807
816
|
:for
|
808
817
|
end
|
data/lib/rubinius/ast/version.rb
CHANGED
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubinius-ast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Shirai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
description: An Abstract Syntax Tree for Ruby.
|
@@ -45,7 +45,7 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
-
- .gitignore
|
48
|
+
- ".gitignore"
|
49
49
|
- Gemfile
|
50
50
|
- LICENSE
|
51
51
|
- README.md
|
@@ -79,12 +79,12 @@ require_paths:
|
|
79
79
|
- lib
|
80
80
|
required_ruby_version: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
@@ -94,3 +94,4 @@ signing_key:
|
|
94
94
|
specification_version: 4
|
95
95
|
summary: An Abstract Syntax Tree for Ruby.
|
96
96
|
test_files: []
|
97
|
+
has_rdoc:
|