Allow for-of on polyfilled or builtin iterables without Symbol support (#11285)
This commit is contained in:
18
packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/arguments-symbol-unsupported.js
vendored
Normal file
18
packages/babel-plugin-transform-for-of/test/fixtures/loose-exec/arguments-symbol-unsupported.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
function getArgs() { return arguments; }
|
||||
|
||||
let args = getArgs(1, 2, 3);
|
||||
let res = [];
|
||||
|
||||
// Simulate old environment
|
||||
delete args[Symbol.iterator];
|
||||
let _Symbol = Symbol;
|
||||
Symbol = void 0;
|
||||
|
||||
try {
|
||||
for (let i of args) res.push(i);
|
||||
|
||||
expect(res).toEqual([1, 2, 3]);
|
||||
} finally {
|
||||
Symbol = _Symbol;
|
||||
}
|
||||
|
||||
18
packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/arguments-symbol-unsupported.js
vendored
Normal file
18
packages/babel-plugin-transform-for-of/test/fixtures/spec-exec/arguments-symbol-unsupported.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
function getArgs() { return arguments; }
|
||||
|
||||
let args = getArgs(1, 2, 3);
|
||||
let res = [];
|
||||
|
||||
// Simulate old environment
|
||||
delete args[Symbol.iterator];
|
||||
let _Symbol = Symbol;
|
||||
Symbol = void 0;
|
||||
|
||||
try {
|
||||
for (let i of args) res.push(i);
|
||||
|
||||
expect(res).toEqual([1, 2, 3]);
|
||||
} finally {
|
||||
Symbol = _Symbol;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user