Skip to content

Interpreter: async generator declarations ignore their own use strict directive #3560

Closed

Description

@nickna

An interpreted async generator declared in a sloppy script ignores its own strict directive. Inherited script or module strictness takes a different path.

async function* inspect(value) {
    "use strict";
    yield delete value.length;
}
inspect("x").next().then(
    result => console.log("fulfilled", result.value),
    error => console.log("rejected", error instanceof TypeError));

Node v22.23.2 prints rejected true. Interpreted SharpTS on clean main a3683d903 and PR #3552 332e50d07 prints fulfilled false. Run the classic JS source with --no-tsconfig --noLib.

Placing "use strict" at the script top level instead activates strict deletion in interpretation. This is separate from #3504, which concerns implicit strictness in modules.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions