BYVoid / continuation

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

The compiler allow non-lvars as argument to cont() etc. #20

Closed reynir closed 2 years ago

reynir commented 11 years ago

In other words, the compiler does not check whether the arguments to cont() etc. are assignable. Here is an example:

// Source
async(stuff, cont(err, result+4));
bar(result+1);

// Output
var err;
async(stuff, function () {
  err = arguments[0];
  (result + 4) = arguments[1];
  bar(result + 1);
});
/* Generated by Continuation.js v0.1.3 */

This is always an error. You cannot assign to (result + 4). Actually, you can also write 4 instead result + 4 and you will get 4 = arguments[1];!