maxtaco / tamejs

JavaScript code rewriter for taming async-callback-style code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Return bug

sixcircuit opened this issue · comments

I'm running version 0.3.6. Thanks for fixing the return statement in 0.3.5. i.e. return next(new Error()), but I ran into this error for a pretty standard use case:

function async(callback){
    callback();
}

(function(){

    await{ async(defer()); }

    if(true){
        return console.log("this should happen");
    }else{
        return console.log("but this shouldn't");
    }

})();

(function(){

    await{ async(defer()); }

    if(true){
        console.log('fix?');
        return console.log("this should happen");
    }else{
        console.log('fix?');
        return console.log("but this shouldn't");
    }

})();

Oy, brain malfunction on my part. Thanks for pointing it out, fixed in head and v0.3.7 in npm.