You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 405fdcb
Browse filesBrowse the repository at this point in the historyBrowse files
Babel preset: Remove regenerator from Hermes dev builds
Hermes profiles have lowered generators (with `enableBabelRuntime: false`), `for...of`, `?.`, `??` and optional catch binding in dev builds only since #52651, because Hermes couldn't show local variables when paused on a breakpoint in a native generator.
That was a Hermes bug: the generator's resume prologue was stamped with the source location of its last `yield`, so a breakpoint on that line resolved to scope-less entry code. It's fixed in facebook/hermes@d1238c8c6 (hermes-v260318099.0.2), which main has used since #58397.
This removes `enableRegenerator`, so Hermes-profile dev output matches release. It also fixes a dev/release divergence - loose `for-of` never calls `iterator.return()`, so breaking out of a `for...of` over a generator skipped its `finally` in dev only.
Changelog: [General][Changed] - Babel preset: Hermes profiles no longer lower generators, `for...of`, optional chaining, nullish coalescing or optional catch binding in dev, matching release
function_createForOfIteratorHelperLoose(r,e){vart="undefined"!=typeofSymbol&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeofr.length){t&&(r=t);varo=0;returnfunction(){returno>=r.length ? {done: !0} : {done: !1,value: r[o++]};};}thrownewTypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}
function_createForOfIteratorHelperLoose(r,e){vart="undefined"!=typeofSymbol&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeofr.length){t&&(r=t);varo=0;returnfunction(){returno>=r.length ? {done: !0} : {done: !1,value: r[o++]};};}thrownewTypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}
Copy file name to clipboardExpand all lines: packages/react-native-babel-preset/src/__tests__/__fixtures__/output/hermes-stable-dev-preserve-block-scoping.js
+5-10Lines changed: 5 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -53,9 +53,6 @@ var _dataUtils = require("./data-utils");
function_createForOfIteratorHelperLoose(r,e){vart="undefined"!=typeofSymbol&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=_unsupportedIterableToArray(r))||e&&r&&"number"==typeofr.length){t&&(r=t);varo=0;returnfunction(){returno>=r.length ? {done: !0} : {done: !1,value: r[o++]};};}thrownewTypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}
0 commit comments