Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed a bug in which we were overeager in the CPS rotations.

  • Loading branch information...
commit 07e0a35b62c2d583d785b3288c44d73b30943d52 1 parent b12f2f6
Maxwell Krohn authored
Showing with 8 additions and 8 deletions.
  1. +3 −2 lib/coffee-script/nodes.js
  2. +5 −6 src/nodes.coffee
5 lib/coffee-script/nodes.js
View
@@ -218,7 +218,7 @@
Base.prototype.walkAstCps = function(flood) {
var child, _i, _len, _ref2;
- if (this.isLoop()) flood = true;
+ if (this.isLoop() && this.tameNodeFlag) flood = true;
if (this.isAwait()) flood = false;
this.cpsNodeFlag = flood;
_ref2 = this.flattenChildren();
@@ -501,6 +501,7 @@
Block.prototype.tameTransform = function() {
this.walkAstTame();
+ this.walkAstCps(false);
return this.cpsRotate();
};
@@ -1690,7 +1691,7 @@
};
Code.prototype.walkAstCps = function(flood) {
- this.cpsNodeFlag = Code.__super__.walkAstCps.call(this, false);
+ if (Code.__super__.walkAstCps.call(this, false)) this.cpsNodeFlag = true;
return false;
};
11 src/nodes.coffee
View
@@ -179,9 +179,8 @@ exports.Base = class Base
@tameNodeFlag
walkAstCps : (flood) ->
- flood = true if @isLoop()
- if @isAwait()
- flood = false
+ flood = true if @isLoop() and @tameNodeFlag
+ flood = false if @isAwait()
@cpsNodeFlag = flood
for child in @flattenChildren()
@cpsNodeFlag = true if child.walkAstCps(flood)
@@ -436,7 +435,7 @@ exports.Block = class Block extends Base
# Perform all steps of the Tame transform
tameTransform : ->
@walkAstTame()
- #@walkAstCps(false)
+ @walkAstCps(false)
@cpsRotate()
#### Literal
@@ -1371,8 +1370,8 @@ exports.Code = class Code extends Base
@tameNodeFlag = true if super()
false
- walkAstCps : (flood) ->
- @cpsNodeFlag = super(false)
+ walkAstCps : (flood) ->
+ @cpsNodeFlag = true if super(false)
false
#### Param
Please sign in to comment.
Something went wrong with that request. Please try again.