1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00
This commit is contained in:
Jeremy Ashkenas 2011-01-10 23:25:28 -05:00
commit 47e4f4dae1
3 changed files with 11 additions and 1 deletions

View file

@ -668,6 +668,9 @@
fun = "(" + ref + " = " + (base.compile(o, LEVEL_LIST)) + ")" + (name.compile(o));
} else {
fun = base.compile(o, LEVEL_ACCESS);
if (SIMPLENUM.test(fun)) {
fun = "(" + fun + ")";
}
if (name) {
ref = fun;
fun += name.compile(o);

View file

@ -529,6 +529,7 @@ exports.Call = class Call extends Base
fun = "(#{ref} = #{ base.compile o, LEVEL_LIST })#{ name.compile o }"
else
fun = base.compile o, LEVEL_ACCESS
fun = "(#{fun})" if SIMPLENUM.test fun
if name
ref = fun
fun += name.compile o

View file

@ -298,7 +298,7 @@ ok pen is 2
method 1, 2
ok pen is 2
# Finally, splats with super() within classes.
# splats with super() within classes.
class Parent
meth: (args...) ->
args
@ -308,6 +308,12 @@ class Child extends Parent
super nums...
ok (new Child).meth().join(' ') is '3 2 1'
test "#1011: passing a splat to a method of a number", ->
eq '1011', 11.toString [2]...
eq '1011', (31).toString [3]...
eq '1011', 69.0.toString [4]...
eq '1011', (131.0).toString [5]...
#### Implicit Return