mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-17 02:51:25 -05:00
Function soaks should preserve this. Fixes issue #692.
This commit is contained in:
@@ -124,13 +124,17 @@ duration = if options?.animated then 150 else 0
|
||||
ok duration is 0
|
||||
|
||||
|
||||
# function soak
|
||||
# Function soaks.
|
||||
plus1 = (x) -> x + 1
|
||||
obj = {
|
||||
returnThis: -> this
|
||||
}
|
||||
|
||||
ok plus1?(41) is 42
|
||||
ok (plus1? 41) is 42
|
||||
ok plus2?(41) is undefined
|
||||
ok (plus2? 41) is undefined
|
||||
ok obj.returnThis?() is obj
|
||||
|
||||
maybe_close = (f, arg) -> if typeof f is 'function' then () -> f(arg) else -1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user