Skip to content

Interop Gen: Support Generator Functions #390

Open
@nikeokoronkwo

Description

@nikeokoronkwo

This is to add support for generator functions in the Dart Interop Gen project.

// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*

function* generator(i) {
  yield i;
  yield i + 10;
}

// using the function
const gen = generator(10);

console.log(gen.next().value);
// Expected output: 10

In order for this, we will need to implement Iterator, AsyncIterator, Generator and AsyncGenerator in our codebase. From their APIs, they end up being more similar to Dart's Iterator (as they have methods like next()), but we might consider helpers to convert them to Iterable and Stream.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions