use-internal-slots.js (755B)
1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally 2 // Copyright (C) 2020 Igalia, S.L. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-temporal.plainyearmonth.compare 7 description: compare() ignores the observable properties and uses internal slots 8 features: [Temporal] 9 ---*/ 10 11 function CustomError() {} 12 13 class AvoidGettersYearMonth extends Temporal.PlainYearMonth { 14 get year() { 15 throw new CustomError(); 16 } 17 get month() { 18 throw new CustomError(); 19 } 20 } 21 22 const one = new AvoidGettersYearMonth(2000, 5); 23 const two = new AvoidGettersYearMonth(2006, 3); 24 assert.sameValue(Temporal.PlainYearMonth.compare(one, two), -1); 25 26 reportCompare(0, 0);