Skip to content

Commit

Permalink
issue #254 - esprima generators transform is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
bjouhier committed Mar 6, 2015
1 parent 583eca0 commit 9822e63
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 201 deletions.
6 changes: 3 additions & 3 deletions lib/fibers/transform-esprima.js
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,9 @@ function transform(source, options) {
catchup(expr.range[1]);
buffer.add("," + idx + ")(");
// process arguments to avoid 'invalid usage of callback' error
skipTo(args[0].range[0]);
for (var ii = 0; ii < args.length; ++ii) {
catchup(args[ii].range[0]);
skipTo(args[ii].range[0]);
if (ii > 0) buffer.add(', ');
if (ii !== idx) {
walk(args[ii]);
catchup(args[ii].range[1]);
Expand Down Expand Up @@ -593,7 +593,7 @@ function transform(source, options) {
if (operator === '!' || operator === 'void') {
if (argument.type === 'Identifier' && argument.name === callback) {
catchup(this.range[0]);
buffer.add(this.operator === '!' ? 'false' : 'null');
buffer.add(operator === '!' ? 'false' : 'null');
skipTo(this.range[1]);
} else {
walk(argument);
Expand Down
4 changes: 2 additions & 2 deletions lib/fibers/walker-esprima.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ function Walker(visitors) {

case 'ForStatement':
if (visitors[type]) {
visitors[type].call(node, node.setup, node.test, node.update, node.body);
visitors[type].call(node, node.init, node.test, node.update, node.body);
} else {
node.setup && walk(node.setup);
node.init && walk(node.init);
node.test && walk(node.test);
node.update && walk(node.update);
walk(node.body);
Expand Down
Loading

0 comments on commit 9822e63

Please sign in to comment.