Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add for-of fallback for arrays in browsers without symbol supp… (#11263)
* Add for-of fallback for arrays in browsers without symbol support * Update after rebase * Re-throw error when iterating array * Update fixture
- Loading branch information
1 parent
d60802b
commit 6f93297
Showing
3 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...s/babel-plugin-transform-for-of/test/fixtures/spec-exec/array-symbol-unsupported-throw.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
var a = (() => [1, 2, 3])(); | ||
|
||
// Simulate old environment | ||
let _Symbol = Symbol; | ||
Symbol = void 0; | ||
try { | ||
let didErr = false, err; | ||
let obj = {}; | ||
|
||
try { | ||
for (let i of a) { | ||
if (i === 2) throw obj; | ||
} | ||
} catch (e) { | ||
didErr = true; | ||
err = e; | ||
} | ||
|
||
expect(didErr).toBe(true); | ||
expect(obj).toBe(err); | ||
} finally { | ||
Symbol = _Symbol; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters