tc39/test262

top-level using

已关闭

#5,073 创建于 2026年6月19日

 (1 条评论) (0 个反应) (0 位负责人)JavaScript (469 个派生)batch import
coveragehelp wanted

仓库指标

星标
 (2,073 个星标)
PR 合并指标
 (平均合并 12天 12小时) (30 天内合并 9 个 PR)

描述

Our XS engine has supported Explicit Resource Management for years behind a flag. We are preparing to enable that by default, now that the proposal has achieved Stage 4. 🎉 Despite passing 100% of Explicit Resource Management tests in test262, we found that XS was not invoking [Symbol.dispose] when exiting the top-level of a module (see example below). Perhaps it is worth extending test262 coverage to ensure this is handled correctly and consistently.

class Foo {
	close() {
		trace(`Dispose!\n`);
	}
	toString() {
		return "I'm foo";
	}
	static {
		this.prototype[Symbol.dispose] = this.prototype.close;
	}
}

using x = new Foo
trace(x, "\n");

贡献者指南