mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Merge branch 'issue1011' of http://github.com/michaelficarra/coffee-script
This commit is contained in:
commit
47e4f4dae1
3 changed files with 11 additions and 1 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue