Parent #904; related #899, #923, #924.
Confirmed on ed325e1
Ten synthetic module fixtures run through the existing test262 runner: 6 invalid accepted / 4 valid passed. Independent Node/V8 SourceTextModule compilation rejects all six invalid modules and accepts all four controls. These are local regression fixtures, not six upstream test262 failures or flips.
The invalid Module bodies are:
super.x;
super();
export default super.x;
export const x = super.x;
export class C extends super.Object {}
const f = () => super.x;Each line is a separate module. Controls cover a legal derived constructor, an object method's SuperProperty, an arrow returning a class with its own method, and ordinary-function new.target.
Root cause
Context.loadModule relies on Parser.parseModule to perform module early errors. checkModuleEarlyErrors checks declarations, scopes and private names but never applies the module's global lexical-super query. Script/eval Context entry points perform an additional scanEvalContext, but the module loader does not. Separately, that visitor lacks an export_decl arm, so simply invoking it would still skip exported initializers/default expressions/class heritage.
ECMA-262 ModuleBody early errors reject a ModuleItemList containing super. The Contains query must descend through exports while preserving function/method/class-body boundaries.
Fix and gate
- Enforce the lexical-super restriction inside the module parser's own early-error phase, so every module consumer benefits.
- Traverse export declarations/default expressions without crossing their nested function/method boundaries.
- Add direct parser fixtures plus module entry/dependency rejection-before-side-effects checks in both execution modes.
- Verify legal method/derived-constructor super remains valid; run the synthetic module fixtures and relevant pinned module/import/export/class corpus scopes serially with the 3072 MB guard.
Evidence: /private/tmp/zig-js-module-early-error-probe.8rugxT/ contains fixture sources, copied standard harness files, independent reference and run script/log. Runner SHA-256: efd808f2d2eebabc4f31b207114c73756bf05ff481268cc3c88a4338ab2342ee. No implementation or upstream conformance improvement claimed yet.