maxtaco / coffee-script

IcedCoffeeScript
http://maxtaco.github.com/coffee-script
MIT License
726 stars 58 forks source link

Await doesn't work with super #37

Closed jiaaro closed 11 years ago

jiaaro commented 12 years ago

the following code bombs:

class A      
  get_number: (cb) ->
    # do ajax
    cb 10

class B extends A
  get_number: (cb) ->
    await super defer number
    cb number + 1

new B().get_number alert

Though it should function identically to this

class A      
  get_number: (cb) ->
    # do ajax
    cb 10

class B extends A
  get_number: (cb) ->
    super (number) ->
      cb number + 1

new B().get_number alert
maxtaco commented 12 years ago

Hmm, this might be fixed in 1.3.3c (though it's not working on the brochure site). Which version are you running? For me, it works fine in node.js

class A
  get_number: (cb) ->
    # do ajax
    cb 10

class B extends A
  get_number: (cb) ->
    await super defer number
    cb number + 1

new B().get_number console.log

does the right thing, on 1.3.3c.....

jiaaro commented 12 years ago

I'm using the browser version (it's embedded in a web view in a phonegap-esque app) -- turns out it's 1.3.1

I'll upgrade and check in again

jiaaro commented 12 years ago

You're right it's resolved in 1.3.3

doublerebel commented 11 years ago

LGTM, I have used this pattern with V8 in Titanium Mobile. Can this issue be closed?