Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: facebook/regenerator
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: regenerator-runtime@0.13.11
Choose a base ref
...
head repository: facebook/regenerator
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: regenerator-runtime@0.14.0
Choose a head ref
  • 20 commits
  • 9 files changed
  • 4 contributors

Commits on Nov 14, 2022

  1. Verified

    This commit was signed with the committer’s verified signature.
    dimkl Dimitris Klouvas
    Copy the full SHA
    7c5d362 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    dc481f9 View commit details
  3. Copy the full SHA
    b65710f View commit details
  4. Copy the full SHA
    26b6fe4 View commit details

Commits on Nov 15, 2022

  1. Verified

    This commit was signed with the committer’s verified signature.
    dimkl Dimitris Klouvas
    Copy the full SHA
    4e93ba8 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c24b7b7 View commit details

Commits on Jul 20, 2023

  1. Copy the full SHA
    7b52c8c View commit details

Commits on Aug 4, 2023

  1. Verified

    This commit was signed with the committer’s verified signature.
    dimkl Dimitris Klouvas
    Copy the full SHA
    82331fb View commit details
  2. Merge pull request #680 from nicolo-ribaudo/no-neg-1-numericliteral

    Do not use `-1` to mark uninitialized location numeric literals
    benjamn authored Aug 4, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    01365c4 View commit details
  3. Copy the full SHA
    245f72b View commit details
  4. Copy the full SHA
    a0e61c6 View commit details
  5. Copy the full SHA
    b2bf94e View commit details
  6. Copy the full SHA
    b278ff3 View commit details
  7. Verified

    This commit was signed with the committer’s verified signature.
    dimkl Dimitris Klouvas
    Copy the full SHA
    59f1601 View commit details
  8. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c467f23 View commit details
  9. Copy the full SHA
    bad2990 View commit details
  10. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ffd1de9 View commit details
  11. Verified

    This commit was signed with the committer’s verified signature.
    dimkl Dimitris Klouvas
    Copy the full SHA
    b3bf1a9 View commit details
  12. Verified

    This commit was signed with the committer’s verified signature.
    dimkl Dimitris Klouvas
    Copy the full SHA
    d3bac38 View commit details
  13. Bump regenerator-runtime version to 0.14.0.

    The minor version bump is due to the new ability of `yield*` to throw
    when given a non-iterable argument, introduced by PR #636.
    benjamn committed Aug 4, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    30771b7 View commit details
Showing with 2,950 additions and 5,205 deletions.
  1. +1 −1 .github/workflows/node.js.yml
  2. +2,909 −5,190 package-lock.json
  3. +4 −4 package.json
  4. +1 −1 packages/preset/package.json
  5. +1 −1 packages/runtime/package.json
  6. +2 −3 packages/runtime/runtime.js
  7. +1 −1 packages/transform/package.json
  8. +9 −4 packages/transform/src/emit.js
  9. +22 −0 test/tests.es6.js
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 18.x]
node-version: [12.x, 14.x, 16.x, 18.x, 20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
8,099 changes: 2,909 additions & 5,190 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
"desugaring",
"ES6"
],
"version": "0.14.9",
"version": "0.14.10",
"homepage": "http://github.com/facebook/regenerator",
"repository": {
"type": "git",
@@ -34,9 +34,9 @@
"commoner": "^0.10.8",
"private": "^0.1.8",
"recast": "^0.21.5",
"regenerator-preset": "^0.14.0",
"regenerator-runtime": "^0.13.10",
"regenerator-transform": "^0.15.0",
"regenerator-preset": "^0.14.1",
"regenerator-runtime": "^0.13.11",
"regenerator-transform": "^0.15.2",
"through": "^2.3.8"
},
"devDependencies": {
2 changes: 1 addition & 1 deletion packages/preset/package.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"name": "regenerator-preset",
"author": "Ben Newman <bn@cs.stanford.edu>",
"description": "Babel preset for easy use of regenerator-transform.",
"version": "0.14.0",
"version": "0.14.1",
"main": "index.js",
"keywords": [
"regenerator",
2 changes: 1 addition & 1 deletion packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"name": "regenerator-runtime",
"author": "Ben Newman <bn@cs.stanford.edu>",
"description": "Runtime for Regenerator-compiled generator and async functions.",
"version": "0.13.11",
"version": "0.14.0",
"main": "runtime.js",
"keywords": [
"regenerator",
5 changes: 2 additions & 3 deletions packages/runtime/runtime.js
Original file line number Diff line number Diff line change
@@ -487,7 +487,7 @@ var runtime = (function (exports) {
};

function values(iterable) {
if (iterable) {
if (iterable || iterable === "") {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) {
return iteratorMethod.call(iterable);
@@ -517,8 +517,7 @@ var runtime = (function (exports) {
}
}

// Return an iterator with no values.
return { next: doneResult };
throw new TypeError(typeof iterable + " is not iterable");
}
exports.values = values;

2 changes: 1 addition & 1 deletion packages/transform/package.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
"name": "regenerator-transform",
"author": "Ben Newman <bn@cs.stanford.edu>",
"description": "Explode async and generator functions into a state machine.",
"version": "0.15.0",
"version": "0.15.2",
"main": "lib/index.js",
"keywords": [
"regenerator",
13 changes: 9 additions & 4 deletions packages/transform/src/emit.js
Original file line number Diff line number Diff line change
@@ -57,8 +57,13 @@ exports.Emitter = Emitter;
// the amazingly convenient benefit of allowing the exact value of the
// location to be determined at any time, even after generating code that
// refers to the location.
// We use 'Number.MAX_VALUE' to mark uninitialized location. We can safely do
// so because no code can realistically have about 1.8e+308 locations before
// hitting memory limit of the machine it's running on. For comparison, the
// estimated number of atoms in the observable universe is around 1e+80.
const PENDING_LOCATION = Number.MAX_VALUE;
Ep.loc = function() {
const l = util.getTypes().numericLiteral(-1)
const l = util.getTypes().numericLiteral(PENDING_LOCATION)
this.insertedLocs.add(l);
return l;
}
@@ -76,7 +81,7 @@ Ep.getContextId = function() {
Ep.mark = function(loc) {
util.getTypes().assertLiteral(loc);
let index = this.listing.length;
if (loc.value === -1) {
if (loc.value === PENDING_LOCATION) {
loc.value = index;
} else {
// Locations can be marked redundantly, but their values cannot change
@@ -644,7 +649,7 @@ Ep.explodeStatement = function(path, labelId) {
);

self.mark(after);
if (defaultLoc.value === -1) {
if (defaultLoc.value === PENDING_LOCATION) {
self.mark(defaultLoc);
assert.strictEqual(after.value, defaultLoc.value);
}
@@ -885,7 +890,7 @@ Ep.updateContextPrevLoc = function(loc) {
if (loc) {
t.assertLiteral(loc);

if (loc.value === -1) {
if (loc.value === PENDING_LOCATION) {
// If an uninitialized location literal was passed in, set its value
// to the current this.listing.length.
loc.value = this.listing.length;
22 changes: 22 additions & 0 deletions test/tests.es6.js
Original file line number Diff line number Diff line change
@@ -1504,6 +1504,28 @@ describe("delegated yield", function() {
check(gen(iterator), [], "1foo");
});

it("should work with empty string", function() {
function* f() {
yield* "";
};

assert.deepEqual(f().next(), { value: undefined, done: true });
});

it("should throw if not iterable", function() {
function* f(x) {
yield* x;
};

assert.throws(() => f(undefined).next(), TypeError);
assert.throws(() => f(null).next(), TypeError);
assert.throws(() => f(false).next(), TypeError);
assert.throws(() => f(true).next(), TypeError);
assert.throws(() => f(0).next(), TypeError);
assert.throws(() => f(1).next(), TypeError);
assert.throws(() => f({}).next(), TypeError);
});

it("should throw if the delegated iterable's iterator doesn't have .next", function() {
var it = function* () {
yield* {