Files
scriptc/tests/corpus/symbol-class-fields/counter.cjs
Chris Tate c58160ca94 Support stable symbol-keyed class fields
- Compile initialized Symbol() and Symbol.for() fields, including inherited OpenTUI brands.
- Share registry-key storage across modules and keep symbol slots out of string-keyed enumeration.
- Refuse unstable keys and unsupported symbol-field copies.
2026-09-27 22:47:14 -05:00

13 lines
270 B
JavaScript

const countKey = Symbol.for("scriptc.counter");
const sameCount = Symbol.for("scriptc.counter");
class Counter {
constructor() {
this[countKey] = 1;
}
bump() {
this[sameCount] += 1;
return this[sameCount];
}
}
module.exports = { Counter, countKey };