BYVoid / continuation

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

using 'continue' in for (... in ...) #24

Closed notcome closed 9 years ago

notcome commented 10 years ago
var console = require('console');

function async (ret) {
  ret(null, [1, 2, 3, 4, 5, 6]);
}

try {
  async(obtain(a));
  for (var i in a)
    if (i % 2 == 0) continue;
    else console.log(a[i]);
} catch (err) {
  console.log(err);
}

The iterator doesn't go forward with continue.

curimit commented 9 years ago

for (var a = 1; a < 10; a++) also fails.

async(cont());
for (var a = 1; a < 10; a++) {
 if (true) continue;
}

Compiled result:

var a;
async(function (arguments) {
  a = 1;
  while (a < 10) {
    if (true) {
      continue;
    }
    a++;
  }
}.bind(this, arguments));
/* Generated by Continuation.js v0.1.5 */
curimit commented 9 years ago

Fixed: 3e58506