Merge pull request #3300 from gzzhanghao/gen-fix
Fix generators with default args
This commit is contained in:
commit
6bb7eb0c78
@ -0,0 +1,8 @@
|
|||||||
|
class Test {
|
||||||
|
*iter(arg = this) {
|
||||||
|
yield arg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let test = new Test;
|
||||||
|
assert.equal(test.iter().next().value, test);
|
||||||
5
packages/babel-plugin-transform-regenerator/test/fixtures/class-argument-scope/options.json
vendored
Normal file
5
packages/babel-plugin-transform-regenerator/test/fixtures/class-argument-scope/options.json
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
"es2015"
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -105,6 +105,9 @@ export default class TraversalContext {
|
|||||||
path.resync();
|
path.resync();
|
||||||
path.pushContext(this);
|
path.pushContext(this);
|
||||||
|
|
||||||
|
// this path no longer belongs to the tree
|
||||||
|
if (path.key === null) continue;
|
||||||
|
|
||||||
if (testing && queue.length >= 1000) {
|
if (testing && queue.length >= 1000) {
|
||||||
this.trap = true;
|
this.trap = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user