Skip to content

Commit b28cba7

Browse files
committed
Refining delegation
1 parent 48b925a commit b28cba7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/BabelPlugin.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ function Plugin(babel) {
124124
);
125125
}
126126
// Instruction Token: Yield with argument
127-
function hzYieldArg(argExp, delegate) {
127+
function hzYieldArg(argExp, delegate = false) {
128128
const callExp = hzYield();
129129
callExp.callee.property.name = "yieldValue";
130130
callExp.arguments[0].properties[0].value = argExp;
131-
callExp.arguments[1] = delegate;
131+
callExp.arguments[1] = t.BooleanLiteral(delegate);
132132
return callExp;
133133
}
134134
// Instruction Token: Spawn without arguments
@@ -503,6 +503,7 @@ function Plugin(babel) {
503503
exit: function (path) {
504504
if (path.node.argument === null) path.node.argument = hzYield();
505505
else path.node.argument = hzYieldArg(path.node.argument, path.node.delegate);
506+
if (path.node.delegate) path.node.delegate = false;
506507
}
507508
}
508509
};

0 commit comments

Comments
 (0)