mirror of
https://github.com/hanzoai/babel.git
synced 2026-10-30 14:46:06 +00:00
Co-authored-by: Nicolò Ribaudo <[email protected]> Fixes https://github.com/babel/babel/issues/15169
19 lines
360 B
JavaScript
19 lines
360 B
JavaScript
// [Symbol.toPrimitive] must be called if exist
|
|
var counter = 0;
|
|
(new class {
|
|
f() {
|
|
delete super[{
|
|
[Symbol.toPrimitive]: function() { ++counter; return 0; },
|
|
}];
|
|
}
|
|
}).f();
|
|
|
|
// [Symbol.toPrimitive] must return a primitive value
|
|
(new class {
|
|
f() {
|
|
delete super[{
|
|
[Symbol.toPrimitive]: function() { return {}; },
|
|
}];
|
|
}
|
|
}).f();
|