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/return_spec.rb
CHANGED
@@ -1,57 +1,40 @@
|
|
1
1
|
describe "A Return node" do
|
2
|
-
|
3
|
-
|
4
|
-
[:return]
|
5
|
-
end
|
2
|
+
parse "return" do
|
3
|
+
[:return]
|
6
4
|
end
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
[:return, [:lit, 1]]
|
11
|
-
end
|
6
|
+
parse "return 1" do
|
7
|
+
[:return, [:lit, 1]]
|
12
8
|
end
|
13
9
|
|
14
|
-
|
15
|
-
|
16
|
-
[:return, [:svalue, [:splat, [:lit, 1]]]]
|
17
|
-
end
|
10
|
+
parse "return *1" do
|
11
|
+
[:return, [:splat, [:lit, 1]]]
|
18
12
|
end
|
19
13
|
|
20
|
-
|
14
|
+
parse <<-ruby do
|
21
15
|
x = 1, 2
|
22
16
|
return *x
|
23
17
|
ruby
|
24
18
|
|
25
|
-
|
26
|
-
[:
|
27
|
-
|
28
|
-
[:return, [:svalue, [:splat, [:lvar, :x]]]]]
|
29
|
-
end
|
19
|
+
[:block,
|
20
|
+
[:lasgn, :x, [:array, [:lit, 1], [:lit, 2]]],
|
21
|
+
[:return, [:splat, [:lvar, :x]]]]
|
30
22
|
end
|
31
23
|
|
32
|
-
|
33
|
-
|
34
|
-
[:return, [:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
|
35
|
-
end
|
24
|
+
parse "return 1, 2, 3" do
|
25
|
+
[:return, [:array, [:lit, 1], [:lit, 2], [:lit, 3]]]
|
36
26
|
end
|
37
27
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
[:array,
|
42
|
-
[:lit, 1], [:lit, 2], [:splat, [:call, nil, :c, [:arglist]]]]]
|
43
|
-
end
|
28
|
+
parse "return 1, 2, *c" do
|
29
|
+
[:return,
|
30
|
+
[:argscat, [:array, [:lit, 1], [:lit, 2]], [:call, nil, :c, [:arglist]]]]
|
44
31
|
end
|
45
32
|
|
46
|
-
|
47
|
-
|
48
|
-
[:return, [:array, [:splat, [:array, [:lit, 1]]]]]
|
49
|
-
end
|
33
|
+
parse "return [*[1]]" do
|
34
|
+
[:return, [:splat, [:array, [:lit, 1]]]]
|
50
35
|
end
|
51
36
|
|
52
|
-
|
53
|
-
|
54
|
-
[:return, [:svalue, [:splat, [:array, [:lit, 1]]]]]
|
55
|
-
end
|
37
|
+
parse "return *[1]" do
|
38
|
+
[:return, [:splat, [:array, [:lit, 1]]]]
|
56
39
|
end
|
57
40
|
end
|
data/spec/sclass_spec.rb
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
describe "An Sclass node" do
|
2
|
-
|
2
|
+
parse <<-ruby do
|
3
3
|
class << self
|
4
4
|
42
|
5
5
|
end
|
6
6
|
ruby
|
7
7
|
|
8
|
-
|
9
|
-
[:sclass, [:self], [:scope, [:lit, 42]]]
|
10
|
-
end
|
8
|
+
[:sclass, [:self], [:scope, [:block, [:lit, 42]]]]
|
11
9
|
end
|
12
10
|
|
13
|
-
|
11
|
+
parse <<-ruby do
|
14
12
|
class A
|
15
13
|
class << self
|
16
14
|
a
|
@@ -20,36 +18,39 @@ describe "An Sclass node" do
|
|
20
18
|
end
|
21
19
|
ruby
|
22
20
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
[:class, :B, nil, [:scope]]]]]
|
31
|
-
end
|
21
|
+
[:class,
|
22
|
+
:A,
|
23
|
+
nil,
|
24
|
+
[:scope,
|
25
|
+
[:block,
|
26
|
+
[:sclass, [:self], [:scope, [:block, [:call, nil, :a, [:arglist]]]]],
|
27
|
+
[:class, :B, nil, [:scope]]]]]
|
32
28
|
end
|
33
29
|
|
34
|
-
|
30
|
+
parse <<-ruby do
|
35
31
|
x = "a"
|
36
32
|
class << x
|
37
33
|
end
|
38
34
|
ruby
|
39
35
|
|
40
|
-
|
41
|
-
[:
|
42
|
-
|
43
|
-
[:sclass, [:lvar, :x], [:scope]]]
|
44
|
-
end
|
36
|
+
[:block,
|
37
|
+
[:lasgn, :x, [:str, "a"]],
|
38
|
+
[:sclass, [:lvar, :x], [:scope]]]
|
45
39
|
end
|
46
40
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
41
|
+
parse <<-ruby do
|
42
|
+
x = "a"
|
43
|
+
m do
|
44
|
+
class << x
|
45
|
+
end
|
51
46
|
end
|
52
|
-
end
|
53
47
|
ruby
|
48
|
+
|
49
|
+
[:block,
|
50
|
+
[:lasgn, :x, [:str, "a"]],
|
51
|
+
[:call,
|
52
|
+
nil,
|
53
|
+
:m,
|
54
|
+
[:arglist, [:iter, [:args], [:sclass, [:lvar, :x], [:scope]]]]]]
|
54
55
|
end
|
55
56
|
end
|
data/spec/spec_helper.rb
ADDED
data/spec/str_spec.rb
CHANGED
@@ -1,48 +1,38 @@
|
|
1
1
|
describe "A Str node" do
|
2
|
-
|
3
|
-
|
4
|
-
[:str, "x"]
|
5
|
-
end
|
2
|
+
parse '"x"' do
|
3
|
+
[:str, "x"]
|
6
4
|
end
|
7
5
|
|
8
|
-
|
6
|
+
parse <<-ruby do
|
9
7
|
"before" \
|
10
8
|
" after"
|
11
9
|
ruby
|
12
10
|
|
13
|
-
|
14
|
-
[:str, "before after"]
|
15
|
-
end
|
11
|
+
[:str, "before after"]
|
16
12
|
end
|
17
13
|
|
18
|
-
|
19
|
-
|
20
|
-
[:str, "before after"]
|
21
|
-
end
|
14
|
+
parse '"before" " after"' do
|
15
|
+
[:str, "before after"]
|
22
16
|
end
|
23
17
|
|
24
|
-
|
18
|
+
parse <<-ruby do
|
25
19
|
"file = \#{__FILE__}\n"
|
26
20
|
ruby
|
27
21
|
|
28
|
-
|
29
|
-
[:dstr, "file = ", [:evstr, [:file]], [:str, "\n"]]
|
30
|
-
end
|
22
|
+
[:dstr, "file = ", [:evstr, [:file]], [:str, "\n"]]
|
31
23
|
end
|
32
24
|
|
33
|
-
|
25
|
+
parse <<-ruby do
|
34
26
|
<<'EOM'.strip
|
35
27
|
blah
|
36
28
|
blah
|
37
29
|
EOM
|
38
30
|
ruby
|
39
31
|
|
40
|
-
|
41
|
-
[:call, [:str, " blah\nblah\n"], :strip, [:arglist]]
|
42
|
-
end
|
32
|
+
[:call, [:str, " blah\nblah\n"], :strip, [:arglist]]
|
43
33
|
end
|
44
34
|
|
45
|
-
|
35
|
+
parse <<-ruby do
|
46
36
|
a += <<-H1 + b + <<-H2
|
47
37
|
first
|
48
38
|
H1
|
@@ -50,21 +40,19 @@ H1
|
|
50
40
|
H2
|
51
41
|
ruby
|
52
42
|
|
53
|
-
|
54
|
-
|
55
|
-
|
43
|
+
[:lasgn,
|
44
|
+
:a,
|
45
|
+
[:call,
|
46
|
+
[:lvar, :a],
|
47
|
+
:+,
|
48
|
+
[:arglist,
|
56
49
|
[:call,
|
57
|
-
[:
|
50
|
+
[:call, [:str, " first\n"], :+, [:arglist, [:call, nil, :b, [:arglist]]]],
|
58
51
|
:+,
|
59
|
-
[:arglist,
|
60
|
-
[:call,
|
61
|
-
[:call, [:str, " first\n"], :+, [:arglist, [:call, nil, :b, [:arglist]]]],
|
62
|
-
:+,
|
63
|
-
[:arglist, [:str, " second\n"]]]]]]
|
64
|
-
end
|
52
|
+
[:arglist, [:str, " second\n"]]]]]]
|
65
53
|
end
|
66
54
|
|
67
|
-
|
55
|
+
parse <<-ruby do
|
68
56
|
<<-EOM
|
69
57
|
blah
|
70
58
|
blah
|
@@ -72,26 +60,20 @@ blah
|
|
72
60
|
EOM
|
73
61
|
ruby
|
74
62
|
|
75
|
-
|
76
|
-
[:str, " blah\nblah\n\n"]
|
77
|
-
end
|
63
|
+
[:str, " blah\nblah\n\n"]
|
78
64
|
end
|
79
65
|
|
80
|
-
|
66
|
+
parse <<-ruby do
|
81
67
|
<<'EOM'
|
82
68
|
blah
|
83
69
|
blah
|
84
70
|
EOM
|
85
71
|
ruby
|
86
72
|
|
87
|
-
|
88
|
-
[:str, " blah\nblah\n"]
|
89
|
-
end
|
73
|
+
[:str, " blah\nblah\n"]
|
90
74
|
end
|
91
75
|
|
92
|
-
|
93
|
-
|
94
|
-
[:str, "blah"]
|
95
|
-
end
|
76
|
+
parse "%(blah)" do
|
77
|
+
[:str, "blah"]
|
96
78
|
end
|
97
79
|
end
|
data/spec/super_spec.rb
CHANGED
@@ -1,93 +1,75 @@
|
|
1
1
|
describe "A Super node" do
|
2
|
-
|
2
|
+
parse <<-ruby do
|
3
3
|
def x
|
4
4
|
super()
|
5
5
|
end
|
6
6
|
ruby
|
7
7
|
|
8
|
-
|
9
|
-
[:defn, :x, [:args], [:scope, [:block, [:super]]]]
|
10
|
-
end
|
8
|
+
[:defn, :x, [:args], [:scope, [:block, [:super]]]]
|
11
9
|
end
|
12
10
|
|
13
|
-
|
11
|
+
parse <<-ruby do
|
14
12
|
def x(&block)
|
15
13
|
super(&block)
|
16
14
|
end
|
17
15
|
ruby
|
18
16
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
[:scope, [:block, [:super, [:block_pass, [:lvar, :block]]]]]]
|
24
|
-
end
|
17
|
+
[:defn,
|
18
|
+
:x,
|
19
|
+
[:args, :"&block"],
|
20
|
+
[:scope, [:block, [:super, [:block_pass, [:lvar, :block]]]]]]
|
25
21
|
end
|
26
22
|
|
27
|
-
|
23
|
+
parse <<-ruby do
|
28
24
|
def x
|
29
25
|
super([24, 42])
|
30
26
|
end
|
31
27
|
ruby
|
32
28
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
[:scope, [:block, [:super, [:array, [:lit, 24], [:lit, 42]]]]]]
|
38
|
-
end
|
29
|
+
[:defn,
|
30
|
+
:x,
|
31
|
+
[:args],
|
32
|
+
[:scope, [:block, [:super, [:array, [:lit, 24], [:lit, 42]]]]]]
|
39
33
|
end
|
40
34
|
|
41
|
-
|
35
|
+
parse <<-ruby do
|
42
36
|
def x
|
43
37
|
super(4)
|
44
38
|
end
|
45
39
|
ruby
|
46
40
|
|
47
|
-
|
48
|
-
[:defn, :x, [:args], [:scope, [:block, [:super, [:lit, 4]]]]]
|
49
|
-
end
|
41
|
+
[:defn, :x, [:args], [:scope, [:block, [:super, [:lit, 4]]]]]
|
50
42
|
end
|
51
43
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
[:block_pass, [:call, nil, :b, [:arglist]]]]
|
57
|
-
end
|
44
|
+
parse "super(a, &b)" do
|
45
|
+
[:super,
|
46
|
+
[:call, nil, :a, [:arglist]],
|
47
|
+
[:block_pass, [:call, nil, :b, [:arglist]]]]
|
58
48
|
end
|
59
49
|
|
60
|
-
|
61
|
-
|
62
|
-
[:
|
63
|
-
|
64
|
-
[:splat, [:call, nil, :b, [:arglist]]]]
|
65
|
-
end
|
50
|
+
parse "super(a, *b)" do
|
51
|
+
[:super,
|
52
|
+
[:call, nil, :a, [:arglist]],
|
53
|
+
[:splat, [:call, nil, :b, [:arglist]]]]
|
66
54
|
end
|
67
55
|
|
68
|
-
|
56
|
+
parse <<-ruby do
|
69
57
|
def x
|
70
58
|
super(24, 42)
|
71
59
|
end
|
72
60
|
ruby
|
73
61
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
[:scope, [:block, [:super, [:lit, 24], [:lit, 42]]]]]
|
79
|
-
end
|
62
|
+
[:defn,
|
63
|
+
:x,
|
64
|
+
[:args],
|
65
|
+
[:scope, [:block, [:super, [:lit, 24], [:lit, 42]]]]]
|
80
66
|
end
|
81
67
|
|
82
|
-
|
83
|
-
|
84
|
-
[:super, [:array, [:splat, [:array, [:lit, 1]]]]]
|
85
|
-
end
|
68
|
+
parse "super([*[1]])" do
|
69
|
+
[:super, [:splat, [:array, [:lit, 1]]]]
|
86
70
|
end
|
87
71
|
|
88
|
-
|
89
|
-
|
90
|
-
[:super, [:splat, [:array, [:lit, 1]]]]
|
91
|
-
end
|
72
|
+
parse "super(*[1])" do
|
73
|
+
[:super, [:splat, [:array, [:lit, 1]]]]
|
92
74
|
end
|
93
75
|
end
|
data/spec/true_spec.rb
CHANGED
data/spec/undef_spec.rb
CHANGED
@@ -1,98 +1,83 @@
|
|
1
1
|
describe "An Undef node" do
|
2
|
-
|
3
|
-
|
4
|
-
[:undef, [:lit, :x]]
|
5
|
-
end
|
2
|
+
parse "undef :x" do
|
3
|
+
[:undef, [:lit, :x]]
|
6
4
|
end
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
[:block, [:undef, [:lit, :x]], [:undef, [:lit, :y]]]
|
11
|
-
end
|
6
|
+
parse "undef :x, :y" do
|
7
|
+
[:block, [:undef, [:lit, :x]], [:undef, [:lit, :y]]]
|
12
8
|
end
|
13
9
|
|
14
|
-
|
15
|
-
|
16
|
-
[:block, [:undef, [:lit, :x]], [:undef, [:lit, :y]], [:undef, [:lit, :z]]]
|
17
|
-
end
|
10
|
+
parse "undef :x, :y, :z" do
|
11
|
+
[:block, [:undef, [:lit, :x]], [:undef, [:lit, :y]], [:undef, [:lit, :z]]]
|
18
12
|
end
|
19
13
|
|
20
|
-
|
14
|
+
parse <<-ruby do
|
21
15
|
f1
|
22
16
|
undef :x
|
23
17
|
ruby
|
24
18
|
|
25
|
-
|
26
|
-
[:block, [:call, nil, :f1, [:arglist]], [:undef, [:lit, :x]]]
|
27
|
-
end
|
19
|
+
[:block, [:call, nil, :f1, [:arglist]], [:undef, [:lit, :x]]]
|
28
20
|
end
|
29
21
|
|
30
|
-
|
22
|
+
parse <<-ruby do
|
31
23
|
f1
|
32
24
|
undef :x, :y
|
33
25
|
ruby
|
34
26
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
end
|
27
|
+
[:block,
|
28
|
+
[:call, nil, :f1, [:arglist]],
|
29
|
+
[:undef, [:lit, :x]],
|
30
|
+
[:undef, [:lit, :y]]]
|
40
31
|
end
|
41
32
|
|
42
|
-
|
33
|
+
parse <<-ruby do
|
43
34
|
undef :x, :y, :z
|
44
35
|
f2
|
45
36
|
ruby
|
46
37
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
[:call, nil, :f2, [:arglist]]]
|
53
|
-
end
|
38
|
+
[:block,
|
39
|
+
[:undef, [:lit, :x]],
|
40
|
+
[:undef, [:lit, :y]],
|
41
|
+
[:undef, [:lit, :z]],
|
42
|
+
[:call, nil, :f2, [:arglist]]]
|
54
43
|
end
|
55
44
|
|
56
|
-
|
45
|
+
parse <<-ruby do
|
57
46
|
f1
|
58
47
|
undef :x, :y, :z
|
59
48
|
ruby
|
60
49
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
50
|
+
[:block,
|
51
|
+
[:call, nil, :f1, [:arglist]],
|
52
|
+
[:undef, [:lit, :x]],
|
53
|
+
[:undef, [:lit, :y]],
|
54
|
+
[:undef, [:lit, :z]]]
|
66
55
|
end
|
67
56
|
|
68
|
-
|
57
|
+
parse <<-ruby do
|
69
58
|
f1
|
70
59
|
undef :x, :y, :z
|
71
60
|
f2
|
72
61
|
ruby
|
73
62
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
63
|
+
[:block,
|
64
|
+
[:call, nil, :f1, [:arglist]],
|
65
|
+
[:undef, [:lit, :x]],
|
66
|
+
[:undef, [:lit, :y]],
|
67
|
+
[:undef, [:lit, :z]],
|
68
|
+
[:call, nil, :f2, [:arglist]]]
|
80
69
|
end
|
81
70
|
|
82
|
-
|
83
|
-
|
84
|
-
[:class, :B, nil, [:scope, [:undef, [:lit, :blah]]]]
|
85
|
-
end
|
71
|
+
parse "class B; undef :blah; end" do
|
72
|
+
[:class, :B, nil, [:scope, [:block, [:undef, [:lit, :blah]]]]]
|
86
73
|
end
|
87
74
|
|
88
|
-
|
75
|
+
parse <<-ruby do
|
89
76
|
undef :"x\#{1}", :"x\#{2}"
|
90
77
|
ruby
|
91
78
|
|
92
|
-
|
93
|
-
[:
|
94
|
-
|
95
|
-
[:undef, [:dsym, "x", [:evstr, [:lit, 2]]]]]
|
96
|
-
end
|
79
|
+
[:block,
|
80
|
+
[:undef, [:dsym, "x", [:evstr, [:lit, 1]]]],
|
81
|
+
[:undef, [:dsym, "x", [:evstr, [:lit, 2]]]]]
|
97
82
|
end
|
98
83
|
end
|