BYVoid / continuation

JavaScript asynchronous Continuation-Passing Style transformation (deprecated).
Other
388 stars 42 forks source link

cont() and obtain() do not work when instantiating a class #23

Open skerit opened 10 years ago

skerit commented 10 years ago

The code in this function:

function t() {
    var csvPath = '/tmp/contacts.csv';
        parser  = new ContactDocParser(csvPath, cont());
}

gets compiled to

function t() {
    var csvPath = '/tmp/contacts.csv';
        parser  = new ContactDocParser(csvPath, cont());
}
/* Generated by Continuation.js v0.1.4 */

It just ignores it. When I remove the new statement, it does replace the cont()

BYVoid commented 10 years ago

Sorry but I do not think this makes sense because it is seldom seen that a callback function is pass to a constructor of object in JavaScript. Could you tell me why this syntax is needed?

Thank you