Skip to content

Commit 03b6ab5

Browse files
committedJul 31, 2013
Fix Array#== not properly comparing children
Only if children were arrays then were they properly compared. This commit fixes that.
1 parent 7c05062 commit 03b6ab5

36 files changed

+167
-172
lines changed
 

Diff for: ‎corelib/opal/array.rb

+3-8
Original file line numberDiff line numberDiff line change
@@ -222,16 +222,11 @@ def ==(other)
222222
tmp1 = #{self}[i];
223223
tmp2 = #{other}[i];
224224
225-
//recursive
226-
if (tmp1 && (typeof(tmp1.indexOf) == "function") &&
227-
(typeof(tmp2.indexOf) == "function") && tmp2 &&
228-
(tmp1.indexOf(tmp2) == tmp2.indexOf(tmp1))) {
229-
if (tmp1.indexOf(tmp1) == tmp2.indexOf(tmp2)) {
230-
continue;
231-
}
225+
if (tmp1._isArray && tmp2._isArray && (tmp1 === #{self})) {
226+
continue;
232227
}
233228
234-
if (!(#{`#{self}[i]` == `other[i]`})) {
229+
if (!(#{`tmp1` == `tmp2`})) {
235230
return false;
236231
}
237232

Diff for: ‎spec/parser/alias_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
describe "The alias keyword" do
44
describe "with fitem" do
5-
it "should return an s(:alias) with s(:lit)" do
6-
opal_parse("alias a b").should == [:alias, [:lit, :a], [:lit, :b]]
7-
opal_parse("alias == equals").should == [:alias, [:lit, :==], [:lit, :equals]]
5+
it "should return an s(:alias) with s(:sym)" do
6+
opal_parse("alias a b").should == [:alias, [:sym, :a], [:sym, :b]]
7+
opal_parse("alias == equals").should == [:alias, [:sym, :==], [:sym, :equals]]
88
end
99

1010
it "should accept symbols as names" do
11-
opal_parse("alias :foo :bar").should == [:alias, [:lit, :foo], [:lit, :bar]]
11+
opal_parse("alias :foo :bar").should == [:alias, [:sym, :foo], [:sym, :bar]]
1212
end
1313
end
1414

Diff for: ‎spec/parser/and_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
describe "The and statement" do
44
it "should always return s(:and)" do
5-
opal_parse("1 and 2").should == [:and, [:lit, 1], [:lit, 2]]
5+
opal_parse("1 and 2").should == [:and, [:int, 1], [:int, 2]]
66
end
77
end
88

99
describe "The && expression" do
1010
it "should always return s(:and)" do
11-
opal_parse("1 && 2").should == [:and, [:lit, 1], [:lit, 2]]
11+
opal_parse("1 && 2").should == [:and, [:int, 1], [:int, 2]]
1212
end
1313
end

Diff for: ‎spec/parser/array_spec.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
end
77

88
it "should append regular args onto end of array sexp" do
9-
opal_parse("[1]").should == [:array, [:lit, 1]]
10-
opal_parse("[1, 2]").should == [:array, [:lit, 1], [:lit, 2]]
11-
opal_parse("[1, 2, 3]").should == [:array, [:lit, 1], [:lit, 2], [:lit, 3]]
9+
opal_parse("[1]").should == [:array, [:int, 1]]
10+
opal_parse("[1, 2]").should == [:array, [:int, 1], [:int, 2]]
11+
opal_parse("[1, 2, 3]").should == [:array, [:int, 1], [:int, 2], [:int, 3]]
1212
end
1313

1414
it "should return a single item s(:array) with given splat if no norm args" do
15-
opal_parse("[*1]").should == [:array, [:splat, [:lit, 1]]]
15+
opal_parse("[*1]").should == [:array, [:splat, [:int, 1]]]
1616
end
1717

1818
it "should allow splats combined with any number of norm args" do
19-
opal_parse("[1, *2]").should == [:array, [:lit, 1], [:splat, [:lit, 2]]]
20-
opal_parse("[1, 2, *3]").should == [:array, [:lit, 1], [:lit, 2], [:splat, [:lit, 3]]]
19+
opal_parse("[1, *2]").should == [:array, [:int, 1], [:splat, [:int, 2]]]
20+
opal_parse("[1, 2, *3]").should == [:array, [:int, 1], [:int, 2], [:splat, [:int, 3]]]
2121
end
2222
end

Diff for: ‎spec/parser/attrasgn_spec.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22

33
describe "Attribute assignments" do
44
it "should return a s(:attrasgn) for simple assignments" do
5-
opal_parse('self.foo = 1').should == [:attrasgn, [:self], :foo=, [:arglist, [:lit, 1]]]
6-
opal_parse('bar.foo = 1').should == [:attrasgn, [:call, nil, :bar, [:arglist]], :foo=, [:arglist, [:lit, 1]]]
7-
opal_parse('@bar.foo = 1').should == [:attrasgn, [:ivar, :@bar], :foo=, [:arglist, [:lit, 1]]]
5+
opal_parse('self.foo = 1').should == [:attrasgn, [:self], :foo=, [:arglist, [:int, 1]]]
6+
opal_parse('bar.foo = 1').should == [:attrasgn, [:call, nil, :bar, [:arglist]], :foo=, [:arglist, [:int, 1]]]
7+
opal_parse('@bar.foo = 1').should == [:attrasgn, [:ivar, :@bar], :foo=, [:arglist, [:int, 1]]]
88
end
99

1010
it "accepts both '.' and '::' for method call operators" do
11-
opal_parse('self.foo = 1').should == [:attrasgn, [:self], :foo=, [:arglist, [:lit, 1]]]
12-
opal_parse('self::foo = 1').should == [:attrasgn, [:self], :foo=, [:arglist, [:lit, 1]]]
11+
opal_parse('self.foo = 1').should == [:attrasgn, [:self], :foo=, [:arglist, [:int, 1]]]
12+
opal_parse('self::foo = 1').should == [:attrasgn, [:self], :foo=, [:arglist, [:int, 1]]]
1313
end
1414

1515
it "can accept a constant as assignable name when using '.'" do
16-
opal_parse('self.FOO = 1').should == [:attrasgn, [:self], :FOO=, [:arglist, [:lit, 1]]]
16+
opal_parse('self.FOO = 1').should == [:attrasgn, [:self], :FOO=, [:arglist, [:int, 1]]]
1717
end
1818

1919
describe "when setting element reference" do
2020
it "uses []= as the method call" do
21-
opal_parse('self[1] = 2').should == [:attrasgn, [:self], :[]=, [:arglist, [:lit, 1], [:lit, 2]]]
21+
opal_parse('self[1] = 2').should == [:attrasgn, [:self], :[]=, [:arglist, [:int, 1], [:int, 2]]]
2222
end
2323

2424
it "supports multiple arguments inside brackets" do
25-
opal_parse('self[1, 2] = 3').should == [:attrasgn, [:self], :[]=, [:arglist, [:lit, 1], [:lit, 2], [:lit, 3]]]
25+
opal_parse('self[1, 2] = 3').should == [:attrasgn, [:self], :[]=, [:arglist, [:int, 1], [:int, 2], [:int, 3]]]
2626
end
2727
end
2828
end

Diff for: ‎spec/parser/begin_spec.rb

+11-11
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,41 @@
22

33
describe "The begin keyword" do
44
it "should be removed when used without a resuce or enusre body" do
5-
opal_parse('begin; 1; end').should == [:lit, 1]
6-
opal_parse('begin; 1; 2; end').should == [:block, [:lit, 1], [:lit, 2]]
5+
opal_parse('begin; 1; end').should == [:int, 1]
6+
opal_parse('begin; 1; 2; end').should == [:block, [:int, 1], [:int, 2]]
77
end
88

99
describe "with 'rescue' bodies" do
1010
it "should create a s(:rescue) sexp" do
11-
opal_parse('begin; 1; rescue; 2; end').should == [:rescue, [:lit, 1], [:resbody, [:array], [:lit, 2]]]
11+
opal_parse('begin; 1; rescue; 2; end').should == [:rescue, [:int, 1], [:resbody, [:array], [:int, 2]]]
1212
end
1313

1414
it "allows multiple rescue bodies" do
15-
opal_parse('begin 1; rescue; 2; rescue; 3; end').should == [:rescue, [:lit, 1], [:resbody, [:array], [:lit, 2]], [:resbody, [:array], [:lit, 3]]]
15+
opal_parse('begin 1; rescue; 2; rescue; 3; end').should == [:rescue, [:int, 1], [:resbody, [:array], [:int, 2]], [:resbody, [:array], [:int, 3]]]
1616
end
1717

1818
it "accepts a list of classes used to match against the exception" do
19-
opal_parse('begin 1; rescue Klass; 2; end').should == [:rescue, [:lit, 1], [:resbody, [:array, [:const, :Klass]], [:lit, 2]]]
19+
opal_parse('begin 1; rescue Klass; 2; end').should == [:rescue, [:int, 1], [:resbody, [:array, [:const, :Klass]], [:int, 2]]]
2020
end
2121

2222
it "accepts an identifier to assign exception to" do
23-
opal_parse('begin 1; rescue => a; 2; end').should == [:rescue, [:lit, 1], [:resbody, [:array, [:lasgn, :a, [:gvar, :$!]]], [:lit, 2]]]
24-
opal_parse('begin 1; rescue Klass => a; 2; end').should == [:rescue, [:lit, 1], [:resbody, [:array, [:const, :Klass],[:lasgn, :a, [:gvar, :$!]]], [:lit, 2]]]
23+
opal_parse('begin 1; rescue => a; 2; end').should == [:rescue, [:int, 1], [:resbody, [:array, [:lasgn, :a, [:gvar, :$!]]], [:int, 2]]]
24+
opal_parse('begin 1; rescue Klass => a; 2; end').should == [:rescue, [:int, 1], [:resbody, [:array, [:const, :Klass],[:lasgn, :a, [:gvar, :$!]]], [:int, 2]]]
2525
end
2626

2727
it "accepts an ivar to assign exception to" do
28-
opal_parse('begin 1; rescue => @a; 2; end').should == [:rescue, [:lit, 1], [:resbody, [:array, [:iasgn, :@a, [:gvar, :$!]]], [:lit, 2]]]
29-
opal_parse('begin 1; rescue Klass => @a; 2; end').should == [:rescue, [:lit, 1], [:resbody, [:array, [:const, :Klass],[:iasgn, :@a, [:gvar, :$!]]], [:lit, 2]]]
28+
opal_parse('begin 1; rescue => @a; 2; end').should == [:rescue, [:int, 1], [:resbody, [:array, [:iasgn, :@a, [:gvar, :$!]]], [:int, 2]]]
29+
opal_parse('begin 1; rescue Klass => @a; 2; end').should == [:rescue, [:int, 1], [:resbody, [:array, [:const, :Klass],[:iasgn, :@a, [:gvar, :$!]]], [:int, 2]]]
3030
end
3131

3232
it "should parse newline right after rescue" do
33-
opal_parse("begin; 1; rescue\n 2; end").should == [:rescue, [:lit, 1], [:resbody, [:array], [:lit, 2]]]
33+
opal_parse("begin; 1; rescue\n 2; end").should == [:rescue, [:int, 1], [:resbody, [:array], [:int, 2]]]
3434
end
3535
end
3636

3737
describe "with an 'ensure' block" do
3838
it "should propagate into single s(:ensure) statement when no rescue block given" do
39-
opal_parse('begin; 1; ensure; 2; end').should == [:ensure, [:lit, 1], [:lit, 2]]
39+
opal_parse('begin; 1; ensure; 2; end').should == [:ensure, [:int, 1], [:int, 2]]
4040
end
4141
end
4242
end

Diff for: ‎spec/parser/block_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
describe "Block statements" do
44
it "should return the direct expression if only one expresssion in block" do
5-
opal_parse("42").should == [:lit, 42]
5+
opal_parse("42").should == [:int, 42]
66
end
77

88
it "should return an s(:block) with all expressions appended for > 1 expression" do
9-
opal_parse("42; 43").should == [:block, [:lit, 42], [:lit, 43]]
10-
opal_parse("42; 43\n44").should == [:block, [:lit, 42], [:lit, 43], [:lit, 44]]
9+
opal_parse("42; 43").should == [:block, [:int, 42], [:int, 43]]
10+
opal_parse("42; 43\n44").should == [:block, [:int, 42], [:int, 43], [:int, 44]]
1111
end
1212
end

Diff for: ‎spec/parser/break_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
end
77

88
it "returns s(:break) with a single arg not wrapped in s(:array)" do
9-
opal_parse("break 1").should == [:break, [:lit, 1]]
10-
opal_parse("break *1").should == [:break, [:splat, [:lit, 1]]]
9+
opal_parse("break 1").should == [:break, [:int, 1]]
10+
opal_parse("break *1").should == [:break, [:splat, [:int, 1]]]
1111
end
1212

1313
it "returns s(:break) with an s(:array) for args size > 1" do
14-
opal_parse("break 1, 2").should == [:break, [:array, [:lit, 1], [:lit, 2]]]
15-
opal_parse("break 1, *2").should == [:break, [:array, [:lit, 1], [:splat, [:lit, 2]]]]
14+
opal_parse("break 1, 2").should == [:break, [:array, [:int, 1], [:int, 2]]]
15+
opal_parse("break 1, *2").should == [:break, [:array, [:int, 1], [:splat, [:int, 2]]]]
1616
end
1717
end

Diff for: ‎spec/parser/call_spec.rb

+37-37
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
end
1515

1616
it "appends all arguments onto arglist" do
17-
opal_parse("foo 1").should == [:call, nil, :foo, [:arglist, [:lit, 1]]]
18-
opal_parse("foo 1, 2").should == [:call, nil, :foo, [:arglist, [:lit, 1], [:lit, 2]]]
19-
opal_parse("foo 1, *2").should == [:call, nil, :foo, [:arglist, [:lit, 1], [:splat, [:lit, 2]]]]
17+
opal_parse("foo 1").should == [:call, nil, :foo, [:arglist, [:int, 1]]]
18+
opal_parse("foo 1, 2").should == [:call, nil, :foo, [:arglist, [:int, 1], [:int, 2]]]
19+
opal_parse("foo 1, *2").should == [:call, nil, :foo, [:arglist, [:int, 1], [:splat, [:int, 2]]]]
2020
end
2121

2222
it "supports leading dots on newline" do
@@ -27,80 +27,80 @@
2727

2828
describe "Operator calls" do
2929
it "should parse all other operators into method calls" do
30-
opal_parse("1 % 2").should == [:call, [:lit, 1], :%, [:arglist, [:lit, 2]]]
31-
opal_parse("1 ** 2").should == [:call, [:lit, 1], :**, [:arglist, [:lit, 2]]]
30+
opal_parse("1 % 2").should == [:call, [:int, 1], :%, [:arglist, [:int, 2]]]
31+
opal_parse("1 ** 2").should == [:call, [:int, 1], :**, [:arglist, [:int, 2]]]
3232

3333
opal_parse("+self").should == [:call, [:self], :+@, [:arglist]]
3434
opal_parse("-self").should == [:call, [:self], :-@, [:arglist]]
3535

36-
opal_parse("1 | 2").should == [:call, [:lit, 1], :|, [:arglist, [:lit, 2]]]
37-
opal_parse("1 ^ 2").should == [:call, [:lit, 1], :^, [:arglist, [:lit, 2]]]
38-
opal_parse("1 & 2").should == [:call, [:lit, 1], :&, [:arglist, [:lit, 2]]]
39-
opal_parse("1 <=> 2").should == [:call, [:lit, 1], :<=>, [:arglist, [:lit, 2]]]
36+
opal_parse("1 | 2").should == [:call, [:int, 1], :|, [:arglist, [:int, 2]]]
37+
opal_parse("1 ^ 2").should == [:call, [:int, 1], :^, [:arglist, [:int, 2]]]
38+
opal_parse("1 & 2").should == [:call, [:int, 1], :&, [:arglist, [:int, 2]]]
39+
opal_parse("1 <=> 2").should == [:call, [:int, 1], :<=>, [:arglist, [:int, 2]]]
4040

41-
opal_parse("1 < 2").should == [:call, [:lit, 1], :<, [:arglist, [:lit, 2]]]
42-
opal_parse("1 <= 2").should == [:call, [:lit, 1], :<=, [:arglist, [:lit, 2]]]
43-
opal_parse("1 > 2").should == [:call, [:lit, 1], :>, [:arglist, [:lit, 2]]]
44-
opal_parse("1 >= 2").should == [:call, [:lit, 1], :>=, [:arglist, [:lit, 2]]]
41+
opal_parse("1 < 2").should == [:call, [:int, 1], :<, [:arglist, [:int, 2]]]
42+
opal_parse("1 <= 2").should == [:call, [:int, 1], :<=, [:arglist, [:int, 2]]]
43+
opal_parse("1 > 2").should == [:call, [:int, 1], :>, [:arglist, [:int, 2]]]
44+
opal_parse("1 >= 2").should == [:call, [:int, 1], :>=, [:arglist, [:int, 2]]]
4545

46-
opal_parse("1 == 2").should == [:call, [:lit, 1], :==, [:arglist, [:lit, 2]]]
47-
opal_parse("1 === 2").should == [:call, [:lit, 1], :===, [:arglist, [:lit, 2]]]
48-
opal_parse("1 =~ 2").should == [:call, [:lit, 1], :=~, [:arglist, [:lit, 2]]]
46+
opal_parse("1 == 2").should == [:call, [:int, 1], :==, [:arglist, [:int, 2]]]
47+
opal_parse("1 === 2").should == [:call, [:int, 1], :===, [:arglist, [:int, 2]]]
48+
opal_parse("1 =~ 2").should == [:call, [:int, 1], :=~, [:arglist, [:int, 2]]]
4949

50-
opal_parse("~1").should == [:call, [:lit, 1], :~, [:arglist]]
51-
opal_parse("1 << 2").should == [:call, [:lit, 1], :<<, [:arglist, [:lit, 2]]]
52-
opal_parse("1 >> 2").should == [:call, [:lit, 1], :>>, [:arglist, [:lit, 2]]]
50+
opal_parse("~1").should == [:call, [:int, 1], :~, [:arglist]]
51+
opal_parse("1 << 2").should == [:call, [:int, 1], :<<, [:arglist, [:int, 2]]]
52+
opal_parse("1 >> 2").should == [:call, [:int, 1], :>>, [:arglist, [:int, 2]]]
5353
end
5454

5555
it "optimizes +@ and -@ on numerics" do
56-
opal_parse("+1").should == [:lit, 1]
57-
opal_parse("-1").should == [:lit, -1]
56+
opal_parse("+1").should == [:int, 1]
57+
opal_parse("-1").should == [:int, -1]
5858
end
5959
end
6060

6161
describe "Optional paren calls" do
6262
it "should correctly parse - and -@" do
63-
opal_parse("x - 1").should == [:call, [:call, nil, :x, [:arglist]], :-, [:arglist, [:lit, 1]]]
64-
opal_parse("x -1").should == [:call, nil, :x, [:arglist, [:lit, -1]]]
63+
opal_parse("x - 1").should == [:call, [:call, nil, :x, [:arglist]], :-, [:arglist, [:int, 1]]]
64+
opal_parse("x -1").should == [:call, nil, :x, [:arglist, [:int, -1]]]
6565
end
6666

6767
it "should correctly parse + and +@" do
68-
opal_parse("x + 1").should == [:call, [:call, nil, :x, [:arglist]], :+, [:arglist, [:lit, 1]]]
69-
opal_parse("x +1").should == [:call, nil, :x, [:arglist, [:lit, 1]]]
68+
opal_parse("x + 1").should == [:call, [:call, nil, :x, [:arglist]], :+, [:arglist, [:int, 1]]]
69+
opal_parse("x +1").should == [:call, nil, :x, [:arglist, [:int, 1]]]
7070
end
7171

7272
it "should correctly parse / and regexps" do
73-
opal_parse("x / 500").should == [:call, [:call, nil, :x, [:arglist]], :/, [:arglist, [:lit, 500]]]
74-
opal_parse("x /foo/").should == [:call, nil, :x, [:arglist, [:lit, /foo/]]]
73+
opal_parse("x / 500").should == [:call, [:call, nil, :x, [:arglist]], :/, [:arglist, [:int, 500]]]
74+
opal_parse("x /foo/").should == [:call, nil, :x, [:arglist, [:regexp, /foo/]]]
7575
end
7676

7777
it "should parse LPAREN_ARG correctly" do
78-
opal_parse("x (1).y").should == [:call, nil, :x, [:arglist, [:call, [:lit, 1], :y, [:arglist]]]]
79-
opal_parse("x(1).y").should == [:call, [:call, nil, :x, [:arglist, [:lit, 1]]], :y, [:arglist]]
78+
opal_parse("x (1).y").should == [:call, nil, :x, [:arglist, [:call, [:int, 1], :y, [:arglist]]]]
79+
opal_parse("x(1).y").should == [:call, [:call, nil, :x, [:arglist, [:int, 1]]], :y, [:arglist]]
8080
end
8181
end
8282

8383
describe "Operator precedence" do
8484
it "should be raised with parentheses" do
8585
opal_parse("(1 + 2) + (3 - 4)").should == [:call,
86-
[:call, [:lit, 1], :+, [:arglist, [:lit, 2]]],
86+
[:call, [:int, 1], :+, [:arglist, [:int, 2]]],
8787
:+,
88-
[:arglist, [:call, [:lit, 3], :-, [:arglist, [:lit, 4]]]],
88+
[:arglist, [:call, [:int, 3], :-, [:arglist, [:int, 4]]]],
8989
]
9090
opal_parse("(1 + 2) - (3 - 4)").should == [:call,
91-
[:call, [:lit, 1], :+, [:arglist, [:lit, 2]]],
91+
[:call, [:int, 1], :+, [:arglist, [:int, 2]]],
9292
:-,
93-
[:arglist, [:call, [:lit, 3], :-, [:arglist, [:lit, 4]]]],
93+
[:arglist, [:call, [:int, 3], :-, [:arglist, [:int, 4]]]],
9494
]
9595
opal_parse("(1 + 2) * (3 - 4)").should == [:call,
96-
[:call, [:lit, 1], :+, [:arglist, [:lit, 2]]],
96+
[:call, [:int, 1], :+, [:arglist, [:int, 2]]],
9797
:*,
98-
[:arglist, [:call, [:lit, 3], :-, [:arglist, [:lit, 4]]]],
98+
[:arglist, [:call, [:int, 3], :-, [:arglist, [:int, 4]]]],
9999
]
100100
opal_parse("(1 + 2) / (3 - 4)").should == [:call,
101-
[:call, [:lit, 1], :+, [:arglist, [:lit, 2]]],
101+
[:call, [:int, 1], :+, [:arglist, [:int, 2]]],
102102
:/,
103-
[:arglist, [:call, [:lit, 3], :-, [:arglist, [:lit, 4]]]],
103+
[:arglist, [:call, [:int, 3], :-, [:arglist, [:int, 4]]]],
104104
]
105105
end
106106
end

Diff for: ‎spec/parser/class_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
end
77

88
it "does not place single expressions into a s(:block)" do
9-
opal_parse('class A; 1; end').should == [:class, :A, nil, [:scope, [:lit, 1]]]
9+
opal_parse('class A; 1; end').should == [:class, :A, nil, [:scope, [:int, 1]]]
1010
end
1111

1212
it "adds multiple body expressions into a s(:block)" do
13-
opal_parse('class A; 1; 2; end').should == [:class, :A, nil, [:scope, [:block, [:lit, 1], [:lit, 2]]]]
13+
opal_parse('class A; 1; 2; end').should == [:class, :A, nil, [:scope, [:block, [:int, 1], [:int, 2]]]]
1414
end
1515

1616
it "uses nil as a placeholder when no superclass is given" do

Diff for: ‎spec/parser/const_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
end
88

99
it "should be returned as s(:cdecl) on assignment" do
10-
opal_parse("FOO = 1").should == [:cdecl, :FOO, [:lit, 1]]
10+
opal_parse("FOO = 1").should == [:cdecl, :FOO, [:int, 1]]
1111
opal_parse("FOO = BAR").should == [:cdecl, :FOO, [:const, :BAR]]
1212
end
1313
end

Diff for: ‎spec/parser/cvar_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
end
77

88
it "should always be converted to s(:cvdecl) on assignment" do
9-
opal_parse("@@foo = 100").should == [:cvdecl, :@@foo, [:lit, 100]]
9+
opal_parse("@@foo = 100").should == [:cvdecl, :@@foo, [:int, 100]]
1010
end
1111
end

Diff for: ‎spec/parser/def_spec.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131

3232
describe "with opt args" do
3333
it "should list all opt args as well as block with each lasgn" do
34-
opal_parse("def foo(a = 1); end")[2].should == [:args, :a, [:block, [:lasgn, :a, [:lit, 1]]]]
35-
opal_parse("def foo(a = 1, b = 2); end")[2].should == [:args, :a, :b, [:block, [:lasgn, :a, [:lit, 1]], [:lasgn, :b, [:lit, 2]]]]
34+
opal_parse("def foo(a = 1); end")[2].should == [:args, :a, [:block, [:lasgn, :a, [:int, 1]]]]
35+
opal_parse("def foo(a = 1, b = 2); end")[2].should == [:args, :a, :b, [:block, [:lasgn, :a, [:int, 1]], [:lasgn, :b, [:int, 2]]]]
3636
end
3737

3838
it "should list lasgn block after all other args" do
39-
opal_parse("def foo(a, b = 1); end")[2].should == [:args, :a, :b, [:block, [:lasgn, :b, [:lit, 1]]]]
40-
opal_parse("def foo(b = 1, *c); end")[2].should == [:args, :b, :"*c", [:block, [:lasgn, :b, [:lit, 1]]]]
41-
opal_parse("def foo(b = 1, &block); end")[2].should == [:args, :b, :"&block", [:block, [:lasgn, :b, [:lit, 1]]]]
39+
opal_parse("def foo(a, b = 1); end")[2].should == [:args, :a, :b, [:block, [:lasgn, :b, [:int, 1]]]]
40+
opal_parse("def foo(b = 1, *c); end")[2].should == [:args, :b, :"*c", [:block, [:lasgn, :b, [:int, 1]]]]
41+
opal_parse("def foo(b = 1, &block); end")[2].should == [:args, :b, :"&block", [:block, [:lasgn, :b, [:int, 1]]]]
4242
end
4343
end
4444

Diff for: ‎spec/parser/gvar_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
end
88

99
it "should return s(:gasgn) on assignment" do
10-
opal_parse("$foo = 1").should == [:gasgn, :$foo, [:lit, 1]]
11-
opal_parse("$: = 1").should == [:gasgn, :$:, [:lit, 1]]
10+
opal_parse("$foo = 1").should == [:gasgn, :$foo, [:int, 1]]
11+
opal_parse("$: = 1").should == [:gasgn, :$:, [:int, 1]]
1212
end
1313
end

Diff for: ‎spec/parser/hash_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
end
77

88
it "adds each assoc pair as individual args onto sexp" do
9-
opal_parse("{1 => 2}").should == [:hash, [:lit, 1], [:lit, 2]]
10-
opal_parse("{1 => 2, 3 => 4}").should == [:hash, [:lit, 1], [:lit, 2], [:lit, 3], [:lit, 4]]
9+
opal_parse("{1 => 2}").should == [:hash, [:int, 1], [:int, 2]]
10+
opal_parse("{1 => 2, 3 => 4}").should == [:hash, [:int, 1], [:int, 2], [:int, 3], [:int, 4]]
1111
end
1212

1313
it "supports 1.9 style hash keys" do
14-
opal_parse("{ a: 1 }").should == [:hash, [:lit, :a], [:lit, 1]]
15-
opal_parse("{ a: 1, b: 2 }").should == [:hash, [:lit, :a], [:lit, 1], [:lit, :b], [:lit, 2]]
14+
opal_parse("{ a: 1 }").should == [:hash, [:sym, :a], [:int, 1]]
15+
opal_parse("{ a: 1, b: 2 }").should == [:hash, [:sym, :a], [:int, 1], [:sym, :b], [:int, 2]]
1616
end
1717
end

Diff for: ‎spec/parser/iasgn_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
describe "Instance variable assignment" do
44
it "always returns an s(:iasgn)" do
5-
opal_parse("@a = 1").should == [:iasgn, :@a, [:lit, 1]]
6-
opal_parse("@A = 1").should == [:iasgn, :@A, [:lit, 1]]
7-
opal_parse("@class = 1").should == [:iasgn, :@class, [:lit, 1]]
5+
opal_parse("@a = 1").should == [:iasgn, :@a, [:int, 1]]
6+
opal_parse("@A = 1").should == [:iasgn, :@A, [:int, 1]]
7+
opal_parse("@class = 1").should == [:iasgn, :@class, [:int, 1]]
88
end
99
end

Diff for: ‎spec/parser/if_spec.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
describe "The if keyword" do
44
it "should return an s(:if) with given truthy and falsy bodies" do
5-
opal_parse("if 1; 2; else; 3; end").should == [:if, [:lit, 1], [:lit, 2], [:lit, 3]]
5+
opal_parse("if 1; 2; else; 3; end").should == [:if, [:int, 1], [:int, 2], [:int, 3]]
66
end
77

88
it "uses nil as fasly body if not given else-then" do
9-
opal_parse("if 1; 2; end").should == [:if, [:lit, 1], [:lit, 2], nil]
9+
opal_parse("if 1; 2; end").should == [:if, [:int, 1], [:int, 2], nil]
1010
end
1111

1212
it "is treats elsif parts as sub if expressions for else body" do
13-
opal_parse("if 1; 2; elsif 3; 4; else; 5; end").should == [:if, [:lit, 1], [:lit, 2], [:if, [:lit, 3], [:lit, 4], [:lit, 5]]]
14-
opal_parse("if 1; 2; elsif 3; 4; end").should == [:if, [:lit, 1], [:lit, 2], [:if, [:lit, 3], [:lit, 4], nil]]
13+
opal_parse("if 1; 2; elsif 3; 4; else; 5; end").should == [:if, [:int, 1], [:int, 2], [:if, [:int, 3], [:int, 4], [:int, 5]]]
14+
opal_parse("if 1; 2; elsif 3; 4; end").should == [:if, [:int, 1], [:int, 2], [:if, [:int, 3], [:int, 4], nil]]
1515
end
1616

1717
it "returns a simple s(:if) with nil else body for prefix if statement" do
18-
opal_parse("1 if 2").should == [:if, [:lit, 2], [:lit, 1], nil]
18+
opal_parse("1 if 2").should == [:if, [:int, 2], [:int, 1], nil]
1919
end
2020
end
2121

2222
describe "The ternary operator" do
2323
it "gets converted into an if statement with true and false parts" do
24-
opal_parse("1 ? 2 : 3").should == [:if, [:lit, 1], [:lit, 2], [:lit, 3]]
24+
opal_parse("1 ? 2 : 3").should == [:if, [:int, 1], [:int, 2], [:int, 3]]
2525
end
2626
end

Diff for: ‎spec/parser/iter_spec.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
describe "Iter on a command" do
55
it "the outer command call gets the iter" do
66
opal_parse("a b do; end").should == [:iter, [:call, nil, :a, [:arglist, [:call, nil, :b, [:arglist]]]], nil]
7-
opal_parse("a 1, b do; end").should == [:iter, [:call, nil, :a, [:arglist, [:lit, 1], [:call, nil, :b, [:arglist]]]], nil]
7+
opal_parse("a 1, b do; end").should == [:iter, [:call, nil, :a, [:arglist, [:int, 1], [:call, nil, :b, [:arglist]]]], nil]
88
end
99
end
1010

@@ -40,14 +40,14 @@
4040

4141
describe "with opt args" do
4242
it "adds a s(:block) arg to end of s(:masgn) for each lasgn" do
43-
opal_parse("proc do |a = 1|; end")[2].should == [:masgn, [:array, [:lasgn, :a], [:block, [:lasgn, :a, [:lit, 1]]]]]
44-
opal_parse("proc do |a = 1, b = 2|; end")[2].should == [:masgn, [:array, [:lasgn, :a], [:lasgn, :b], [:block, [:lasgn, :a, [:lit, 1]], [:lasgn, :b, [:lit, 2]]]]]
43+
opal_parse("proc do |a = 1|; end")[2].should == [:masgn, [:array, [:lasgn, :a], [:block, [:lasgn, :a, [:int, 1]]]]]
44+
opal_parse("proc do |a = 1, b = 2|; end")[2].should == [:masgn, [:array, [:lasgn, :a], [:lasgn, :b], [:block, [:lasgn, :a, [:int, 1]], [:lasgn, :b, [:int, 2]]]]]
4545
end
4646

4747
it "should add lasgn block after all other args" do
48-
opal_parse("proc do |a, b = 1|; end")[2].should == [:masgn, [:array, [:lasgn, :a], [:lasgn, :b], [:block, [:lasgn, :b, [:lit, 1]]]]]
49-
opal_parse("proc do |b = 1, *c|; end")[2].should == [:masgn, [:array, [:lasgn, :b], [:splat, [:lasgn, :c]], [:block, [:lasgn, :b, [:lit, 1]]]]]
50-
opal_parse("proc do |b = 1, &c|; end")[2].should == [:masgn, [:array, [:lasgn, :b], [:block_pass, [:lasgn, :c]], [:block, [:lasgn, :b, [:lit, 1]]]]]
48+
opal_parse("proc do |a, b = 1|; end")[2].should == [:masgn, [:array, [:lasgn, :a], [:lasgn, :b], [:block, [:lasgn, :b, [:int, 1]]]]]
49+
opal_parse("proc do |b = 1, *c|; end")[2].should == [:masgn, [:array, [:lasgn, :b], [:splat, [:lasgn, :c]], [:block, [:lasgn, :b, [:int, 1]]]]]
50+
opal_parse("proc do |b = 1, &c|; end")[2].should == [:masgn, [:array, [:lasgn, :b], [:block_pass, [:lasgn, :c]], [:block, [:lasgn, :b, [:int, 1]]]]]
5151
end
5252
end
5353

Diff for: ‎spec/parser/lambda_spec.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
end
4040

4141
it "parses opt args" do
42-
opal_parse("-> a = 1 {}")[2].should == [:masgn, [:array, [:lasgn, :a], [:block, [:lasgn, :a, [:lit, 1]]]]]
43-
opal_parse("-> a = 1, b = 2 {}")[2].should == [:masgn, [:array, [:lasgn, :a], [:lasgn, :b], [:block, [:lasgn, :a, [:lit, 1]], [:lasgn, :b, [:lit, 2]]]]]
42+
opal_parse("-> a = 1 {}")[2].should == [:masgn, [:array, [:lasgn, :a], [:block, [:lasgn, :a, [:int, 1]]]]]
43+
opal_parse("-> a = 1, b = 2 {}")[2].should == [:masgn, [:array, [:lasgn, :a], [:lasgn, :b], [:block, [:lasgn, :a, [:int, 1]], [:lasgn, :b, [:int, 2]]]]]
4444
end
4545

4646
it "parses block args" do
@@ -54,11 +54,11 @@
5454
end
5555

5656
it "should be the single sexp when given one statement" do
57-
opal_parse("-> { 42 }")[3].should == [:lit, 42]
57+
opal_parse("-> { 42 }")[3].should == [:int, 42]
5858
end
5959

6060
it "should wrap multiple statements into a s(:block)" do
61-
opal_parse("-> { 42; 3.142 }")[3].should == [:block, [:lit, 42], [:lit, 3.142]]
61+
opal_parse("-> { 42; 3.142 }")[3].should == [:block, [:int, 42], [:float, 3.142]]
6262
end
6363
end
64-
end
64+
end

Diff for: ‎spec/parser/lasgn_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
describe "Local assignment" do
44
it "returns an s(:lasgn)" do
5-
opal_parse("a = 1").should == [:lasgn, :a, [:lit, 1]]
6-
opal_parse("a = 1; b = 2").should == [:block, [:lasgn, :a, [:lit, 1]], [:lasgn, :b, [:lit, 2]]]
5+
opal_parse("a = 1").should == [:lasgn, :a, [:int, 1]]
6+
opal_parse("a = 1; b = 2").should == [:block, [:lasgn, :a, [:int, 1]], [:lasgn, :b, [:int, 2]]]
77
end
88
end

Diff for: ‎spec/parser/line_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
describe "The __LINE__ keyword" do
44
it "should always return a literal number of the current line" do
5-
opal_parse("__LINE__").should == [:lit, 1]
6-
opal_parse("\n__LINE__").should == [:lit, 2]
5+
opal_parse("__LINE__").should == [:int, 1]
6+
opal_parse("\n__LINE__").should == [:int, 2]
77
end
88
end

Diff for: ‎spec/parser/lvar_spec.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
describe "An lvar" do
44
describe "in any scope" do
55
it "should be created when an identifier is previously assigned to" do
6-
opal_parse("a = 1; a").should == [:block, [:lasgn, :a, [:lit, 1]], [:lvar, :a]]
7-
opal_parse("a = 1; a; a").should == [:block, [:lasgn, :a, [:lit, 1]], [:lvar, :a], [:lvar, :a]]
6+
opal_parse("a = 1; a").should == [:block, [:lasgn, :a, [:int, 1]], [:lvar, :a]]
7+
opal_parse("a = 1; a; a").should == [:block, [:lasgn, :a, [:int, 1]], [:lvar, :a], [:lvar, :a]]
88
end
99

1010
it "should not be created when no lasgn is previously used on name" do
1111
opal_parse("a").should == [:call, nil, :a, [:arglist]]
12-
opal_parse("a = 1; b").should == [:block, [:lasgn, :a, [:lit, 1]], [:call, nil, :b, [:arglist]]]
12+
opal_parse("a = 1; b").should == [:block, [:lasgn, :a, [:int, 1]], [:call, nil, :b, [:arglist]]]
1313
end
1414
end
1515

@@ -20,7 +20,7 @@
2020
end
2121

2222
it "should be created by an opt arg" do
23-
opal_parse("def a(b=10); b; end").should == [:defn, :a, [:args, :b, [:block, [:lasgn, :b, [:lit, 10]]]], [:scope, [:block, [:lvar, :b]]]]
23+
opal_parse("def a(b=10); b; end").should == [:defn, :a, [:args, :b, [:block, [:lasgn, :b, [:int, 10]]]], [:scope, [:block, [:lvar, :b]]]]
2424
end
2525

2626
it "should be created by a rest arg" do
@@ -32,7 +32,7 @@
3232
end
3333

3434
it "should not be created from locals outside the def" do
35-
opal_parse("a = 10; def b; a; end").should == [:block, [:lasgn, :a, [:lit, 10]], [:defn, :b, [:args], [:scope, [:block, [:call, nil, :a, [:arglist]]]]]]
35+
opal_parse("a = 10; def b; a; end").should == [:block, [:lasgn, :a, [:int, 10]], [:defn, :b, [:args], [:scope, [:block, [:call, nil, :a, [:arglist]]]]]]
3636
end
3737
end
3838
end

Diff for: ‎spec/parser/masgn_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
describe "with a single rhs argument" do
3333
it "should wrap rhs in an s(:to_ary)" do
34-
opal_parse('a, b = 1')[2].should == [:to_ary, [:lit, 1]]
34+
opal_parse('a, b = 1')[2].should == [:to_ary, [:int, 1]]
3535
end
3636
end
3737
end

Diff for: ‎spec/parser/module_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
end
77

88
it "does not place single expressions into a s(:block)" do
9-
opal_parse('module A; 1; end').should == [:module, :A, [:scope, [:lit, 1]]]
9+
opal_parse('module A; 1; end').should == [:module, :A, [:scope, [:int, 1]]]
1010
end
1111

1212
it "adds multiple body expressions into a s(:block)" do
13-
opal_parse('module A; 1; 2; end').should == [:module, :A, [:scope, [:block, [:lit, 1], [:lit, 2]]]]
13+
opal_parse('module A; 1; 2; end').should == [:module, :A, [:scope, [:block, [:int, 1], [:int, 2]]]]
1414
end
1515

1616
it "should accept just a constant for the module name" do

Diff for: ‎spec/parser/not_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@
33
describe "The not keyword" do
44
it "returns s(:not) with the single argument" do
55
opal_parse("not self").should == [:not, [:self]]
6-
opal_parse("not 42").should == [:not, [:lit, 42]]
6+
opal_parse("not 42").should == [:not, [:int, 42]]
77
end
88
end
99

1010
describe "The '!' expression" do
1111
it "returns s(:not) with the single argument" do
1212
opal_parse("!self").should == [:not, [:self]]
13-
opal_parse("!42").should == [:not, [:lit, 42]]
13+
opal_parse("!42").should == [:not, [:int, 42]]
1414
end
1515
end
1616

1717
describe "The '!=' expression" do
1818
it "rewrites as !(lhs == rhs)" do
19-
opal_parse("1 != 2").should == [:not, [:call, [:lit, 1], :==, [:arglist, [:lit, 2]]]]
19+
opal_parse("1 != 2").should == [:not, [:call, [:int, 1], :==, [:arglist, [:int, 2]]]]
2020
end
2121
end
2222

2323
describe "The '!~' expression" do
2424
it "rewrites as !(lhs =~ rhs)" do
25-
opal_parse("1 !~ 2").should == [:not, [:call, [:lit, 1], :=~, [:arglist, [:lit, 2]]]]
25+
opal_parse("1 !~ 2").should == [:not, [:call, [:int, 1], :=~, [:arglist, [:int, 2]]]]
2626
end
2727
end

Diff for: ‎spec/parser/op_asgn1_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
end
1111

1212
it "returns an arglist for args inside braces" do
13-
opal_parse("self[:foo] += 1")[2].should == [:arglist, [:lit, :foo]]
13+
opal_parse("self[:foo] += 1")[2].should == [:arglist, [:sym, :foo]]
1414
end
1515

1616
it "only uses the operator, not with '=' appended" do
1717
opal_parse("self[:foo] += 1")[3].should == :+
1818
end
1919

2020
it "uses a simple sexp, not an arglist" do
21-
opal_parse("self[:foo] += 1")[4].should == [:lit, 1]
21+
opal_parse("self[:foo] += 1")[4].should == [:int, 1]
2222
end
2323
end

Diff for: ‎spec/parser/op_asgn2_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
end
1919

2020
it "uses a simple sexp, not an arglist" do
21-
opal_parse("self.foo += 1")[4].should == [:lit, 1]
21+
opal_parse("self.foo += 1")[4].should == [:int, 1]
2222
end
23-
end
23+
end

Diff for: ‎spec/parser/or_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
describe "The or statement" do
44
it "should always return s(:or)" do
5-
opal_parse("1 or 2").should == [:or, [:lit, 1], [:lit, 2]]
5+
opal_parse("1 or 2").should == [:or, [:int, 1], [:int, 2]]
66
end
77
end
88

99
describe "The || expression" do
1010
it "should always return s(:or)" do
11-
opal_parse("1 || 2").should == [:or, [:lit, 1], [:lit, 2]]
11+
opal_parse("1 || 2").should == [:or, [:int, 1], [:int, 2]]
1212
end
1313
end

Diff for: ‎spec/parser/regexp_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
describe "Regexps" do
44
it "parses a regexp as a s(:lit)" do
5-
opal_parse("/lol/").should == [:lit, /lol/]
5+
opal_parse("/lol/").should == [:regexp, /lol/]
66
end
77

88
it "parses regexp options" do
9-
opal_parse("/lol/i").should == [:lit, /lol/i]
9+
opal_parse("/lol/i").should == [:regexp, /lol/i]
1010
end
1111

1212
it "can parse regexps using %r notation" do
13-
opal_parse('%r(foo)').should == [:lit, /foo/]
14-
opal_parse('%r(foo)i').should == [:lit, /foo/i]
13+
opal_parse('%r(foo)').should == [:regexp, /foo/]
14+
opal_parse('%r(foo)i').should == [:regexp, /foo/i]
1515
end
1616
end

Diff for: ‎spec/parser/return_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
end
77

88
it "returns s(:return) with the direct argument when given one argument" do
9-
opal_parse("return 1").should == [:return, [:lit, 1]]
10-
opal_parse("return *2").should == [:return, [:splat, [:lit, 2]]]
9+
opal_parse("return 1").should == [:return, [:int, 1]]
10+
opal_parse("return *2").should == [:return, [:splat, [:int, 2]]]
1111
end
1212

1313
it "returns s(:return) with an s(:array) when args size > 1" do
14-
opal_parse("return 1, 2").should == [:return, [:array, [:lit, 1], [:lit, 2]]]
15-
opal_parse("return 1, *2").should == [:return, [:array, [:lit, 1], [:splat, [:lit, 2]]]]
14+
opal_parse("return 1, 2").should == [:return, [:array, [:int, 1], [:int, 2]]]
15+
opal_parse("return 1, *2").should == [:return, [:array, [:int, 1], [:splat, [:int, 2]]]]
1616
end
1717
end

Diff for: ‎spec/parser/sclass_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
end
77

88
it "does not place single expressions into an s(:block)" do
9-
opal_parse('class << A; 1; end')[2].should == [:scope, [:lit, 1]]
9+
opal_parse('class << A; 1; end')[2].should == [:scope, [:int, 1]]
1010
end
1111

1212
it "adds multiple body expressions into a s(:block)" do
13-
opal_parse('class << A; 1; 2; end')[2].should == [:scope, [:block, [:lit, 1], [:lit, 2]]]
13+
opal_parse('class << A; 1; 2; end')[2].should == [:scope, [:block, [:int, 1], [:int, 2]]]
1414
end
1515

1616
pending "should accept any expressions for singleton part" do

Diff for: ‎spec/parser/super_spec.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
end
77

88
it "should return s(:super) for any arguments" do
9-
opal_parse("super 1").should == [:super, [:lit, 1]]
10-
opal_parse("super 1, 2").should == [:super, [:lit, 1], [:lit, 2]]
11-
opal_parse("super 1, *2").should == [:super, [:lit, 1], [:splat, [:lit, 2]]]
9+
opal_parse("super 1").should == [:super, [:int, 1]]
10+
opal_parse("super 1, 2").should == [:super, [:int, 1], [:int, 2]]
11+
opal_parse("super 1, *2").should == [:super, [:int, 1], [:splat, [:int, 2]]]
1212
end
1313

1414
it "should always return s(:super) when parans are used" do
1515
opal_parse("super()").should == [:super]
16-
opal_parse("super(1)").should == [:super, [:lit, 1]]
17-
opal_parse("super(1, 2)").should == [:super, [:lit, 1], [:lit, 2]]
18-
opal_parse("super(1, *2)").should == [:super, [:lit, 1], [:splat, [:lit, 2]]]
16+
opal_parse("super(1)").should == [:super, [:int, 1]]
17+
opal_parse("super(1, 2)").should == [:super, [:int, 1], [:int, 2]]
18+
opal_parse("super(1, *2)").should == [:super, [:int, 1], [:splat, [:int, 2]]]
1919
end
2020
end

Diff for: ‎spec/parser/undef_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
describe "The undef keyword" do
44
it "returns s(:undef) with the argument as an s(:lit)" do
5-
opal_parse("undef a").should == [:undef, [:lit, :a]]
5+
opal_parse("undef a").should == [:undef, [:sym, :a]]
66
end
77

88
it "appends multiple parts onto end of list" do
9-
opal_parse("undef a, b").should == [:undef, [:lit, :a], [:lit, :b]]
9+
opal_parse("undef a, b").should == [:undef, [:sym, :a], [:sym, :b]]
1010
end
1111

1212
it "can take symbols or fitems" do
13-
opal_parse("undef :foo").should == [:undef, [:lit, :foo]]
13+
opal_parse("undef :foo").should == [:undef, [:sym, :foo]]
1414
end
1515
end

Diff for: ‎spec/parser/unless_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
describe "The unless keyword" do
44
it "returns s(:if) with reversed true and false bodies" do
5-
opal_parse("unless 10; 20; end").should == [:if, [:lit, 10], nil, [:lit, 20]]
6-
opal_parse("unless 10; 20; 30; end").should == [:if, [:lit, 10], nil, [:block, [:lit, 20], [:lit, 30]]]
7-
opal_parse("unless 10; 20; else; 30; end").should == [:if, [:lit, 10], [:lit, 30], [:lit, 20]]
5+
opal_parse("unless 10; 20; end").should == [:if, [:int, 10], nil, [:int, 20]]
6+
opal_parse("unless 10; 20; 30; end").should == [:if, [:int, 10], nil, [:block, [:int, 20], [:int, 30]]]
7+
opal_parse("unless 10; 20; else; 30; end").should == [:if, [:int, 10], [:int, 30], [:int, 20]]
88
end
99

1010
it "returns s(:if) with reversed true and false bodies for prefix unless" do
11-
opal_parse("20 unless 10").should == [:if, [:lit, 10], nil, [:lit, 20]]
11+
opal_parse("20 unless 10").should == [:if, [:int, 10], nil, [:int, 20]]
1212
end
1313
end

Diff for: ‎spec/parser/while_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
describe "The while keyword" do
44
it "returns an s(:while) with the given expr, body and true for head" do
5-
opal_parse("while 1; 2; end").should == [:while, [:lit, 1], [:lit, 2], true]
5+
opal_parse("while 1; 2; end").should == [:while, [:int, 1], [:int, 2], true]
66
end
77

88
it "uses an s(:block) if body has more than one statement" do
9-
opal_parse("while 1; 2; 3; end").should == [:while, [:lit, 1], [:block, [:lit, 2], [:lit, 3]], true]
9+
opal_parse("while 1; 2; 3; end").should == [:while, [:int, 1], [:block, [:int, 2], [:int, 3]], true]
1010
end
1111

1212
it "treats the prefix while statement just like a regular while statement" do
13-
opal_parse("1 while 2").should == [:while, [:lit, 2], [:lit, 1], true]
13+
opal_parse("1 while 2").should == [:while, [:int, 2], [:int, 1], true]
1414
end
1515
end

Diff for: ‎spec/parser/yield_spec.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
end
77

88
it "appends arguments onto end of s(:yield) without an arglist" do
9-
opal_parse("yield 1").should == [:yield, [:lit, 1]]
10-
opal_parse("yield 1, 2").should == [:yield, [:lit, 1], [:lit, 2]]
11-
opal_parse("yield 1, *2").should == [:yield, [:lit, 1], [:splat, [:lit, 2]]]
9+
opal_parse("yield 1").should == [:yield, [:int, 1]]
10+
opal_parse("yield 1, 2").should == [:yield, [:int, 1], [:int, 2]]
11+
opal_parse("yield 1, *2").should == [:yield, [:int, 1], [:splat, [:int, 2]]]
1212
end
1313

1414
it "accepts parans for any number of arguments" do
1515
opal_parse("yield()").should == [:yield]
16-
opal_parse("yield(1)").should == [:yield, [:lit, 1]]
17-
opal_parse("yield(1, 2)").should == [:yield, [:lit, 1], [:lit, 2]]
18-
opal_parse("yield(1, *2)").should == [:yield, [:lit, 1], [:splat, [:lit, 2]]]
16+
opal_parse("yield(1)").should == [:yield, [:int, 1]]
17+
opal_parse("yield(1, 2)").should == [:yield, [:int, 1], [:int, 2]]
18+
opal_parse("yield(1, *2)").should == [:yield, [:int, 1], [:splat, [:int, 2]]]
1919
end
2020
end

0 commit comments

Comments
 (0)
Please sign in to comment.