regenerator-transform
Advanced tools
Comparing version 0.9.6 to 0.9.7
@@ -73,4 +73,11 @@ "use strict"; | ||
var node = childPath.node; | ||
if (node && node._blockHoist != null) { | ||
if (t.isExpressionStatement(node) && t.isStringLiteral(node.expression)) { | ||
// Babylon represents directives like "use strict" as elements | ||
// of a bodyBlockPath.node.directives array, but they could just | ||
// as easily be represented (by other parsers) as traditional | ||
// string-literal-valued expression statements, so we need to | ||
// handle that here. (#248) | ||
outerBody.push(node); | ||
} else if (node && node._blockHoist != null) { | ||
outerBody.push(node); | ||
} else { | ||
@@ -127,2 +134,9 @@ innerBody.push(node); | ||
var oldDirectives = bodyBlockPath.node.directives; | ||
if (oldDirectives) { | ||
// Babylon represents directives like "use strict" as elements of | ||
// a bodyBlockPath.node.directives array. (#248) | ||
node.body.directives = oldDirectives; | ||
} | ||
var wasGeneratorFunction = node.generator; | ||
@@ -129,0 +143,0 @@ if (wasGeneratorFunction) { |
@@ -5,3 +5,3 @@ { | ||
"description": "Explode async and generator functions into a state machine.", | ||
"version": "0.9.6", | ||
"version": "0.9.7", | ||
"main": "lib/index.js", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
@@ -59,4 +59,12 @@ /** | ||
let node = childPath.node; | ||
if (node && node._blockHoist != null) { | ||
if (t.isExpressionStatement(node) && | ||
t.isStringLiteral(node.expression)) { | ||
// Babylon represents directives like "use strict" as elements | ||
// of a bodyBlockPath.node.directives array, but they could just | ||
// as easily be represented (by other parsers) as traditional | ||
// string-literal-valued expression statements, so we need to | ||
// handle that here. (#248) | ||
outerBody.push(node); | ||
} else if (node && node._blockHoist != null) { | ||
outerBody.push(node); | ||
} else { | ||
@@ -121,2 +129,9 @@ innerBody.push(node); | ||
const oldDirectives = bodyBlockPath.node.directives; | ||
if (oldDirectives) { | ||
// Babylon represents directives like "use strict" as elements of | ||
// a bodyBlockPath.node.directives array. (#248) | ||
node.body.directives = oldDirectives; | ||
} | ||
let wasGeneratorFunction = node.generator; | ||
@@ -123,0 +138,0 @@ if (wasGeneratorFunction) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113361
2973