Initial ES modules support

This commit is contained in:
2026-10-26 12:39:58 +00:00
parent f7c5b2c80f
commit 1e12e7be2e
35 changed files with 1266 additions and 505 deletions
+4 -2
View File
@@ -13,8 +13,10 @@
// Not supported yet: `throw()` on a generator, and `finally` blocks in
// `return()`, which need exceptions
import { __is_promise, __reject, __resolve } from "jsrt:promise";
// A generator's object is `co` itself
const __GeneratorProto = {
export const __GeneratorProto = {
// The body runs up to its `initial_yield`, after its params
start() {
this.step(undefined);
@@ -39,7 +41,7 @@ const __GeneratorProto = {
// An async fn returns a promise, which its return fulfils. A rejected await
// rejects it, and the rest of the body does not run, as an uncaught throw at the
// await would
const __AsyncProto = {
export const __AsyncProto = {
// The body runs up to its first await, in the call
start() {
const promise = new Promise(undefined);