diff --git a/src/builtins/BuiltinTemporal.cpp b/src/builtins/BuiltinTemporal.cpp index f8d601173..e67501e03 100644 --- a/src/builtins/BuiltinTemporal.cpp +++ b/src/builtins/BuiltinTemporal.cpp @@ -158,7 +158,7 @@ static Value builtinTemporalPlainDateFrom(ExecutionState& state, Value thisValue } if (argv[0].isObject() && argv[0].asObject()->isTemporalPlainDateObject()) { - Temporal::toTemporalOverflow(state, argc > 1 ? Value(argv[1].asObject()) : Value()); + TemporalObject::toTemporalOverflow(state, argc > 1 ? Value(argv[1].asObject()) : Value()); TemporalPlainDateObject* plainDate = argv[0].asObject()->asTemporalPlainDateObject(); return TemporalPlainDateObject::createTemporalDate(state, plainDate->year(), plainDate->month(), plainDate->day(), plainDate->getCalendar()); } @@ -248,7 +248,7 @@ static Value builtinTemporalPlainDatePrototypeAdd(ExecutionState& state, Value t CHECK_TEMPORAL_PLAIN_DATE(state, thisValue); auto duration = TemporalDurationObject::toTemporalDuration(state, argv[0]); - auto options = Temporal::getOptionsObject(state, argc > 2 ? argv[1] : Value()); + auto options = TemporalObject::getOptionsObject(state, argc > 2 ? argv[1] : Value()); return TemporalCalendarObject::calendarDateAdd(state, thisValue.asObject()->asTemporalPlainDateObject()->getCalendar(), thisValue, duration, options); } @@ -257,7 +257,7 @@ static Value builtinTemporalPlainDatePrototypeSubtract(ExecutionState& state, Va CHECK_TEMPORAL_PLAIN_DATE(state, thisValue); auto duration = TemporalDurationObject::createNegatedTemporalDuration(state, TemporalDurationObject::toTemporalDuration(state, argv[0])); - auto options = Temporal::getOptionsObject(state, argc > 2 ? argv[1] : Value()); + auto options = TemporalObject::getOptionsObject(state, argc > 2 ? argv[1] : Value()); return TemporalCalendarObject::calendarDateAdd(state, thisValue.asObject()->asTemporalPlainDateObject()->getCalendar(), thisValue, duration, options); } @@ -279,8 +279,8 @@ static Value builtinTemporalPlainTimeConstructor(ExecutionState& state, Value th static Value builtinTemporalPlainTimeFrom(ExecutionState& state, Value thisValue, size_t argc, Value* argv, Optional newTarget) { - Value options = Temporal::getOptionsObject(state, argc > 1 ? argv[1] : Value()); - options = Temporal::toTemporalOverflow(state, options); + Value options = TemporalObject::getOptionsObject(state, argc > 1 ? argv[1] : Value()); + options = TemporalObject::toTemporalOverflow(state, options); if (argv[0].isObject() && argv[0].asObject()->isTemporalPlainTimeObject()) { TemporalPlainTimeObject* item = argv[0].asObject()->asTemporalPlainTimeObject(); @@ -365,11 +365,11 @@ static Value builtinTemporalPlainTimeWith(ExecutionState& state, Value thisValue ErrorObject::throwBuiltinError(state, ErrorCode::TypeError, "temporalTimeLike is not an Object"); } - Temporal::rejectObjectWithCalendarOrTimeZone(state, argv[0]); + TemporalObject::rejectObjectWithCalendarOrTimeZone(state, argv[0]); auto partialTime = TemporalPlainTimeObject::toPartialTime(state, argv[0]); - Value overFlow = Temporal::toTemporalOverflow(state, Temporal::getOptionsObject(state, argc > 1 ? argv[1] : Value())); + Value overFlow = TemporalObject::toTemporalOverflow(state, TemporalObject::getOptionsObject(state, argc > 1 ? argv[1] : Value())); auto result = TemporalPlainTimeObject::regulateTime(state, partialTime[TemporalObject::HOUR_UNIT].isUndefined() ? partialTime[TemporalObject::HOUR_UNIT].asInt32() : temporalTime->getHour(), @@ -443,7 +443,7 @@ static Value builtinTemporalPlainDateTimeFrom(ExecutionState& state, Value thisV } if (argv[0].isObject() && argv[0].asObject()->isTemporalPlainDateTimeObject()) { - Temporal::toTemporalOverflow(state, argc > 1 ? Value(argv[1].asObject()) : Value()); + TemporalObject::toTemporalOverflow(state, argc > 1 ? Value(argv[1].asObject()) : Value()); TemporalPlainDateTimeObject* plainDateTime = argv[0].asObject()->asTemporalPlainDateTimeObject(); return TemporalPlainDateTimeObject::createTemporalDateTime(state, plainDateTime->getYear(), plainDateTime->getMonth(), plainDateTime->getDay(), plainDateTime->getHour(), @@ -571,12 +571,12 @@ static Value builtinTemporalZonedDateTimeConstructor(ExecutionState& state, Valu static Value builtinTemporalZonedDateTimeFrom(ExecutionState& state, Value thisValue, size_t argc, Value* argv, Optional newTarget) { - Value options = Temporal::getOptionsObject(state, argc > 1 ? argv[1] : Value()); + Value options = TemporalObject::getOptionsObject(state, argc > 1 ? argv[1] : Value()); if (argv[0].isObject() && argv[0].asObject()->isTemporalZonedDateTimeObject()) { - Temporal::toTemporalOverflow(state, options); - Temporal::toTemporalDisambiguation(state, options); - Temporal::toTemporalOffset(state, options, Value(state.context()->staticStrings().reject.string())); + TemporalObject::toTemporalOverflow(state, options); + TemporalObject::toTemporalDisambiguation(state, options); + TemporalObject::toTemporalOffset(state, options, Value(state.context()->staticStrings().reject.string())); auto item = argv[0].asObject()->asTemporalZonedDateTimeObject(); return TemporalZonedDateTimeObject::createTemporalZonedDateTime(state, *(item->getNanoseconds()), item->getTimeZone(), item->getCalendar()); } @@ -954,10 +954,10 @@ static Value builtinTemporalPlainYearMonthConstructor(ExecutionState& state, Val static Value builtinTemporalPlainYearMonthFrom(ExecutionState& state, Value thisValue, size_t argc, Value* argv, Optional newTarget) { - auto options = Temporal::getOptionsObject(state, argc == 2 ? argv[1] : Value()); + auto options = TemporalObject::getOptionsObject(state, argc == 2 ? argv[1] : Value()); if (argv[0].isObject() && argv[0].asObject()->isTemporalPlainYearMonthObject()) { - Temporal::toTemporalOverflow(state, options); + TemporalObject::toTemporalOverflow(state, options); auto item = argv[0].asObject()->asTemporalPlainYearMonthObject(); return TemporalPlainYearMonthObject::createTemporalYearMonth(state, item->getIsoYear(), item->getIsoMonth(), item->getCalendar(), item->getReferenceIsoDay()); } @@ -1200,10 +1200,10 @@ static Value builtinTemporalPlainMonthDayConstructor(ExecutionState& state, Valu static Value builtinTemporalPlainMonthDayFrom(ExecutionState& state, Value thisValue, size_t argc, Value* argv, Optional newTarget) { - auto options = Temporal::getOptionsObject(state, argc >= 2 ? argv[1] : Value()); + auto options = TemporalObject::getOptionsObject(state, argc >= 2 ? argv[1] : Value()); if (argv[0].isObject() && argv[0].asObject()->isTemporalPlainMonthDayObject()) { - Temporal::toTemporalOverflow(state, options); + TemporalObject::toTemporalOverflow(state, options); auto item = argv[0].asObject()->asTemporalPlainMonthDayObject(); return TemporalPlainMonthDayObject::createTemporalMonthDay(state, item->getIsoMonth(), item->getIsoDay(), item->getCalendar(), item->getReferenceIsoYear()); } @@ -1629,96 +1629,96 @@ void GlobalObject::installTemporal(ExecutionState& state) auto temporalPlainDate = new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDate(), builtinTemporalPlainDateConstructor, 4), NativeFunctionObject::__ForBuiltinConstructor__); temporalPlainDate->setGlobalIntrinsicObject(state); - auto temporalPlainDatePrototype = new PrototypeObject(state); - temporalPlainDatePrototype->setGlobalIntrinsicObject(state, true); + m_temporalPlainDatePrototype = new PrototypeObject(state); + m_temporalPlainDatePrototype->setGlobalIntrinsicObject(state, true); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalPlainDate, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalPlainDate, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); JSGetterSetter dateCalendarGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->calendar, builtinTemporalPlainDateCalendar, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateCalendarDesc(dateCalendarGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->calendar), dateCalendarDesc); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->calendar), dateCalendarDesc); JSGetterSetter dateYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyYear(), builtinTemporalPlainDateYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateYearDesc(dateYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyYear()), dateYearDesc); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyYear()), dateYearDesc); JSGetterSetter dateMonthGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonth(), builtinTemporalPlainDateMonth, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateMonthDesc(dateMonthGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonth()), dateMonthDesc); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonth()), dateMonthDesc); JSGetterSetter dateMonthCodeGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonthCode(), builtinTemporalPlainDateMonthCode, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateMonthCodeDesc(dateMonthCodeGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthCode()), dateMonthCodeDesc); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthCode()), dateMonthCodeDesc); JSGetterSetter dateDayGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDay(), builtinTemporalPlainDateDay, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateDayDesc(dateDayGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDay()), dateDayDesc); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDay()), dateDayDesc); JSGetterSetter dateDayOfWeekGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDayOfWeek(), builtinTemporalPlainDateDayOfWeek, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateDayOfWeekDesc(dateDayOfWeekGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfWeek()), dateDayOfWeekDesc); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfWeek()), dateDayOfWeekDesc); JSGetterSetter dateDayOfYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDayOfYear(), builtinTemporalPlainDateDayOfYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateDayOfYearDesc(dateDayOfYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfYear()), dateDayOfYearDesc); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfYear()), dateDayOfYearDesc); JSGetterSetter dateWeekOfYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyWeekOfYear(), builtinTemporalPlainDateWeekOfYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateWeekOfYearDesc(dateWeekOfYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyWeekOfYear()), dateWeekOfYearDesc); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyWeekOfYear()), dateWeekOfYearDesc); JSGetterSetter dateDaysInWeekGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDaysInWeek(), builtinTemporalPlainDateDaysInWeek, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateDaysInWeekDesc(dateDaysInWeekGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInWeek()), dateDaysInWeekDesc); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInWeek()), dateDaysInWeekDesc); JSGetterSetter dateDaysInMonthGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDaysInMonth(), builtinTemporalPlainDateDaysInMonth, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateDaysInMonthDesc(dateDaysInMonthGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInMonth()), dateDaysInMonthDesc); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInMonth()), dateDaysInMonthDesc); JSGetterSetter dateDaysInYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDaysInYear(), builtinTemporalPlainDateDaysInYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateDaysInYearDesc(dateDaysInYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInYear()), dateDaysInYearDesc); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInYear()), dateDaysInYearDesc); JSGetterSetter dateMonthsInYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonthsInYear(), builtinTemporalPlainDateMonthsInYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateMonthsInYearDesc(dateMonthsInYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthsInYear()), dateMonthsInYearDesc); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthsInYear()), dateMonthsInYearDesc); JSGetterSetter dateInLeapYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyInLeapYear(), builtinTemporalPlainDateInLeapYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateInLeapYearDesc(dateInLeapYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyInLeapYear()), dateInLeapYearDesc); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyInLeapYear()), dateInLeapYearDesc); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->add), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->add, builtinTemporalPlainDatePrototypeAdd, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->add), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->add, builtinTemporalPlainDatePrototypeAdd, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySubtract()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySubtract(), builtinTemporalPlainDatePrototypeSubtract, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalPlainDatePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySubtract()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySubtract(), builtinTemporalPlainDatePrototypeSubtract, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalPlainDate->setFunctionPrototype(state, temporalPlainDatePrototype); + temporalPlainDate->setFunctionPrototype(state, m_temporalPlainDatePrototype); temporalPlainDate->directDefineOwnProperty(state, ObjectPropertyName(strings->from), ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->from, builtinTemporalPlainDateFrom, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); @@ -1726,10 +1726,10 @@ void GlobalObject::installTemporal(ExecutionState& state) auto temporalPlainTime = new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyTime(), builtinTemporalPlainTimeConstructor, 0), NativeFunctionObject::__ForBuiltinConstructor__); temporalPlainTime->setGlobalIntrinsicObject(state); - auto temporalPlainTimePrototype = new PrototypeObject(state); - temporalPlainTimePrototype->setGlobalIntrinsicObject(state, true); + m_temporalPlainTimePrototype = new PrototypeObject(state); + m_temporalPlainTimePrototype->setGlobalIntrinsicObject(state, true); - temporalPlainTimePrototype->defineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalPlainTime, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalPlainTimePrototype->defineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalPlainTime, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); temporalPlainTime->directDefineOwnProperty(state, ObjectPropertyName(strings->from), ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->from, builtinTemporalPlainTimeFrom, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); @@ -1741,158 +1741,158 @@ void GlobalObject::installTemporal(ExecutionState& state) new NativeFunctionObject(state, NativeFunctionInfo(strings->calendar, builtinTemporalPlainTimeCalendar, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor timeCalendarDesc(timeCalendarGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->calendar), timeCalendarDesc); + m_temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->calendar), timeCalendarDesc); JSGetterSetter timeHourGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyHour(), builtinTemporalPlainTimeHour, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor timeHourDesc(timeHourGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyHour()), timeHourDesc); + m_temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyHour()), timeHourDesc); JSGetterSetter timeMinuteGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMinute(), builtinTemporalPlainTimeMinute, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor timeMinuteDesc(timeMinuteGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMinute()), timeMinuteDesc); + m_temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMinute()), timeMinuteDesc); JSGetterSetter timeSecondGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySecond(), builtinTemporalPlainTimeSecond, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor timeSecondDesc(timeSecondGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySecond()), timeSecondDesc); + m_temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySecond()), timeSecondDesc); JSGetterSetter timeMilliSecondGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMillisecond(), builtinTemporalPlainTimeMilliSecond, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor timeMilliSecondDesc(timeMilliSecondGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMillisecond()), timeMilliSecondDesc); + m_temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMillisecond()), timeMilliSecondDesc); JSGetterSetter timeMicroSecondGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMicrosecond(), builtinTemporalPlainTimeMicroSecond, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor timeMicroSecondDesc(timeMicroSecondGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMicrosecond()), timeMicroSecondDesc); + m_temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMicrosecond()), timeMicroSecondDesc); JSGetterSetter timeNanoSecondGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyNanosecond(), builtinTemporalPlainTimeNanoSecond, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor timeNanoSecondDesc(timeNanoSecondGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyNanosecond()), timeNanoSecondDesc); + m_temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyNanosecond()), timeNanoSecondDesc); - temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->add), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->add, builtinTemporalPlainTimePrototypeAdd, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->add), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->add, builtinTemporalPlainTimePrototypeAdd, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySubtract()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySubtract(), builtinTemporalPlainTimePrototypeSubtract, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySubtract()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySubtract(), builtinTemporalPlainTimePrototypeSubtract, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->with), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->with, builtinTemporalPlainTimeWith, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->with), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->with, builtinTemporalPlainTimeWith, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEquals()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyEquals(), builtinTemporalPlainTimeEquals, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEquals()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyEquals(), builtinTemporalPlainTimeEquals, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyGetISOFields()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyGetISOFields(), builtinTemporalPlainTimeGetISOFields, 0, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyGetISOFields()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyGetISOFields(), builtinTemporalPlainTimeGetISOFields, 0, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyToPlainDateTime()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyToPlainDateTime(), builtinTemporalPlainTimeToPlainDateTime, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalPlainTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyToPlainDateTime()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyToPlainDateTime(), builtinTemporalPlainTimeToPlainDateTime, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalPlainTime->setFunctionPrototype(state, temporalPlainTimePrototype); + temporalPlainTime->setFunctionPrototype(state, m_temporalPlainTimePrototype); auto temporalPlainDateTime = new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDateTime(), builtinTemporalPlainDateTimeConstructor, 3), NativeFunctionObject::__ForBuiltinConstructor__); temporalPlainDateTime->setGlobalIntrinsicObject(state); - auto temporalPlainDateTimePrototype = new PrototypeObject(state); - temporalPlainDateTimePrototype->setGlobalIntrinsicObject(state, true); + m_temporalPlainDateTimePrototype = new PrototypeObject(state); + m_temporalPlainDateTimePrototype->setGlobalIntrinsicObject(state, true); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalPlainDateTime, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalPlainDateTime, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); JSGetterSetter dateTimeCalendarGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->calendar, builtinTemporalPlainDateTimeCalendar, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateTimeCalendarDesc(dateTimeCalendarGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->calendar), dateTimeCalendarDesc); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->calendar), dateTimeCalendarDesc); JSGetterSetter dateTimeYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyYear(), builtinTemporalPlainDateTimeYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateTimeYearDesc(dateTimeYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyYear()), dateTimeYearDesc); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyYear()), dateTimeYearDesc); JSGetterSetter dateTimeMonthGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonth(), builtinTemporalPlainDateTimeMonth, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateTimeMonthDesc(dateTimeMonthGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonth()), dateTimeMonthDesc); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonth()), dateTimeMonthDesc); JSGetterSetter dateTimeMonthCodeGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonthCode(), builtinTemporalPlainDateTimeMonthCode, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateTimeMonthCodeDesc(dateTimeMonthCodeGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthCode()), dateTimeMonthCodeDesc); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthCode()), dateTimeMonthCodeDesc); JSGetterSetter dateTimeDayGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDay(), builtinTemporalPlainDateTimeDay, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateTimeDayDesc(dateTimeDayGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDay()), dateTimeDayDesc); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDay()), dateTimeDayDesc); JSGetterSetter dateTimeDayOfWeekGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDayOfWeek(), builtinTemporalPlainDateTimeDayOfWeek, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateTimeDayOfWeekDesc(dateTimeDayOfWeekGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfWeek()), dateTimeDayOfWeekDesc); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfWeek()), dateTimeDayOfWeekDesc); JSGetterSetter dateTimeDayOfYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDayOfYear(), builtinTemporalPlainDateTimeDayOfYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateTimeDayOfYearDesc(dateTimeDayOfYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfYear()), dateTimeDayOfYearDesc); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfYear()), dateTimeDayOfYearDesc); JSGetterSetter dateTimeWeekOfYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyWeekOfYear(), builtinTemporalPlainDateTimeWeekOfYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateTimeWeekOfYearDesc(dateTimeWeekOfYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyWeekOfYear()), dateTimeWeekOfYearDesc); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyWeekOfYear()), dateTimeWeekOfYearDesc); JSGetterSetter dateTimeDaysInWeekGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDaysInWeek(), builtinTemporalPlainDateTimeDaysInWeek, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateTimeDaysInWeekDesc(dateTimeDaysInWeekGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInWeek()), dateTimeDaysInWeekDesc); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInWeek()), dateTimeDaysInWeekDesc); JSGetterSetter dateTimeDaysInMonthGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDaysInMonth(), builtinTemporalPlainDateTimeDaysInMonth, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateTimeDaysInMonthDesc(dateTimeDaysInMonthGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInMonth()), dateTimeDaysInMonthDesc); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInMonth()), dateTimeDaysInMonthDesc); JSGetterSetter dateTimeDaysInYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDaysInYear(), builtinTemporalPlainDateTimeDaysInYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateTimeDaysInYearDesc(dateTimeDaysInYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInYear()), dateTimeDaysInYearDesc); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInYear()), dateTimeDaysInYearDesc); JSGetterSetter dateTimeMonthsInYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonthsInYear(), builtinTemporalPlainDateTimeMonthsInYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateTimeMonthsInYearDesc(dateTimeMonthsInYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthsInYear()), dateTimeMonthsInYearDesc); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthsInYear()), dateTimeMonthsInYearDesc); JSGetterSetter dateTimeInLeapYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyInLeapYear(), builtinTemporalPlainDateTimeInLeapYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor dateTimeInLeapYearDesc(dateTimeInLeapYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyInLeapYear()), dateTimeInLeapYearDesc); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyInLeapYear()), dateTimeInLeapYearDesc); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->add), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->add, builtinTemporalPlainDateTimePrototypeAdd, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->add), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->add, builtinTemporalPlainDateTimePrototypeAdd, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySubtract()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySubtract(), builtinTemporalPlainDateTimePrototypeSubtract, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalPlainDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySubtract()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySubtract(), builtinTemporalPlainDateTimePrototypeSubtract, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalPlainDateTime->setFunctionPrototype(state, temporalPlainDateTimePrototype); + temporalPlainDateTime->setFunctionPrototype(state, m_temporalPlainDateTimePrototype); temporalPlainDateTime->directDefineOwnProperty(state, ObjectPropertyName(strings->from), ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->from, builtinTemporalPlainDateTimeFrom, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); @@ -1900,180 +1900,180 @@ void GlobalObject::installTemporal(ExecutionState& state) auto temporalZonedDateTime = new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDateTime(), builtinTemporalZonedDateTimeConstructor, 3), NativeFunctionObject::__ForBuiltinConstructor__); temporalZonedDateTime->setGlobalIntrinsicObject(state); - auto temporalZonedDateTimePrototype = new PrototypeObject(state); - temporalZonedDateTimePrototype->setGlobalIntrinsicObject(state, true); + m_temporalZonedDateTimePrototype = new PrototypeObject(state); + m_temporalZonedDateTimePrototype->setGlobalIntrinsicObject(state, true); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalZonedDateTime, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalZonedDateTime, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); JSGetterSetter zonedDateTimeCalendarGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->calendar, builtinTemporalZonedDateTimeCalendar, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeCalendarDesc(zonedDateTimeCalendarGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->calendar), zonedDateTimeCalendarDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->calendar), zonedDateTimeCalendarDesc); JSGetterSetter zonedDateTimeTimeZoneGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyTimeZone(), builtinTemporalZonedDateTimeTimeZone, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeTimeZoneDesc(zonedDateTimeTimeZoneGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyTimeZone()), zonedDateTimeTimeZoneDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyTimeZone()), zonedDateTimeTimeZoneDesc); JSGetterSetter zonedDateTimeYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyYear(), builtinTemporalZonedDateTimeYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeYearDesc(zonedDateTimeYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyYear()), zonedDateTimeYearDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyYear()), zonedDateTimeYearDesc); JSGetterSetter zonedDateTimeMonthGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonth(), builtinTemporalZonedDateTimeMonth, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeMonthDesc(zonedDateTimeMonthGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonth()), zonedDateTimeMonthDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonth()), zonedDateTimeMonthDesc); JSGetterSetter zonedDateTimeMonthCodeGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonthCode(), builtinTemporalZonedDateTimeMonthCode, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeMonthCodeDesc(zonedDateTimeMonthCodeGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthCode()), zonedDateTimeMonthCodeDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthCode()), zonedDateTimeMonthCodeDesc); JSGetterSetter zonedDateTimeDayGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDay(), builtinTemporalZonedDateTimeDay, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeDayDesc(zonedDateTimeDayGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDay()), zonedDateTimeDayDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDay()), zonedDateTimeDayDesc); JSGetterSetter zonedDateTimeHourGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyHour(), builtinTemporalZonedDateTimeHour, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeHourDesc(zonedDateTimeHourGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyHour()), zonedDateTimeHourDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyHour()), zonedDateTimeHourDesc); JSGetterSetter zonedDateTimeMinuteGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMinute(), builtinTemporalZonedDateTimeMinute, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeMinuteDesc(zonedDateTimeMinuteGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMinute()), zonedDateTimeMinuteDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMinute()), zonedDateTimeMinuteDesc); JSGetterSetter zonedDateTimeSecondGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySecond(), builtinTemporalZonedDateTimeSecond, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeSecondDesc(zonedDateTimeSecondGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySecond()), zonedDateTimeSecondDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySecond()), zonedDateTimeSecondDesc); JSGetterSetter zonedDateTimeMillisecondGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMillisecond(), builtinTemporalZonedDateTimeMillisecond, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeMillisecondDesc(zonedDateTimeMillisecondGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMillisecond()), zonedDateTimeMillisecondDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMillisecond()), zonedDateTimeMillisecondDesc); JSGetterSetter zonedDateTimeMicrosecondGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMicrosecond(), builtinTemporalZonedDateTimeMicrosecond, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeMicrosecondDesc(zonedDateTimeMicrosecondGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMicrosecond()), zonedDateTimeMicrosecondDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMicrosecond()), zonedDateTimeMicrosecondDesc); JSGetterSetter zonedDateTimeNanosecondGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyNanosecond(), builtinTemporalZonedDateTimeNanosecond, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeNanosecondDesc(zonedDateTimeNanosecondGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyNanosecond()), zonedDateTimeNanosecondDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyNanosecond()), zonedDateTimeNanosecondDesc); JSGetterSetter zonedDateTimeEpochSecondGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyEpochSeconds(), builtinTemporalZonedDateTimeEpochSeconds, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeEpochSecondsDesc(zonedDateTimeEpochSecondGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochSeconds()), zonedDateTimeEpochSecondsDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochSeconds()), zonedDateTimeEpochSecondsDesc); JSGetterSetter zonedDateTimeEpochMillisecondsGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyEpochMicroseconds(), builtinTemporalZonedDateTimeEpochMicroSeconds, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeEpochMillisecondsDesc(zonedDateTimeEpochMillisecondsGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochMicroseconds()), zonedDateTimeEpochMillisecondsDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochMicroseconds()), zonedDateTimeEpochMillisecondsDesc); JSGetterSetter zonedDateTimeEpochMicrosecondsGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyEpochMilliseconds(), builtinTemporalZonedDateTimeEpochMilliSeconds, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeEpochMicrosecondsDesc(zonedDateTimeEpochMicrosecondsGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochMilliseconds()), zonedDateTimeEpochMicrosecondsDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochMilliseconds()), zonedDateTimeEpochMicrosecondsDesc); JSGetterSetter zonedDateTimeEpochNanosecondsGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyEpochNanoseconds(), builtinTemporalZonedDateTimeEpochNanoSeconds, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeEpochNanosecondsDesc(zonedDateTimeEpochNanosecondsGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochNanoseconds()), zonedDateTimeEpochNanosecondsDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochNanoseconds()), zonedDateTimeEpochNanosecondsDesc); JSGetterSetter zonedDateTimeDayOfWeekGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDayOfWeek(), builtinTemporalZonedDateTimeDayOfWeek, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeDayOfWeekDesc(zonedDateTimeDayOfWeekGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfWeek()), zonedDateTimeDayOfWeekDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfWeek()), zonedDateTimeDayOfWeekDesc); JSGetterSetter zonedDateTimeDayOfYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDayOfYear(), builtinTemporalZonedDateTimeDayOfYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeDayOfYearDesc(zonedDateTimeDayOfYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfYear()), zonedDateTimeDayOfYearDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfYear()), zonedDateTimeDayOfYearDesc); JSGetterSetter zonedDateTimeWeekOfYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyWeekOfYear(), builtinTemporalZonedDateTimeWeekOfYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeWeekOfYearDesc(zonedDateTimeWeekOfYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyWeekOfYear()), zonedDateTimeWeekOfYearDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyWeekOfYear()), zonedDateTimeWeekOfYearDesc); JSGetterSetter zonedDateTimeHoursInDayGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyHoursInDay(), builtinTemporalZonedDateTimeHoursInDay, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeHoursInDayDesc(zonedDateTimeHoursInDayGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyHoursInDay()), zonedDateTimeHoursInDayDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyHoursInDay()), zonedDateTimeHoursInDayDesc); JSGetterSetter zonedDateTimeDaysInWeekGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDaysInWeek(), builtinTemporalZonedDateTimeDaysInWeek, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeDaysInWeekDesc(zonedDateTimeDaysInWeekGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInWeek()), zonedDateTimeDaysInWeekDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInWeek()), zonedDateTimeDaysInWeekDesc); JSGetterSetter zonedDateTimeDaysInMonthGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDaysInMonth(), builtinTemporalZonedDateTimeDaysInMonth, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeDaysInMonthDesc(zonedDateTimeDaysInMonthGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInMonth()), zonedDateTimeDaysInMonthDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInMonth()), zonedDateTimeDaysInMonthDesc); JSGetterSetter zonedDateTimeDaysInYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDaysInYear(), builtinTemporalZonedDateTimeDaysInYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeDaysInYearDesc(zonedDateTimeDaysInYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInYear()), zonedDateTimeDaysInYearDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInYear()), zonedDateTimeDaysInYearDesc); JSGetterSetter zonedDateTimeMonthsInYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonthsInYear(), builtinTemporalZonedDateTimeMonthsInYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeMonthsInYearDesc(zonedDateTimeMonthsInYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthsInYear()), zonedDateTimeMonthsInYearDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthsInYear()), zonedDateTimeMonthsInYearDesc); JSGetterSetter zonedDateTimeInLeapYearGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyInLeapYear(), builtinTemporalZonedDateTimeInLeapYear, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeInLeapYearDesc(zonedDateTimeInLeapYearGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyInLeapYear()), zonedDateTimeInLeapYearDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyInLeapYear()), zonedDateTimeInLeapYearDesc); JSGetterSetter zonedDateTimeOffsetNanosecondsGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyOffsetNanoseconds(), builtinTemporalZonedDateTimeOffsetNanoseconds, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeOffsetNanosecondsDesc(zonedDateTimeOffsetNanosecondsGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyOffsetNanoseconds()), zonedDateTimeOffsetNanosecondsDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyOffsetNanoseconds()), zonedDateTimeOffsetNanosecondsDesc); JSGetterSetter zonedDateTimeOffsetGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyOffset(), builtinTemporalZonedDateTimeOffset, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor zonedDateTimeOffsetDesc(zonedDateTimeOffsetGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyOffset()), zonedDateTimeOffsetDesc); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyOffset()), zonedDateTimeOffsetDesc); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->add), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->add, builtinTemporalZonedDateTimePrototypeAdd, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->add), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->add, builtinTemporalZonedDateTimePrototypeAdd, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySubtract()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySubtract(), builtinTemporalZonedDateTimePrototypeSubtract, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalZonedDateTimePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySubtract()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySubtract(), builtinTemporalZonedDateTimePrototypeSubtract, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalZonedDateTime->setFunctionPrototype(state, temporalZonedDateTimePrototype); + temporalZonedDateTime->setFunctionPrototype(state, m_temporalZonedDateTimePrototype); temporalZonedDateTime->directDefineOwnProperty(state, ObjectPropertyName(strings->from), ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->from, builtinTemporalZonedDateTimeFrom, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); @@ -2083,94 +2083,94 @@ void GlobalObject::installTemporal(ExecutionState& state) auto temporalDuration = new NativeFunctionObject(state, NativeFunctionInfo(strings->constructor, builtinTemporalDurationConstructor, 0), NativeFunctionObject::__ForBuiltinConstructor__); temporalDuration->setGlobalIntrinsicObject(state); - auto temporalDurationPrototype = new PrototypeObject(state); - temporalDurationPrototype->setGlobalIntrinsicObject(state, true); + m_temporalDurationPrototype = new PrototypeObject(state); + m_temporalDurationPrototype->setGlobalIntrinsicObject(state, true); JSGetterSetter durationYearsGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyYears(), builtinTemporalDurationPrototypeYears, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor durationYearsDesc(durationYearsGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyYears()), durationYearsDesc); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyYears()), durationYearsDesc); JSGetterSetter durationMonthsGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonths(), builtinTemporalDurationPrototypeMonths, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor durationMonthsDesc(durationMonthsGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonths()), durationMonthsDesc); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonths()), durationMonthsDesc); JSGetterSetter durationWeeksGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyWeeks(), builtinTemporalDurationPrototypeWeeks, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor durationWeeksDesc(durationWeeksGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyWeeks()), durationWeeksDesc); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyWeeks()), durationWeeksDesc); JSGetterSetter durationDaysGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDays(), builtinTemporalDurationPrototypeDays, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor durationDaysDesc(durationDaysGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDays()), durationDaysDesc); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDays()), durationDaysDesc); JSGetterSetter durationYHoursGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyHours(), builtinTemporalDurationPrototypeHours, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor durationHoursDesc(durationYHoursGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyHours()), durationHoursDesc); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyHours()), durationHoursDesc); JSGetterSetter durationMinutesGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMinutes(), builtinTemporalDurationPrototypeMinutes, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor durationMinutesDesc(durationMinutesGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMinutes()), durationMinutesDesc); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMinutes()), durationMinutesDesc); JSGetterSetter durationSecondsGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySeconds(), builtinTemporalDurationPrototypeSeconds, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor durationSecondsDesc(durationSecondsGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySeconds()), durationSecondsDesc); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySeconds()), durationSecondsDesc); JSGetterSetter durationMilliSecondsGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMilliseconds(), builtinTemporalDurationPrototypeMilliSeconds, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor durationMilliSecondsDesc(durationMilliSecondsGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMilliseconds()), durationMilliSecondsDesc); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMilliseconds()), durationMilliSecondsDesc); JSGetterSetter durationMicroSecondsGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMicroseconds(), builtinTemporalDurationPrototypeMicroSeconds, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor durationMicroSecondsDesc(durationMicroSecondsGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMicroseconds()), durationMicroSecondsDesc); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMicroseconds()), durationMicroSecondsDesc); JSGetterSetter durationNanoSecondsGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyNanoseconds(), builtinTemporalDurationPrototypeNanoSeconds, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor durationNanoSecondsDesc(durationNanoSecondsGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyNanoseconds()), durationNanoSecondsDesc); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyNanoseconds()), durationNanoSecondsDesc); JSGetterSetter durationSignGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->sign, builtinTemporalDurationPrototypeSign, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor durationSignDesc(durationSignGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->sign), durationSignDesc); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->sign), durationSignDesc); JSGetterSetter durationBlankGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyBlank(), builtinTemporalDurationPrototypeBlank, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor durationBlankDesc(durationBlankGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyBlank()), durationBlankDesc); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyBlank()), durationBlankDesc); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->add), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->add, builtinTemporalDurationPrototypeAdd, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->add), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->add, builtinTemporalDurationPrototypeAdd, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySubtract()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySubtract(), builtinTemporalDurationPrototypeSubtract, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySubtract()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySubtract(), builtinTemporalDurationPrototypeSubtract, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->abs), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->abs, builtinTemporalDurationPrototypeAbs, 0, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->abs), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->abs, builtinTemporalDurationPrototypeAbs, 0, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyNegated()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyNegated(), builtinTemporalDurationPrototypeNegated, 0, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyNegated()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyNegated(), builtinTemporalDurationPrototypeNegated, 0, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalDuration->setFunctionPrototype(state, temporalDurationPrototype); + temporalDuration->setFunctionPrototype(state, m_temporalDurationPrototype); temporalDuration->directDefineOwnProperty(state, ObjectPropertyName(strings->from), ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->from, builtinTemporalDurationFrom, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); @@ -2273,8 +2273,8 @@ void GlobalObject::installTemporal(ExecutionState& state) temporalPlainYearMonthPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySubtract()), ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySubtract(), builtinTemporalPlainYearMonthPrototypeSubtract, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEquals()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyEquals(), builtinTemporalPlainYearMonthPrototypeEquals, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalDurationPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEquals()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyEquals(), builtinTemporalPlainYearMonthPrototypeEquals, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); temporalPlainYearMonth->setFunctionPrototype(state, temporalPlainYearMonthPrototype); @@ -2299,71 +2299,71 @@ void GlobalObject::installTemporal(ExecutionState& state) temporalInstant->directDefineOwnProperty(state, ObjectPropertyName(strings->compare), ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->compare, builtinTemporalInstantCompare, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - auto temporalInstantPrototype = new PrototypeObject(state); - temporalInstantPrototype->setGlobalIntrinsicObject(state, true); + m_temporalInstantPrototype = new PrototypeObject(state); + m_temporalInstantPrototype->setGlobalIntrinsicObject(state, true); - temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalInstant, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalInstant, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); JSGetterSetter instantSecondsGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyEpochSeconds(), builtinTemporalInstantPrototypeEpochSeconds, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor instantSecondsDesc(instantSecondsGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochSeconds()), instantSecondsDesc); + m_temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochSeconds()), instantSecondsDesc); JSGetterSetter instantMillisecondsGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyEpochMilliseconds(), builtinTemporalInstantPrototypeEpochMilliseconds, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor instantMillisecondsDesc(instantMillisecondsGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochMilliseconds()), instantMillisecondsDesc); + m_temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochMilliseconds()), instantMillisecondsDesc); JSGetterSetter instantMicrosecondsGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyEpochMicroseconds(), builtinTemporalInstantPrototypeEpochMicroseconds, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor instantMicrosecondsDesc(instantMicrosecondsGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochMicroseconds()), instantMicrosecondsDesc); + m_temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochMicroseconds()), instantMicrosecondsDesc); JSGetterSetter instantNanosecondsGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyEpochNanoseconds(), builtinTemporalInstantPrototypeEpochNanoseconds, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor instantNanosecondsDesc(instantNanosecondsGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochNanoseconds()), instantNanosecondsDesc); + m_temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEpochNanoseconds()), instantNanosecondsDesc); - temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEquals()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyEquals(), builtinTemporalInstantPrototypeEquals, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyEquals()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyEquals(), builtinTemporalInstantPrototypeEquals, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->add), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->add, builtinTemporalInstantPrototypeAdd, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->add), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->add, builtinTemporalInstantPrototypeAdd, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySubtract()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySubtract(), builtinTemporalInstantPrototypeSubtract, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalInstantPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazySubtract()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazySubtract(), builtinTemporalInstantPrototypeSubtract, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalInstant->setFunctionPrototype(state, temporalInstantPrototype); + temporalInstant->setFunctionPrototype(state, m_temporalInstantPrototype); auto temporalPlainMonthDay = new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyPlainMonthDay(), builtinTemporalPlainMonthDayConstructor, 2), NativeFunctionObject::__ForBuiltinConstructor__); temporalPlainMonthDay->setGlobalIntrinsicObject(state); - auto temporalPlainMonthDayPrototype = new PrototypeObject(state); - temporalPlainMonthDayPrototype->setGlobalIntrinsicObject(state, true); + m_temporalPlainMonthDayPrototype = new PrototypeObject(state); + m_temporalPlainMonthDayPrototype->setGlobalIntrinsicObject(state, true); - temporalPlainMonthDayPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalPlainMonthDay, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalPlainMonthDayPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalPlainMonthDay, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); JSGetterSetter monthDayCalendarGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->calendar, builtinTemporalPlainMonthDayPrototypeCalendar, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor monthDayCalendarDesc(monthDayCalendarGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainMonthDayPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->calendar), monthDayCalendarDesc); + m_temporalPlainMonthDayPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->calendar), monthDayCalendarDesc); JSGetterSetter monthDayMonthCodeGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonthCode(), builtinTemporalPlainMonthDayPrototypeMonthCode, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor monthDayMonthCodeDesc(monthDayMonthCodeGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainMonthDayPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthCode()), monthDayMonthCodeDesc); + m_temporalPlainMonthDayPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthCode()), monthDayMonthCodeDesc); JSGetterSetter monthDayDayGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDay(), builtinTemporalPlainMonthDayPrototypeDay, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor monthDayDayDesc(monthDayDayGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalPlainMonthDayPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDay()), monthDayDayDesc); + m_temporalPlainMonthDayPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDay()), monthDayDayDesc); temporalPlainMonthDay->directDefineOwnProperty(state, ObjectPropertyName(strings->from), ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->from, builtinTemporalPlainMonthDayFrom, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); @@ -2374,53 +2374,53 @@ void GlobalObject::installTemporal(ExecutionState& state) temporalTimeZone->directDefineOwnProperty(state, ObjectPropertyName(strings->from), ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->from, builtinTemporalTimeZoneFrom, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - auto temporalTimeZonePrototype = new PrototypeObject(state); - temporalTimeZonePrototype->setGlobalIntrinsicObject(state, true); + m_temporalTimeZonePrototype = new PrototypeObject(state); + m_temporalTimeZonePrototype->setGlobalIntrinsicObject(state, true); - temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalTimeZone, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalTimeZone, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); JSGetterSetter timeZoneIDGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyId(), builtinTemporalTimeZonePrototypeId, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor timeZoneIDDesc(timeZoneIDGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyId()), timeZoneIDDesc); + m_temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyId()), timeZoneIDDesc); - temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyGetOffsetNanosecondsFor()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyGetOffsetNanosecondsFor(), builtinTemporalTimeZonePrototypeGetOffsetNanosecondsFor, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyGetOffsetNanosecondsFor()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyGetOffsetNanosecondsFor(), builtinTemporalTimeZonePrototypeGetOffsetNanosecondsFor, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyGetOffsetStringFor()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyGetOffsetStringFor(), builtinTemporalTimeZonePrototypeGetOffsetStringFor, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyGetOffsetStringFor()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyGetOffsetStringFor(), builtinTemporalTimeZonePrototypeGetOffsetStringFor, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyGetPlainDateTimeFor()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyGetPlainDateTimeFor(), builtinTemporalTimeZonePrototypeGetPlainDateTimeFor, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyGetPlainDateTimeFor()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyGetPlainDateTimeFor(), builtinTemporalTimeZonePrototypeGetPlainDateTimeFor, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyGetPossibleInstantsFor()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyGetPossibleInstantsFor(), builtinTemporalTimeZonePrototypeGetPossibleInstantsFor, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyGetPossibleInstantsFor()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyGetPossibleInstantsFor(), builtinTemporalTimeZonePrototypeGetPossibleInstantsFor, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyGetNextTransition()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyGetNextTransition(), builtinTemporalTimeZonePrototypeGetNextTransition, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyGetNextTransition()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyGetNextTransition(), builtinTemporalTimeZonePrototypeGetNextTransition, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyGetPreviousTransition()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyGetPreviousTransition(), builtinTemporalTimeZonePrototypeGetPreviousTransition, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalTimeZonePrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyGetPreviousTransition()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyGetPreviousTransition(), builtinTemporalTimeZonePrototypeGetPreviousTransition, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalTimeZone->setFunctionPrototype(state, temporalTimeZonePrototype); + temporalTimeZone->setFunctionPrototype(state, m_temporalTimeZonePrototype); auto temporalCalendar = new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyCalendar(), builtinTemporalCalendarConstructor, 1), NativeFunctionObject::__ForBuiltinConstructor__); temporalCalendar->setGlobalIntrinsicObject(state); - auto temporalCalendarPrototype = new PrototypeObject(state); - temporalCalendarPrototype->setGlobalIntrinsicObject(state, true); + m_temporalCalendarPrototype = new PrototypeObject(state); + m_temporalCalendarPrototype->setGlobalIntrinsicObject(state, true); JSGetterSetter calendarIDGS( new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyId(), builtinTemporalCalendarPrototypeId, 0, NativeFunctionInfo::Strict)), Value(Value::EmptyValue)); ObjectPropertyDescriptor calendarIDDesc(calendarIDGS, ObjectPropertyDescriptor::ConfigurablePresent); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyId()), calendarIDDesc); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyId()), calendarIDDesc); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalCalendar, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->constructor), ObjectPropertyDescriptor(temporalCalendar, (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendar->setFunctionPrototype(state, temporalCalendarPrototype); + temporalCalendar->setFunctionPrototype(state, m_temporalCalendarPrototype); temporalNow->directDefineOwnProperty(state, ObjectPropertyName(state.context()->vmInstance()->globalSymbols().toStringTag), ObjectPropertyDescriptor(strings->lazyTemporalDotNow().string(), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::ConfigurablePresent))); @@ -2443,59 +2443,59 @@ void GlobalObject::installTemporal(ExecutionState& state) temporalCalendar->directDefineOwnProperty(state, ObjectPropertyName(strings->from), ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->from, builtinTemporalCalendarFrom, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDateFromFields()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDateFromFields(), builtinTemporalCalendarPrototypeDateFromFields, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDateFromFields()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDateFromFields(), builtinTemporalCalendarPrototypeDateFromFields, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyYear()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyYear(), builtinTemporalCalendarPrototypeYear, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyYear()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyYear(), builtinTemporalCalendarPrototypeYear, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonth()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonth(), builtinTemporalCalendarPrototypeMonth, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonth()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonth(), builtinTemporalCalendarPrototypeMonth, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthCode()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonthCode(), builtinTemporalCalendarPrototypeMonthCode, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthCode()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonthCode(), builtinTemporalCalendarPrototypeMonthCode, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDay()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDay(), builtinTemporalCalendarPrototypeDay, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDay()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDay(), builtinTemporalCalendarPrototypeDay, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfWeek()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDayOfWeek(), builtinTemporalCalendarPrototypeDayOfWeek, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfWeek()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDayOfWeek(), builtinTemporalCalendarPrototypeDayOfWeek, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfYear()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDayOfYear(), builtinTemporalCalendarPrototypeDayOfYear, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDayOfYear()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDayOfYear(), builtinTemporalCalendarPrototypeDayOfYear, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyWeekOfYear()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyWeekOfYear(), builtinTemporalCalendarPrototypeWeekOfYear, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyWeekOfYear()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyWeekOfYear(), builtinTemporalCalendarPrototypeWeekOfYear, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInWeek()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDaysInWeek(), builtinTemporalCalendarPrototypeDaysInWeek, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInWeek()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDaysInWeek(), builtinTemporalCalendarPrototypeDaysInWeek, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInMonth()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDaysInMonth(), builtinTemporalCalendarPrototypeDaysInMonth, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInMonth()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDaysInMonth(), builtinTemporalCalendarPrototypeDaysInMonth, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInYear()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDaysInYear(), builtinTemporalCalendarPrototypeDaysInYear, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyDaysInYear()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyDaysInYear(), builtinTemporalCalendarPrototypeDaysInYear, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthsInYear()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonthsInYear(), builtinTemporalCalendarPrototypeMonthsInYear, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMonthsInYear()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMonthsInYear(), builtinTemporalCalendarPrototypeMonthsInYear, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyInLeapYear()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyInLeapYear(), builtinTemporalCalendarInLeapYear, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyInLeapYear()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyInLeapYear(), builtinTemporalCalendarInLeapYear, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMergeFields()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMergeFields(), builtinTemporalCalendarPrototypeMergeFields, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyMergeFields()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyMergeFields(), builtinTemporalCalendarPrototypeMergeFields, 2, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyFields()), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyFields(), builtinTemporalCalendarFields, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->lazyFields()), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->lazyFields(), builtinTemporalCalendarFields, 1, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->toString), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->toString, builtinTemporalCalendarToString, 0, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->toString), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->toString, builtinTemporalCalendarToString, 0, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->toJSON), - ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->toJSON, builtinTemporalCalendarToJSON, 0, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); + m_temporalCalendarPrototype->directDefineOwnProperty(state, ObjectPropertyName(strings->toJSON), + ObjectPropertyDescriptor(new NativeFunctionObject(state, NativeFunctionInfo(strings->toJSON, builtinTemporalCalendarToJSON, 0, NativeFunctionInfo::Strict)), (ObjectPropertyDescriptor::PresentAttribute)(ObjectPropertyDescriptor::WritablePresent | ObjectPropertyDescriptor::ConfigurablePresent))); - m_temporal = new Temporal(state, temporalCalendar, temporalCalendarPrototype, temporalDurationPrototype, temporalPlainDatePrototype, temporalPlainTimePrototype, temporalPlainDateTimePrototype, temporalPlainYearMonthPrototype, temporalInstantPrototype, temporalPlainMonthDayPrototype, temporalTimeZonePrototype, temporalZonedDateTimePrototype); + m_temporal = new TemporalObject(state); m_temporal->setGlobalIntrinsicObject(state); m_temporal->directDefineOwnProperty(state, ObjectPropertyName(state.context()->vmInstance()->globalSymbols().toStringTag), diff --git a/src/runtime/GlobalObject.h b/src/runtime/GlobalObject.h index 00bb64b9f..0e8d7dd64 100644 --- a/src/runtime/GlobalObject.h +++ b/src/runtime/GlobalObject.h @@ -240,8 +240,24 @@ class FunctionObject; #define GLOBALOBJECT_BUILTIN_FINALIZATIONREGISTRY(F, objName) \ F(finalizationRegistry, FunctionObject, objName) \ F(finalizationRegistryPrototype, Object, objName) -#define GLOBALOBJECT_BUILTIN_TEMPORAL(F, objName) \ - F(temporal, Object, objName) + +#if defined(ENABLE_TEMPORAL) +#define GLOBALOBJECT_BUILTIN_TEMPORAL(F, objName) \ + F(temporal, Object, objName) \ + F(temporalCalendarPrototype, Object, objName) \ + F(temporalDurationPrototype, Object, objName) \ + F(temporalInstantPrototype, Object, objName) \ + F(temporalPlainDatePrototype, Object, objName) \ + F(temporalPlainDateTimePrototype, Object, objName) \ + F(temporalPlainMonthDayPrototype, Object, objName) \ + F(temporalPlainTimePrototype, Object, objName) \ + F(temporalPlainYearMonthPrototype, Object, objName) \ + F(temporalTimeZonePrototype, Object, objName) \ + F(temporalZonedDateTimePrototype, Object, objName) +#else +#define GLOBALOBJECT_BUILTIN_TEMPORAL(F, objName) +#endif + #define GLOBALOBJECT_BUILTIN_ITERATOR(F, objName) \ F(iterator, FunctionObject, objName) \ F(wrapForValidIteratorPrototype, Object, objName) \ diff --git a/src/runtime/Temporal.h b/src/runtime/Temporal.h deleted file mode 100644 index c1080107f..000000000 --- a/src/runtime/Temporal.h +++ /dev/null @@ -1,231 +0,0 @@ -#if defined(ENABLE_TEMPORAL) -/* - * Copyright (c) 2022-present Samsung Electronics Co., Ltd - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA - */ - -#ifndef __EscargotTemporal__ -#define __EscargotTemporal__ - -#include "Escargot.h" -#include "intl/Intl.h" -#include "runtime/VMInstance.h" - -namespace Escargot { - -class Temporal : public DerivedObject { -public: - explicit Temporal(ExecutionState& state, Object* proto) - : DerivedObject(state, proto, ESCARGOT_OBJECT_BUILTIN_PROPERTY_NUMBER) - { - } - - Temporal(ExecutionState& state, Object* temporalCalendar, Object* temporalCalendarPrototype, Object* temporalDurationPrototype, Object* temporalPlainDatePrototype, Object* temporalPlainTimePrototype, Object* temporalPlainDateTimePrototype, Object* temporalPlainYearMonthPrototype, Object* temporalInstantPrototype, Object* temporalPlainMonthDayPrototype, Object* temporalTimeZonePrototype, Object* temporalZonedDateTimePrototype) - : DerivedObject(state) - , m_temporalCalendar(temporalCalendar) - , m_temporalCalendarPrototype(temporalCalendarPrototype) - , m_temporalDurationPrototype(temporalDurationPrototype) - , m_temporalPlainDatePrototype(temporalPlainDatePrototype) - , m_temporalPlainTimePrototype(temporalPlainTimePrototype) - , m_temporalPlainDateTimePrototype(temporalPlainDateTimePrototype) - , m_temporalPlainYearMonthPrototype(temporalPlainYearMonthPrototype) - , m_temporalInstantPrototype(temporalInstantPrototype) - , m_temporalPlainMonthDayPrototype(temporalPlainMonthDayPrototype) - , m_temporalTimeZonePrototype(temporalTimeZonePrototype) - , m_temporalZonedDateTimePrototype(temporalZonedDateTimePrototype) - { - } - - Object* getTemporalCalendar() const - { - return m_temporalCalendar; - } - - Object* getTemporalCalendarPrototype() const - { - return m_temporalCalendarPrototype; - } - - Object* getTemporalDurationPrototype() const - { - return m_temporalDurationPrototype; - } - - Object* getTemporalPlainDatePrototype() const - { - return m_temporalPlainDatePrototype; - } - - Object* getTemporalPlainTimePrototype() const - { - return m_temporalPlainTimePrototype; - } - - Object* getTemporalPlainDateTimePrototype() const - { - return m_temporalPlainDateTimePrototype; - } - Object* getTemporalPlainMonthDayPrototype() const - { - return m_temporalPlainMonthDayPrototype; - } - - Object* getTemporalPlainYearMonthPrototype() const - { - return m_temporalPlainYearMonthPrototype; - } - - Object* getTemporalInstantPrototype() const - { - return m_temporalInstantPrototype; - } - Object* getTemporalTimeZonePrototype() const - { - return m_temporalTimeZonePrototype; - } - - Object* getTemporalZonedDateTimePrototype() const - { - return m_temporalZonedDateTimePrototype; - } - - bool isTemporalObject() const override - { - return true; - } - - static Value getOptionsObject(ExecutionState& state, const Value& options) - { - if (options.isObject()) { - return options; - } - - if (!options.isUndefined()) { - ErrorObject::throwBuiltinError(state, ErrorCode::TypeError, "options must be object"); - } - - return {}; - } - - static Value toTemporalOverflow(ExecutionState& state, const Value& normalizedOptions) - { - if (normalizedOptions.isUndefined()) { - return state.context()->staticStrings().lazyConstrain().string(); - } - auto options = normalizedOptions.toObject(state); - Value matcherValues[2] = { state.context()->staticStrings().lazyConstrain().string(), state.context()->staticStrings().reject.string() }; - return Intl::getOption(state, options, state.context()->staticStrings().lazyOverflow().string(), Intl::StringValue, matcherValues, 2, matcherValues[0]); - } - - static Value toTemporalDisambiguation(ExecutionState& state, const Value& options) - { - if (options.isUndefined()) { - return state.context()->staticStrings().lazyConstrain().string(); - } - - Value matcherValues[4] = { state.context()->staticStrings().lazyConstrain().string(), state.context()->staticStrings().lazyEarlier().string(), state.context()->staticStrings().lazyLater().string(), state.context()->staticStrings().reject.string() }; - return Intl::getOption(state, options.asObject(), state.context()->staticStrings().lazyDisambiguation().string(), Intl::StringValue, matcherValues, 4, matcherValues[0]); - } - - static Value toTemporalOffset(ExecutionState& state, const Value& options, const Value& fallback) - { - if (options.isUndefined()) { - return fallback; - } - - Value matcherValues[4] = { state.context()->staticStrings().lazyPrefer().string(), state.context()->staticStrings().lazyUse().string(), state.context()->staticStrings().lazyIgnore().string(), state.context()->staticStrings().reject.string() }; - return Intl::getOption(state, options.asObject(), state.context()->staticStrings().lazyOffset().string(), Intl::StringValue, matcherValues, 4, fallback); - } - - static Value prepareTemporalFields(ExecutionState& state, const Value& fields, const ValueVector& fieldNames, const ValueVector& requiredFields) - { - ASSERT(fields.isObject()); - auto* result = new Object(state); - for (auto& property : fieldNames) { - Value value = fields.asObject()->get(state, ObjectPropertyName(state, property.asString())).value(state, value); - String* prop = property.asString(); - - if (value.isUndefined()) { - if (std::find(requiredFields.begin(), requiredFields.end(), property) != requiredFields.end()) { - ErrorObject::throwBuiltinError(state, ErrorCode::TypeError, new ASCIIString("requiredFields contains property")); - } - - if (prop->equals("year") || prop->equals("month") || prop->equals("monthCode") || prop->equals("day") || prop->equals("offset") || prop->equals("era") || prop->equals("eraYear") || prop->equals("timeZone")) { - value = Value(); - } else { - value = Value(0); - } - } else { - if (!prop->equals("timeZone")) { - if (prop->equals("monthCode") || prop->equals("offset") || prop->equals("era")) { - value = Value(value.toString(state)); - } else if (prop->equals("month") || prop->equals("day")) { - value = Value(value.toUint32(state)); - } else { - value = Value(Value::DoubleToIntConvertibleTestNeeds, value.toInteger(state)); - } - } - } - result->defineOwnProperty(state, ObjectPropertyName(AtomicString(state, property.asString())), ObjectPropertyDescriptor(value, ObjectPropertyDescriptor::AllPresent)); - } - return Value(result); - } - - static void rejectObjectWithCalendarOrTimeZone(ExecutionState& state, const Value& object) - { - ASSERT(object.isObject()); - - if (object.asObject()->isTemporalPlainDateObject() || object.asObject()->isTemporalPlainDateTimeObject() || object.asObject()->isTemporalPlainTimeObject() || object.asObject()->isTemporalZonedDateTimeObject() || object.asObject()->isTemporalPlainYearMonthObject() || object.asObject()->isTemporalMonthDayObject()) { - ErrorObject::throwBuiltinError(state, ErrorCode::TypeError, new ASCIIString("Invalid type of Object")); - } - - if (!object.asObject()->get(state, ObjectPropertyName(state, state.context()->staticStrings().calendar.string())).value(state, object).isUndefined()) { - ErrorObject::throwBuiltinError(state, ErrorCode::TypeError, new ASCIIString("Object has calendar property")); - } - - if (!object.asObject()->get(state, ObjectPropertyName(state, state.context()->staticStrings().lazyTimeZone().string())).value(state, object).isUndefined()) { - ErrorObject::throwBuiltinError(state, ErrorCode::TypeError, new ASCIIString("Object has timezone property")); - } - } - -private: - enum PropertyName { - DISAMBIGUATION - }; - - enum OptionType { - STRING, - BOOL, - NUMBER - }; - Object* m_temporalCalendar; - Object* m_temporalCalendarPrototype; - Object* m_temporalDurationPrototype; - Object* m_temporalPlainDatePrototype; - Object* m_temporalPlainTimePrototype; - Object* m_temporalPlainDateTimePrototype; - Object* m_temporalPlainYearMonthPrototype; - Object* m_temporalInstantPrototype; - Object* m_temporalPlainMonthDayPrototype; - Object* m_temporalTimeZonePrototype; - Object* m_temporalZonedDateTimePrototype; -}; - -} // namespace Escargot - -#endif -#endif diff --git a/src/runtime/TemporalObject.cpp b/src/runtime/TemporalObject.cpp index 67b34460e..e650f622a 100644 --- a/src/runtime/TemporalObject.cpp +++ b/src/runtime/TemporalObject.cpp @@ -30,7 +30,7 @@ TemporalObject::TemporalObject(ExecutionState& state) } TemporalObject::TemporalObject(ExecutionState& state, Object* proto) - : Temporal(state, proto) + : DerivedObject(state, proto) { } @@ -68,29 +68,29 @@ Value TemporalObject::toISOTime(ExecutionState& state, DateObject& d) } -String* TemporalObject::dateTimeUnitString(ExecutionState& state, DateTimeUnits unit) +static String* dateTimeUnitString(ExecutionState& state, TemporalObject::DateTimeUnits unit) { StaticStrings& strings = state.context()->staticStrings(); switch (unit) { - case YEAR_UNIT: + case TemporalObject::YEAR_UNIT: return strings.lazyYear().string(); - case MONTH_UNIT: + case TemporalObject::MONTH_UNIT: return strings.lazyMonth().string(); - case WEEK_UNIT: + case TemporalObject::WEEK_UNIT: return strings.lazyWeek().string(); - case DAY_UNIT: + case TemporalObject::DAY_UNIT: return strings.lazyDay().string(); - case HOUR_UNIT: + case TemporalObject::HOUR_UNIT: return strings.lazyHour().string(); - case MINUTE_UNIT: + case TemporalObject::MINUTE_UNIT: return strings.lazyMinute().string(); - case SECOND_UNIT: + case TemporalObject::SECOND_UNIT: return strings.lazySecond().string(); - case MILLISECOND_UNIT: + case TemporalObject::MILLISECOND_UNIT: return strings.lazyMillisecond().string(); - case MICROSECOND_UNIT: + case TemporalObject::MICROSECOND_UNIT: return strings.lazyMicrosecond().string(); - case NANOSECOND_UNIT: + case TemporalObject::NANOSECOND_UNIT: return strings.lazyNanosecond().string(); default: return String::emptyString; @@ -99,11 +99,16 @@ String* TemporalObject::dateTimeUnitString(ExecutionState& state, DateTimeUnits return String::emptyString; } -std::string TemporalObject::getNNumberFromString(ExecutionState& state, std::string& isoString, const int n, unsigned int& index) +static bool temporalIsNumber(const std::string& s) +{ + return !s.empty() && std::find_if(s.begin(), s.end(), [](unsigned char c) { return !std::isdigit(c); }) == s.end(); +} + +static std::string getNNumberFromString(ExecutionState& state, std::string& isoString, const int n, unsigned int& index) { std::string retVal; - if (!TemporalObject::isNumber(isoString.substr(index, n))) { + if (!temporalIsNumber(isoString.substr(index, n))) { ErrorObject::throwBuiltinError(state, ErrorCode::RangeError, "Invalid ISO string"); } @@ -112,7 +117,7 @@ std::string TemporalObject::getNNumberFromString(ExecutionState& state, std::str return retVal; } -std::map TemporalObject::getSeconds(ExecutionState& state, std::string& isoString, unsigned int& index) +static std::map temporalGetSeconds(ExecutionState& state, std::string& isoString, unsigned int& index) { int counter = index + 1; while (std::isdigit(isoString[counter++])) @@ -131,9 +136,9 @@ std::map TemporalObject::getSeconds(Executio tmp += '0'; } - return { { MILLISECOND_UNIT, std::stoi(tmp.substr(0, 3)) }, - { MICROSECOND_UNIT, std::stoi(tmp.substr(3, 3)) }, - { NANOSECOND_UNIT, std::stoi(tmp.substr(6, 3)) } }; + return { { TemporalObject::MILLISECOND_UNIT, std::stoi(tmp.substr(0, 3)) }, + { TemporalObject::MICROSECOND_UNIT, std::stoi(tmp.substr(3, 3)) }, + { TemporalObject::NANOSECOND_UNIT, std::stoi(tmp.substr(6, 3)) } }; } std::string TemporalObject::offset(ExecutionState& state, std::string& isoString, unsigned int& index) @@ -187,7 +192,7 @@ std::string TemporalObject::offset(ExecutionState& state, std::string& isoString return ""; } unsigned int start = index; - TemporalObject::getSeconds(state, isoString, index); + temporalGetSeconds(state, isoString, index); result += isoString.substr(start, index - start + 1); for (unsigned int i = 0; i < 9 - (index - start); i++) { result += '0'; @@ -201,7 +206,7 @@ std::string TemporalObject::offset(ExecutionState& state, std::string& isoString return result; } -std::string TemporalObject::tzComponent(ExecutionState& state, std::string& isoString, unsigned int& index) +static std::string temporalTZComponent(ExecutionState& state, std::string& isoString, unsigned int& index) { std::string timeZoneID; unsigned int i = 0; @@ -233,13 +238,66 @@ std::string TemporalObject::tzComponent(ExecutionState& state, std::string& isoS return timeZoneID; } -TemporalObject::DateTime TemporalObject::parseValidIso8601String(ExecutionState& state, std::string isoString, const bool parseTimeZone = false) +static TemporalObject::TimeZone parseTimeZoneOffset(ExecutionState& state, std::string& isoString, unsigned int& index) +{ + // Offset + auto tz = TemporalObject::TimeZone(false, String::emptyString, String::emptyString); + + if (isoString[index] == 'z' || isoString[index] == 'Z') { + tz.z = true; + ++index; + } else if (isoString[index] == '+' || isoString[index] == '-' || isoString.rfind("−", index) == index) { + tz.offsetString = new ASCIIString(TemporalObject::offset(state, isoString, index).c_str()); + + if (tz.offsetString->length() == 0) { + return TemporalObject::TimeZone{ false, nullptr, nullptr }; + } + } + + // TimeZone + if (isoString[index] == '[' && isoString.rfind("[u-ca=", index) != index) { + std::string tmp = temporalTZComponent(state, isoString, index); + while (tmp.length() != 0) { + tz.name = new ASCIIString(std::string(tz.name->toNonGCUTF8StringData()).append(tmp).c_str()); + + if (isoString[index] == '/') { + tmp = temporalTZComponent(state, isoString, index); + } + + if (isoString[index] == ']') { + tz.name = new ASCIIString(std::string(tz.name->toNonGCUTF8StringData()).append("/" + tmp).c_str()); + index++; + break; + } + } + } else if (isoString.rfind("Etc/GMT", index) == 0) { + index += 7; + + if (isoString[index] == '+' || isoString[index] == '-') { + if (!std::isdigit(isoString[index + 1])) { + return TemporalObject::TimeZone{ false, nullptr, nullptr }; + } + + if (temporalIsNumber(isoString.substr(index + 1, 2))) { + index += 3; + } + + index += 2; + } + } else if (isoString[index] == '+' || isoString[index] == '-' || (index < isoString.length() && isoString.rfind("−", index) == 0)) { + TemporalObject::offset(state, isoString, index); + } + + return tz; +} + +static TemporalObject::DateTime parseValidIso8601String(ExecutionState& state, std::string isoString, const bool parseTimeZone = false) { if (isoString.empty()) { ErrorObject::throwBuiltinError(state, ErrorCode::TypeError, "Invalid ISO string"); } - DateTime dateTime = { 0, 1, 1, 0, 0, 0, 0, 0, 0, String::emptyString, new TimeZone(false, String::emptyString, String::emptyString) }; + TemporalObject::DateTime dateTime = { 0, 1, 1, 0, 0, 0, 0, 0, 0, String::emptyString, new TemporalObject::TimeZone(false, String::emptyString, String::emptyString) }; unsigned int index = 0; @@ -248,10 +306,10 @@ TemporalObject::DateTime TemporalObject::parseValidIso8601String(ExecutionState& if (isoString.at(index) != 'T' && isoString.find('-') != std::string::npos) { // Date bool monthDay = false; - if (isoString.rfind("−", index) == 0 && TemporalObject::isNumber(isoString.substr(3 + index, 4))) { + if (isoString.rfind("−", index) == 0 && temporalIsNumber(isoString.substr(3 + index, 4))) { dateTime.year = std::stoi("-" + isoString.substr(3 + index, 4)); index += 7; - } else if (TemporalObject::isNumber(isoString.substr(index, 4))) { + } else if (temporalIsNumber(isoString.substr(index, 4))) { dateTime.year = std::stoi(isoString.substr(0, 4)); index += 4; } else if (isoString.rfind("--", 0) == 0) { @@ -302,36 +360,36 @@ TemporalObject::DateTime TemporalObject::parseValidIso8601String(ExecutionState& ; } if (isoString.find(':') != std::string::npos) { - dateTime.hour = std::stoi(TemporalObject::getNNumberFromString(state, isoString, 2, index)); + dateTime.hour = std::stoi(getNNumberFromString(state, isoString, 2, index)); if (isoString.at(index) == ':') { ++index; } - dateTime.minute = std::stoi(TemporalObject::getNNumberFromString(state, isoString, 2, index)); + dateTime.minute = std::stoi(getNNumberFromString(state, isoString, 2, index)); if (isoString.at(index) == ':') { ++index; - dateTime.second = std::stoi(TemporalObject::getNNumberFromString(state, isoString, 2, index)); + dateTime.second = std::stoi(getNNumberFromString(state, isoString, 2, index)); } - if (TemporalObject::isNumber(isoString.substr(index, 2))) { - dateTime.second = std::stoi(TemporalObject::getNNumberFromString(state, isoString, 2, index)); + if (temporalIsNumber(isoString.substr(index, 2))) { + dateTime.second = std::stoi(getNNumberFromString(state, isoString, 2, index)); } if (isoString.at(index) == '.' || isoString.at(index) == ',') { std::map seconds; - seconds = TemporalObject::getSeconds(state, isoString, index); - dateTime.millisecond = seconds[MILLISECOND_UNIT]; - dateTime.microsecond = seconds[MICROSECOND_UNIT]; - dateTime.nanosecond = seconds[NANOSECOND_UNIT]; + seconds = temporalGetSeconds(state, isoString, index); + dateTime.millisecond = seconds[TemporalObject::MILLISECOND_UNIT]; + dateTime.microsecond = seconds[TemporalObject::MICROSECOND_UNIT]; + dateTime.nanosecond = seconds[TemporalObject::NANOSECOND_UNIT]; } } - auto timeZoneOffset = TemporalObject::parseTimeZoneOffset(state, isoString, index); + auto timeZoneOffset = parseTimeZoneOffset(state, isoString, index); if (parseTimeZone && timeZoneOffset.offsetString && timeZoneOffset.name) { - dateTime.tz = new TimeZone{ timeZoneOffset.z, timeZoneOffset.offsetString, timeZoneOffset.name }; + dateTime.tz = new TemporalObject::TimeZone{ timeZoneOffset.z, timeZoneOffset.offsetString, timeZoneOffset.name }; } else if (!(timeZoneOffset.offsetString && timeZoneOffset.name)) { ErrorObject::throwBuiltinError(state, ErrorCode::RangeError, "Invalid ISO string"); } @@ -394,20 +452,20 @@ TemporalObject::DateTime TemporalObject::parseValidIso8601String(ExecutionState& return dateTime; } -TemporalObject::DateTime TemporalObject::parseTemporalDateString(ExecutionState& state, const std::string& isoString) -{ - return TemporalObject::parseTemporalDateTimeString(state, isoString); -} - -TemporalObject::DateTime TemporalObject::parseTemporalDateTimeString(ExecutionState& state, const std::string& isoString) +static TemporalObject::DateTime parseTemporalDateTimeString(ExecutionState& state, const std::string& isoString) { if (isoString.find('z') != std::string::npos || isoString.find('Z') != std::string::npos) { ErrorObject::throwBuiltinError(state, ErrorCode::RangeError, "isoString contains UTCDesignator"); } - return TemporalObject::parseValidIso8601String(state, isoString); + return parseValidIso8601String(state, isoString); +} + +static TemporalObject::DateTime parseTemporalDateString(ExecutionState& state, const std::string& isoString) +{ + return parseTemporalDateTimeString(state, isoString); } -std::map TemporalObject::parseTemporalDurationString(ExecutionState& state, const std::string& isoString) +static std::map parseTemporalDurationString(ExecutionState& state, const std::string& isoString) { int sign = 1; unsigned int index = 0; @@ -560,12 +618,12 @@ std::map TemporalObject::parseTemporalDurati return TemporalDurationObject::createDurationRecord(state, years * sign, months * sign, weeks * sign, days * sign, hours * sign, std::floor(minutesMV) * sign, std::floor(secondsMV) * sign, std::floor(milliSecondsMV) * sign, std::floor(microSecondsMV) * sign, std::floor(nanoSecondsMV) * sign); } -TemporalObject::DateTime TemporalObject::parseTemporalYearMonthString(ExecutionState& state, const std::string& isoString) +static TemporalObject::DateTime parseTemporalYearMonthString(ExecutionState& state, const std::string& isoString) { - return TemporalObject::parseTemporalDateTimeString(state, isoString); + return parseTemporalDateTimeString(state, isoString); } -TemporalObject::DateTime TemporalObject::parseTemporalInstantString(ExecutionState& state, const std::string& isoString) +static TemporalObject::DateTime parseTemporalInstantString(ExecutionState& state, const std::string& isoString) { auto result = parseValidIso8601String(state, isoString, true); @@ -580,9 +638,9 @@ TemporalObject::DateTime TemporalObject::parseTemporalInstantString(ExecutionSta return result; } -TemporalObject::TimeZone TemporalObject::parseTemporalTimeZoneString(ExecutionState& state, const std::string& isoString) +static TemporalObject::TimeZone parseTemporalTimeZoneString(ExecutionState& state, const std::string& isoString) { - auto result = TimeZone(false, String::emptyString, String::emptyString); + auto result = TemporalObject::TimeZone(false, String::emptyString, String::emptyString); if (isoString == "UTC") { result.z = true; @@ -594,10 +652,10 @@ TemporalObject::TimeZone TemporalObject::parseTemporalTimeZoneString(ExecutionSt } unsigned int index = 0; - result = TemporalObject::parseTimeZoneOffset(state, const_cast(isoString), index); + result = parseTimeZoneOffset(state, const_cast(isoString), index); if (!(result.offsetString && result.name) || (result.offsetString->length() == 0 && result.name->length() == 0 && !result.z)) { - result = *TemporalObject::parseValidIso8601String(state, isoString, true).tz; + result = *parseValidIso8601String(state, isoString, true).tz; } if (result.z) { @@ -611,67 +669,48 @@ TemporalObject::TimeZone TemporalObject::parseTemporalTimeZoneString(ExecutionSt return result; } -TemporalObject::TimeZone TemporalObject::parseTimeZoneOffset(ExecutionState& state, std::string& isoString, unsigned int& index) +static TemporalObject::DateTime parseTemporalZonedDateTimeString(ExecutionState& state, const std::string& isoString) { - // Offset - auto tz = TimeZone(false, String::emptyString, String::emptyString); - - if (isoString[index] == 'z' || isoString[index] == 'Z') { - tz.z = true; - ++index; - } else if (isoString[index] == '+' || isoString[index] == '-' || isoString.rfind("−", index) == index) { - tz.offsetString = new ASCIIString(TemporalObject::offset(state, isoString, index).c_str()); - - if (tz.offsetString->length() == 0) { - return TemporalObject::TimeZone{ false, nullptr, nullptr }; - } - } - - // TimeZone - if (isoString[index] == '[' && isoString.rfind("[u-ca=", index) != index) { - std::string tmp = TemporalObject::tzComponent(state, isoString, index); - while (tmp.length() != 0) { - tz.name = new ASCIIString(std::string(tz.name->toNonGCUTF8StringData()).append(tmp).c_str()); + return parseValidIso8601String(state, isoString, true); +} - if (isoString[index] == '/') { - tmp = TemporalObject::tzComponent(state, isoString, index); - } +static TemporalObject::DateTime parseTemporalMonthDayString(ExecutionState& state, const std::string& isoString) +{ + return parseTemporalDateTimeString(state, isoString); +} - if (isoString[index] == ']') { - tz.name = new ASCIIString(std::string(tz.name->toNonGCUTF8StringData()).append("/" + tmp).c_str()); - index++; - break; +static Value prepareTemporalFields(ExecutionState& state, const Value& fields, const ValueVector& fieldNames, const ValueVector& requiredFields) +{ + ASSERT(fields.isObject()); + auto* result = new Object(state); + for (auto& property : fieldNames) { + Value value = fields.asObject()->get(state, ObjectPropertyName(state, property.asString())).value(state, value); + String* prop = property.asString(); + + if (value.isUndefined()) { + if (std::find(requiredFields.begin(), requiredFields.end(), property) != requiredFields.end()) { + ErrorObject::throwBuiltinError(state, ErrorCode::TypeError, new ASCIIString("requiredFields contains property")); } - } - } else if (isoString.rfind("Etc/GMT", index) == 0) { - index += 7; - if (isoString[index] == '+' || isoString[index] == '-') { - if (!std::isdigit(isoString[index + 1])) { - return TemporalObject::TimeZone{ false, nullptr, nullptr }; + if (prop->equals("year") || prop->equals("month") || prop->equals("monthCode") || prop->equals("day") || prop->equals("offset") || prop->equals("era") || prop->equals("eraYear") || prop->equals("timeZone")) { + value = Value(); + } else { + value = Value(0); } - - if (isNumber(isoString.substr(index + 1, 2))) { - index += 3; + } else { + if (!prop->equals("timeZone")) { + if (prop->equals("monthCode") || prop->equals("offset") || prop->equals("era")) { + value = Value(value.toString(state)); + } else if (prop->equals("month") || prop->equals("day")) { + value = Value(value.toUint32(state)); + } else { + value = Value(Value::DoubleToIntConvertibleTestNeeds, value.toInteger(state)); + } } - - index += 2; } - } else if (isoString[index] == '+' || isoString[index] == '-' || (index < isoString.length() && isoString.rfind("−", index) == 0)) { - TemporalObject::offset(state, isoString, index); + result->defineOwnProperty(state, ObjectPropertyName(AtomicString(state, property.asString())), ObjectPropertyDescriptor(value, ObjectPropertyDescriptor::AllPresent)); } - - return tz; -} - -TemporalObject::DateTime TemporalObject::parseTemporalZonedDateTimeString(ExecutionState& state, const std::string& isoString) -{ - return TemporalObject::parseValidIso8601String(state, isoString, true); -} - -TemporalObject::DateTime TemporalObject::parseTemporalMonthDayString(ExecutionState& state, const std::string& isoString) -{ - return parseTemporalDateTimeString(state, isoString); + return Value(result); } TemporalPlainTimeObject::TemporalPlainTimeObject(ExecutionState& state, Object* proto, const TemporalTime& time, TemporalCalendarObject* calendar) @@ -681,7 +720,7 @@ TemporalPlainTimeObject::TemporalPlainTimeObject(ExecutionState& state, Object* { } -Value TemporalObject::toRelativeTemporalObject(ExecutionState& state, Object* options) +static Value toRelativeTemporalObject(ExecutionState& state, Object* options) { auto value = options->get(state, ObjectPropertyName(state.context()->staticStrings().lazyRelativeTo())).value(state, options); @@ -722,7 +761,7 @@ Value TemporalObject::toRelativeTemporalObject(ExecutionState& state, Object* op Value(state.context()->staticStrings().lazySecond().string()), Value(state.context()->staticStrings().lazyYear().string()) }; ValueVector fieldNames = TemporalCalendarObject::calendarFields(state, calendar, values); - Value fields = Temporal::prepareTemporalFields(state, value, fieldNames, ValueVector()); + Value fields = prepareTemporalFields(state, value, fieldNames, ValueVector()); result = TemporalPlainDateTimeObject::interpretTemporalDateTimeFields(state, calendar, fields, options); offsetString = valueObject->get(state, ObjectPropertyName(state.context()->staticStrings().lazyOffset())).value(state, value); @@ -736,7 +775,7 @@ Value TemporalObject::toRelativeTemporalObject(ExecutionState& state, Object* op offsetBehaviour = TemporalZonedDateTimeObject::WALL; } } else { - auto parseResult = TemporalObject::parseTemporalZonedDateTimeString(state, value.asString()->toNonGCUTF8StringData()); + auto parseResult = parseTemporalZonedDateTimeString(state, value.asString()->toNonGCUTF8StringData()); calendar = TemporalCalendarObject::toTemporalCalendarWithISODefault(state, Value((parseResult.calendar))); if (parseResult.tz->name->length() != 0) { @@ -782,7 +821,7 @@ Value TemporalObject::toRelativeTemporalObject(ExecutionState& state, Object* op return TemporalPlainDateObject::createTemporalDate(state, result[TemporalObject::YEAR_UNIT], result[TemporalObject::MONTH_UNIT], result[TemporalObject::DAY_UNIT], calendar); } -Object* TemporalObject::mergeLargestUnitOption(ExecutionState& state, const Value& option, TemporalObject::DateTimeUnits largestUnit) +static Object* mergeLargestUnitOption(ExecutionState& state, const Value& option, TemporalObject::DateTimeUnits largestUnit) { auto merged = new Object(state, Object::PrototypeIsNull); @@ -796,17 +835,7 @@ Object* TemporalObject::mergeLargestUnitOption(ExecutionState& state, const Valu return merged; } -// The rounding modes accepted by this abstract operation are intended to be the same as whatever is eventually standardized in the Intl.NumberFormat V3 proposal. -BigInt* TemporalObject::roundNumberToIncrementAsIfPositive(ExecutionState& state, BigInt* x, int64_t increment, RoundingMode roundingMode) -{ - BigInt* quotient = x->division(state, new BigInt(increment)); - UnsignedRoundingMode unsignedRoundingMode = TemporalObject::getUnsignedRoundingMode(state, roundingMode, false); - BigInt* r1 = quotient->addition(state, new BigInt((int64_t)0)); - BigInt* r2 = quotient->addition(state, new BigInt((int64_t)1)); - return TemporalObject::applyUnsignedRoundingMode(state, quotient, r1, r2, unsignedRoundingMode)->multiply(state, new BigInt(increment)); -} - -UnsignedRoundingMode TemporalObject::getUnsignedRoundingMode(ExecutionState& state, RoundingMode roundingMode, bool isNegative) +static UnsignedRoundingMode getUnsignedRoundingMode(ExecutionState& state, RoundingMode roundingMode, bool isNegative) { if (roundingMode == RoundingMode::HALF_EVEN) { return UNSIGNED_HALF_EVEN; @@ -819,7 +848,7 @@ UnsignedRoundingMode TemporalObject::getUnsignedRoundingMode(ExecutionState& sta return positiveUnsignedRoundingMode[roundingMode]; } -BigInt* TemporalObject::applyUnsignedRoundingMode(ExecutionState& state, BigInt* x, BigInt* r1, BigInt* r2, UnsignedRoundingMode unsignedRoundingMode) +BigInt* applyUnsignedRoundingMode(ExecutionState& state, BigInt* x, BigInt* r1, BigInt* r2, UnsignedRoundingMode unsignedRoundingMode) { if (x->equals(r1)) { return r1; @@ -867,22 +896,32 @@ BigInt* TemporalObject::applyUnsignedRoundingMode(ExecutionState& state, BigInt* return r2; } -int64_t TemporalObject::floor(double num) +// The rounding modes accepted by this abstract operation are intended to be the same as whatever is eventually standardized in the Intl.NumberFormat V3 proposal. +static BigInt* roundNumberToIncrementAsIfPositive(ExecutionState& state, BigInt* x, int64_t increment, RoundingMode roundingMode) +{ + BigInt* quotient = x->division(state, new BigInt(increment)); + UnsignedRoundingMode unsignedRoundingMode = getUnsignedRoundingMode(state, roundingMode, false); + BigInt* r1 = quotient->addition(state, new BigInt((int64_t)0)); + BigInt* r2 = quotient->addition(state, new BigInt((int64_t)1)); + return applyUnsignedRoundingMode(state, quotient, r1, r2, unsignedRoundingMode)->multiply(state, new BigInt(increment)); +} + +static int64_t temporalFloor(double num) { return (num < 0 ? -1 : 1) * std::ceil(std::abs(num)); } -int64_t TemporalObject::modulo(int64_t num1, int64_t num2) +static int64_t temporalModulo(int64_t num1, int64_t num2) { - return num1 -= TemporalObject::floor(num1 / (double)num2); + return num1 -= temporalFloor(num1 / (double)num2); } Value TemporalPlainTimeObject::createTemporalTime(ExecutionState& state, int hour, int minute, int second, int millisecond, int microsecond, int nanosecond, Optional newTarget) { TemporalTime time(hour, minute, second, millisecond, microsecond, nanosecond); - TemporalCalendarObject* calendar = new TemporalCalendarObject(state, state.context()->globalObject()->temporal()->asTemporalObject()->getTemporalCalendarPrototype(), state.context()->staticStrings().lazyISO8601().string()); + TemporalCalendarObject* calendar = new TemporalCalendarObject(state, state.context()->globalObject()->temporalCalendarPrototype(), state.context()->staticStrings().lazyISO8601().string()); - return new TemporalPlainTimeObject(state, state.context()->globalObject()->temporal()->asTemporalObject()->getTemporalPlainTimePrototype(), time, calendar); + return new TemporalPlainTimeObject(state, state.context()->globalObject()->temporalPlainTimePrototype(), time, calendar); } Value TemporalPlainTimeObject::createFromPlainDateTimeObject(ExecutionState& state, TemporalPlainDateTimeObject* plainDateTime) @@ -903,17 +942,17 @@ std::map TemporalPlainTimeObject::balanceTim { std::map result; - result[TemporalObject::MICROSECOND_UNIT] = microsecond + TemporalObject::floor(nanosecond / 1000.0); + result[TemporalObject::MICROSECOND_UNIT] = microsecond + temporalFloor(nanosecond / 1000.0); result[TemporalObject::NANOSECOND_UNIT] = nanosecond < 0 ? 1000 + nanosecond % 1000 : nanosecond % 1000; - result[TemporalObject::MILLISECOND_UNIT] = millisecond + TemporalObject::floor(result[TemporalObject::MICROSECOND_UNIT] / 1000); - result[TemporalObject::MICROSECOND_UNIT] = TemporalObject::modulo(result[TemporalObject::MICROSECOND_UNIT], 1000); - result[TemporalObject::SECOND_UNIT] = second + TemporalObject::floor(result[TemporalObject::MILLISECOND_UNIT] / 1000); + result[TemporalObject::MILLISECOND_UNIT] = millisecond + temporalFloor(result[TemporalObject::MICROSECOND_UNIT] / 1000); + result[TemporalObject::MICROSECOND_UNIT] = temporalModulo(result[TemporalObject::MICROSECOND_UNIT], 1000); + result[TemporalObject::SECOND_UNIT] = second + temporalFloor(result[TemporalObject::MILLISECOND_UNIT] / 1000); result[TemporalObject::MILLISECOND_UNIT] %= 1000; - result[TemporalObject::MINUTE_UNIT] = minute + TemporalObject::floor(result[TemporalObject::SECOND_UNIT] / 60); + result[TemporalObject::MINUTE_UNIT] = minute + temporalFloor(result[TemporalObject::SECOND_UNIT] / 60); result[TemporalObject::SECOND_UNIT] %= 60; - result[TemporalObject::HOUR_UNIT] = hour + TemporalObject::floor(result[TemporalObject::MINUTE_UNIT] / 60); + result[TemporalObject::HOUR_UNIT] = hour + temporalFloor(result[TemporalObject::MINUTE_UNIT] / 60); result[TemporalObject::MINUTE_UNIT] %= 60; - result[TemporalObject::DAY_UNIT] = TemporalObject::floor(result[TemporalObject::HOUR_UNIT] / 24); + result[TemporalObject::DAY_UNIT] = temporalFloor(result[TemporalObject::HOUR_UNIT] / 24); result[TemporalObject::HOUR_UNIT] %= 24; return result; @@ -958,8 +997,8 @@ Value TemporalPlainTimeObject::toTemporalTime(ExecutionState& state, const Value return TemporalPlainTimeObject::createTemporalTime(state, result[TemporalObject::HOUR_UNIT], result[TemporalObject::MINUTE_UNIT], result[TemporalObject::SECOND_UNIT], result[TemporalObject::MILLISECOND_UNIT], result[TemporalObject::MICROSECOND_UNIT], result[TemporalObject::NANOSECOND_UNIT], nullptr); } - Temporal::toTemporalOverflow(state, options); - auto tmp = TemporalObject::parseTemporalDateTimeString(state, item.asString()->toNonGCUTF8StringData()); + TemporalObject::toTemporalOverflow(state, options); + auto tmp = parseTemporalDateTimeString(state, item.asString()->toNonGCUTF8StringData()); ASSERT(TemporalPlainTimeObject::isValidTime(state, tmp.hour, tmp.minute, tmp.second, tmp.millisecond, tmp.microsecond, tmp.nanosecond)); if (tmp.calendar->length() != 0 && !tmp.calendar->equals("iso8601")) { @@ -981,16 +1020,16 @@ std::map TemporalPlainTimeObject::toTemporal Value(state.context()->staticStrings().lazyMinute().string()), Value(state.context()->staticStrings().lazyNanosecond().string()), Value(state.context()->staticStrings().lazySecond().string()) }; - Value partial = TemporalCalendarObject::prepareTemporalFields(state, temporalTimeLike, values, {}); + Value partial = prepareTemporalFields(state, temporalTimeLike, values, {}); for (auto i : temporalTimeLikeProp) { - ObjectHasPropertyResult objectHasPropertyResult = partial.asObject()->hasProperty(state, ObjectPropertyName(state, TemporalObject::dateTimeUnitString(state, i))); + ObjectHasPropertyResult objectHasPropertyResult = partial.asObject()->hasProperty(state, ObjectPropertyName(state, dateTimeUnitString(state, i))); if (!objectHasPropertyResult.hasProperty()) { ErrorObject::throwBuiltinError(state, ErrorCode::RangeError, "any is false"); } - Value value = objectHasPropertyResult.value(state, ObjectPropertyName(state, TemporalObject::dateTimeUnitString(state, i)), partial); + Value value = objectHasPropertyResult.value(state, ObjectPropertyName(state, dateTimeUnitString(state, i)), partial); if (!value.isInt32() || (value.isDouble() && !std::isfinite(value.asDouble()))) { ErrorObject::throwBuiltinError(state, ErrorCode::RangeError, "any is false"); @@ -1045,7 +1084,7 @@ std::map TemporalPlainTimeObject::toPartia bool any = false; for (auto i : temporalTimeLikeProp) { - Value value = temporalTimeLike.asObject()->get(state, ObjectPropertyName(state, TemporalObject::dateTimeUnitString(state, i))).value(state, temporalTimeLike); + Value value = temporalTimeLike.asObject()->get(state, ObjectPropertyName(state, dateTimeUnitString(state, i))).value(state, temporalTimeLike); if (!value.isUndefined()) { any = true; @@ -1114,7 +1153,7 @@ TemporalCalendarObject* TemporalCalendarObject::createTemporalCalendar(Execution { ASSERT(TemporalCalendarObject::isBuiltinCalendar(id)); - return new TemporalCalendarObject(state, state.context()->globalObject()->temporal()->asTemporalObject()->getTemporalCalendarPrototype(), id); + return new TemporalCalendarObject(state, state.context()->globalObject()->temporalCalendarPrototype(), id); } Value TemporalCalendarObject::getBuiltinCalendar(ExecutionState& state, String* id) @@ -1178,7 +1217,7 @@ Value TemporalCalendarObject::parseTemporalCalendarString(ExecutionState& state, if (isoString.asString()->equals(String::emptyString)) { return Value(state.context()->staticStrings().lazyISO8601().string()); } - TemporalObject::DateTime time = TemporalObject::parseValidIso8601String(state, isoString.asString()->toNonGCUTF8StringData()); + TemporalObject::DateTime time = parseValidIso8601String(state, isoString.asString()->toNonGCUTF8StringData()); return time.calendar->length() == 0 ? Value(state.context()->staticStrings().lazyISO8601().string()) : Value(time.calendar); } @@ -1452,10 +1491,10 @@ std::map TemporalCalendarObject::ISODateFrom { ASSERT(fields.isObject()); - auto overflow = Temporal::toTemporalOverflow(state, options); + auto overflow = TemporalObject::toTemporalOverflow(state, options); ValueVector fieldNames = { Value(state.context()->staticStrings().lazyDay().string()), Value(state.context()->staticStrings().lazyMonth().string()), Value(state.context()->staticStrings().lazyMonthCode().string()), Value(state.context()->staticStrings().lazyYear().string()) }; ValueVector requiredFields = { Value(state.context()->staticStrings().lazyDay().string()), Value(state.context()->staticStrings().lazyYear().string()) }; - fields = Temporal::prepareTemporalFields(state, fields, fieldNames, requiredFields); + fields = prepareTemporalFields(state, fields, fieldNames, requiredFields); auto year = fields.asObject()->get(state, ObjectPropertyName(state, state.context()->staticStrings().lazyYear().string())).value(state, fields); ASSERT(year.isNumber()); int month = TemporalCalendarObject::resolveISOMonth(state, fields); @@ -1591,7 +1630,7 @@ Value TemporalPlainDateObject::createTemporalDate(ExecutionState& state, const i } TemporalDate date(isoYear, isoMonth, isoDay); - return new TemporalPlainDateObject(state, state.context()->globalObject()->temporal()->asTemporalObject()->getTemporalPlainDatePrototype(), date, calendar.asObject()->asTemporalCalendarObject()); + return new TemporalPlainDateObject(state, state.context()->globalObject()->temporalPlainDatePrototype(), date, calendar.asObject()->asTemporalCalendarObject()); } Value TemporalPlainDateObject::createFromPlainDateTimeObject(ExecutionState& state, TemporalPlainDateTimeObject* plainDateTime) @@ -1608,7 +1647,7 @@ Value TemporalPlainDateObject::toTemporalDate(ExecutionState& state, const Value ASSERT(options->isObject()); if (item.isObject()) { - Temporal* tItem = item.asObject()->asTemporalObject(); + TemporalObject* tItem = item.asObject()->asTemporalObject(); if (tItem->isTemporalPlainDateObject()) { return item; @@ -1632,12 +1671,12 @@ Value TemporalPlainDateObject::toTemporalDate(ExecutionState& state, const Value Value(state.context()->staticStrings().lazyYear().string()) }; ValueVector fieldNames = TemporalCalendarObject::calendarFields(state, calendar, ValueVector()); - Value fields = Temporal::prepareTemporalFields(state, item, fieldNames, ValueVector()); + Value fields = prepareTemporalFields(state, item, fieldNames, ValueVector()); return TemporalCalendarObject::dateFromFields(state, calendar, fields, options.value()); } - Temporal::toTemporalOverflow(state, options.value()); - auto result = TemporalObject::parseTemporalDateString(state, item.toString(state)->toNonGCUTF8StringData()); + TemporalObject::toTemporalOverflow(state, options.value()); + auto result = parseTemporalDateString(state, item.toString(state)->toNonGCUTF8StringData()); ASSERT(TemporalPlainDateObject::isValidISODate(state, result.year, result.month, result.day)); return TemporalPlainDateObject::createTemporalDate(state, result.year, result.month, result.day, @@ -1773,7 +1812,7 @@ Value TemporalPlainDateTimeObject::createTemporalDateTime(ExecutionState& state, TemporalDate date(isoYear, isoMonth, isoDay); TemporalTime time(hour, minute, second, millisecond, microsecond, nanosecond); - return new TemporalPlainDateTimeObject(state, state.context()->globalObject()->temporal()->asTemporalObject()->getTemporalPlainDateTimePrototype(), date, time, calendar.asObject()->asTemporalCalendarObject()); + return new TemporalPlainDateTimeObject(state, state.context()->globalObject()->temporalPlainDateTimePrototype(), date, time, calendar.asObject()->asTemporalCalendarObject()); } Value TemporalPlainDateTimeObject::createFromPlainDateObject(ExecutionState& state, TemporalPlainDateObject* plainDate) @@ -1785,7 +1824,7 @@ Value TemporalPlainDateTimeObject::createFromPlainDateObject(ExecutionState& sta std::map TemporalPlainDateTimeObject::interpretTemporalDateTimeFields(ExecutionState& state, const Value& calendar, const Value& fields, const Value& options) { auto timeResult = TemporalPlainTimeObject::toTemporalTimeRecord(state, fields); - auto overFlow = Temporal::toTemporalOverflow(state, options); + auto overFlow = TemporalObject::toTemporalOverflow(state, options); auto temporalDate = TemporalCalendarObject::dateFromFields(state, calendar, fields, options).asObject()->asTemporalPlainDateObject(); timeResult = TemporalPlainTimeObject::regulateTime(state, timeResult[TemporalObject::HOUR_UNIT], timeResult[TemporalObject::MINUTE_UNIT], timeResult[TemporalObject::SECOND_UNIT], timeResult[TemporalObject::MILLISECOND_UNIT], timeResult[TemporalObject::MICROSECOND_UNIT], timeResult[TemporalObject::NANOSECOND_UNIT], overFlow); timeResult[TemporalObject::YEAR_UNIT] = temporalDate->year(); @@ -1823,12 +1862,12 @@ Value TemporalPlainDateTimeObject::toTemporalDateTime(ExecutionState& state, con Value(state.context()->staticStrings().lazySecond().string()), Value(state.context()->staticStrings().lazyYear().string()) }; ValueVector fieldNames = TemporalCalendarObject::calendarFields(state, calendar, values); - Value fields = Temporal::prepareTemporalFields(state, item, fieldNames, ValueVector()); + Value fields = prepareTemporalFields(state, item, fieldNames, ValueVector()); result = TemporalPlainDateTimeObject::interpretTemporalDateTimeFields(state, calendar, fields, options); return TemporalPlainDateTimeObject::createTemporalDateTime(state, result[TemporalObject::YEAR_UNIT], result[TemporalObject::MONTH_UNIT], result[TemporalObject::DAY_UNIT], result[TemporalObject::HOUR_UNIT], result[TemporalObject::MINUTE_UNIT], result[TemporalObject::SECOND_UNIT], result[TemporalObject::MILLISECOND_UNIT], result[TemporalObject::MICROSECOND_UNIT], result[TemporalObject::NANOSECOND_UNIT], calendar, new Object(state)); } - Temporal::toTemporalOverflow(state, options); - auto tmp = TemporalObject::parseTemporalDateTimeString(state, item.toString(state)->toNonGCUTF8StringData()); + TemporalObject::toTemporalOverflow(state, options); + auto tmp = parseTemporalDateTimeString(state, item.toString(state)->toNonGCUTF8StringData()); ASSERT(TemporalPlainDateObject::isValidISODate(state, tmp.year, tmp.month, tmp.day)); ASSERT(TemporalPlainTimeObject::isValidTime(state, tmp.hour, tmp.minute, tmp.second, tmp.millisecond, tmp.microsecond, tmp.nanosecond)); @@ -1852,7 +1891,7 @@ Value TemporalPlainDateTimeObject::addDurationToOrSubtractDurationFromPlainDateT auto durationObject = TemporalDurationObject::toTemporalDuration(state, temporalDurationLike).asObject()->asTemporalDurationObject(); std::map time = { { TemporalObject::YEAR_UNIT, temporalDateTime->getYear() }, { TemporalObject::MONTH_UNIT, temporalDateTime->getMonth() }, { TemporalObject::DAY_UNIT, temporalDateTime->getDay() }, { TemporalObject::HOUR_UNIT, temporalDateTime->getHour() }, { TemporalObject::MINUTE_UNIT, temporalDateTime->getMinute() }, { TemporalObject::SECOND_UNIT, temporalDateTime->getSecond() }, { TemporalObject::MILLISECOND_UNIT, temporalDateTime->getMillisecond() }, { TemporalObject::MICROSECOND_UNIT, temporalDateTime->getMicrosecond() }, { TemporalObject::NANOSECOND_UNIT, temporalDateTime->getNanosecond() } }; std::map duration = { { TemporalObject::YEAR_UNIT, operation * durationObject->getYear() }, { TemporalObject::MONTH_UNIT, operation * durationObject->getMonth() }, { TemporalObject::WEEK_UNIT, operation * durationObject->getWeek() }, { TemporalObject::DAY_UNIT, operation * durationObject->getDay() }, { TemporalObject::HOUR_UNIT, operation * durationObject->getHour() }, { TemporalObject::MINUTE_UNIT, operation * durationObject->getMinute() }, { TemporalObject::SECOND_UNIT, operation * durationObject->getMinute() }, { TemporalObject::MILLISECOND_UNIT, operation * durationObject->getMillisecond() }, { TemporalObject::MICROSECOND_UNIT, operation * durationObject->getMicrosecond() }, { TemporalObject::NANOSECOND_UNIT, operation * durationObject->getNanosecond() } }; - auto result = TemporalPlainDateTimeObject::addDateTime(state, time, temporalDateTime->getCalendar(), duration, Temporal::getOptionsObject(state, options).asObject()); + auto result = TemporalPlainDateTimeObject::addDateTime(state, time, temporalDateTime->getCalendar(), duration, TemporalObject::getOptionsObject(state, options).asObject()); if (!TemporalPlainDateObject::isValidISODate(state, result[TemporalObject::YEAR_UNIT], result[TemporalObject::MONTH_UNIT], result[TemporalObject::DAY_UNIT]) || !TemporalPlainTimeObject::isValidTime(state, result[TemporalObject::HOUR_UNIT], result[TemporalObject::MINUTE_UNIT], result[TemporalObject::SECOND_UNIT], result[TemporalObject::MILLISECOND_UNIT], result[TemporalObject::MICROSECOND_UNIT], result[TemporalObject::NANOSECOND_UNIT])) { ErrorObject::throwBuiltinError(state, ErrorCode::RangeError, "Invalid date or time"); @@ -1884,7 +1923,7 @@ std::map TemporalPlainDateTimeObject::differ TemporalPlainDateObject* date1 = TemporalPlainDateObject::createTemporalDate(state, adjustedDate[TemporalObject::YEAR_UNIT], adjustedDate[TemporalObject::MONTH_UNIT], adjustedDate[TemporalObject::DAY_UNIT], calendar).asObject()->asTemporalPlainDateObject(); TemporalPlainDateObject* date2 = TemporalPlainDateObject::createTemporalDate(state, second[TemporalObject::YEAR_UNIT], second[TemporalObject::MONTH_UNIT], second[TemporalObject::DAY_UNIT], calendar).asObject()->asTemporalPlainDateObject(); TemporalObject::DateTimeUnits dateLargestUnit = TemporalObject::DAY_UNIT > largestUnit ? TemporalObject::DAY_UNIT : largestUnit; - Object* untilOptions = TemporalObject::mergeLargestUnitOption(state, options, largestUnit); + Object* untilOptions = mergeLargestUnitOption(state, options, largestUnit); TemporalDurationObject* dateDifference = TemporalCalendarObject::calendarDateUntil(state, calendar, date1, date2, untilOptions).asObject()->asTemporalDurationObject(); std::map balanceResult = TemporalDurationObject::balanceDuration(state, { { TemporalObject::DAY_UNIT, dateDifference->getDay() }, { TemporalObject::HOUR_UNIT, timeDifference[TemporalObject::HOUR_UNIT] }, { TemporalObject::MINUTE_UNIT, timeDifference[TemporalObject::MINUTE_UNIT] }, { TemporalObject::SECOND_UNIT, timeDifference[TemporalObject::SECOND_UNIT] }, { TemporalObject::MILLISECOND_UNIT, timeDifference[TemporalObject::MILLISECOND_UNIT] }, { TemporalObject::MICROSECOND_UNIT, timeDifference[TemporalObject::MICROSECOND_UNIT] }, { TemporalObject::NANOSECOND_UNIT, timeDifference[TemporalObject::NANOSECOND_UNIT] } }, largestUnit); @@ -1908,7 +1947,7 @@ Value TemporalZonedDateTimeObject::createTemporalZonedDateTime(ExecutionState& s { ASSERT(TemporalInstantObject::isValidEpochNanoseconds(&epochNanoseconds)); - return new TemporalZonedDateTimeObject(state, state.context()->globalObject()->temporal()->asTemporalObject()->getTemporalZonedDateTimePrototype(), &epochNanoseconds, timeZone, const_cast(calendar)); + return new TemporalZonedDateTimeObject(state, state.context()->globalObject()->temporalZonedDateTimePrototype(), &epochNanoseconds, timeZone, const_cast(calendar)); } Value TemporalZonedDateTimeObject::toTemporalZonedDateTime(ExecutionState& state, const Value& item, const Value& options) @@ -1941,7 +1980,7 @@ Value TemporalZonedDateTimeObject::toTemporalZonedDateTime(ExecutionState& state auto fieldNames = TemporalCalendarObject::calendarFields(state, calendar, values); fieldNames.push_back(Value(state.context()->staticStrings().lazyTimeZone().string())); fieldNames.push_back(Value(state.context()->staticStrings().lazyOffset().string())); - auto fields = Temporal::prepareTemporalFields(state, item, fieldNames, { Value(state.context()->staticStrings().lazyTimeZone().string()) }); + auto fields = prepareTemporalFields(state, item, fieldNames, { Value(state.context()->staticStrings().lazyTimeZone().string()) }); timeZone = TemporalTimeZoneObject::toTemporalTimeZone(state, fields.asObject()->get(state, ObjectPropertyName(state.context()->staticStrings().lazyTimeZone())).value(state, fields)).asObject()->asTemporalTimeZoneObject(); auto offsetStringValue = fields.asObject()->get(state, ObjectPropertyName(state.context()->staticStrings().lazyOffset())).value(state, fields); @@ -1953,8 +1992,8 @@ Value TemporalZonedDateTimeObject::toTemporalZonedDateTime(ExecutionState& state result = TemporalPlainDateTimeObject::interpretTemporalDateTimeFields(state, calendar, fields, options); } else { - Temporal::toTemporalOverflow(state, options); - auto parseResult = TemporalObject::parseTemporalZonedDateTimeString(state, item.asString()->toNonGCUTF8StringData()); + TemporalObject::toTemporalOverflow(state, options); + auto parseResult = parseTemporalZonedDateTimeString(state, item.asString()->toNonGCUTF8StringData()); ASSERT(parseResult.tz->name->length() != 0); unsigned int index = 0; std::string timeZoneName = parseResult.tz->name->toNonGCUTF8StringData(); @@ -1986,8 +2025,8 @@ Value TemporalZonedDateTimeObject::toTemporalZonedDateTime(ExecutionState& state offsetNanoseconds = TemporalInstantObject::offsetStringToNanoseconds(state, offsetString); } - auto disambiguation = Temporal::toTemporalDisambiguation(state, options); - auto offsetOption = Temporal::toTemporalOffset(state, options, state.context()->staticStrings().reject.string()); + auto disambiguation = TemporalObject::toTemporalDisambiguation(state, options); + auto offsetOption = TemporalObject::toTemporalOffset(state, options, state.context()->staticStrings().reject.string()); auto epochNanoseconds = TemporalZonedDateTimeObject::interpretISODateTimeOffset(state, result, offsetBehaviour, offsetNanoseconds, timeZone, disambiguation, offsetOption, matchBehaviour).toBigInt(state); return TemporalZonedDateTimeObject::createTemporalZonedDateTime(state, *epochNanoseconds, timeZone, calendar); } @@ -2169,7 +2208,7 @@ Value TemporalInstantObject::createTemporalInstant(ExecutionState& state, const ASSERT(epochNanoseconds.isBigInt()); ASSERT(TemporalInstantObject::isValidEpochNanoseconds(epochNanoseconds)); - auto* object = new TemporalInstantObject(state, state.context()->globalObject()->temporal()->asTemporalObject()->getTemporalInstantPrototype()); + auto* object = new TemporalInstantObject(state, state.context()->globalObject()->temporalInstantPrototype()); object->setNanoseconds(epochNanoseconds.asBigInt()); return object; @@ -2213,7 +2252,7 @@ Value TemporalInstantObject::toTemporalInstant(ExecutionState& state, const Valu Value TemporalInstantObject::parseTemporalInstant(ExecutionState& state, const std::string& isoString) { - auto result = TemporalObject::parseTemporalInstantString(state, isoString); + auto result = parseTemporalInstantString(state, isoString); int64_t offsetNanoseconds = offsetStringToNanoseconds(state, result.tz->offsetString); time64_t utc = TemporalPlainDateTimeObject::getEpochFromISOParts(state, result.year, result.month, result.day, result.hour, result.minute, result.second, result.millisecond, result.microsecond, result.nanosecond); auto utcWithOffset = new BigInt(utc - offsetNanoseconds); @@ -2306,7 +2345,7 @@ BigInt* TemporalInstantObject::roundTemporalInstant(ExecutionState& state, BigIn break; } - return TemporalObject::roundNumberToIncrementAsIfPositive(state, ns, incrementNs, roundingMode); + return roundNumberToIncrementAsIfPositive(state, ns, incrementNs, roundingMode); } Value TemporalInstantObject::addDurationToOrSubtractDurationFromInstant(ExecutionState& state, TemporalPlainTimeObject::Operation operation, TemporalInstantObject* instant, const Value& other, const Value& options) @@ -2409,10 +2448,10 @@ Value TemporalTimeZoneObject::createTemporalTimeZone(ExecutionState& state, cons Object* proto; if (newTarget.hasValue()) { proto = Object::getPrototypeFromConstructor(state, newTarget.value(), [](ExecutionState& state, Context* constructorRealm) -> Object* { - return state.context()->globalObject()->temporal()->asTemporalObject()->getTemporalTimeZonePrototype(); + return state.context()->globalObject()->temporalTimeZonePrototype(); }); } else { - proto = state.context()->globalObject()->temporal()->asTemporalObject()->getTemporalTimeZonePrototype(); + proto = state.context()->globalObject()->temporalTimeZonePrototype(); } if (TemporalTimeZoneObject::isValidTimeZoneName(identifier)) { @@ -2505,7 +2544,7 @@ Value TemporalTimeZoneObject::toTemporalTimeZone(ExecutionState& state, const Va ErrorObject::throwBuiltinError(state, ErrorCode::RangeError, "string expected"); } - TemporalObject::TimeZone parseResult = TemporalObject::parseTemporalTimeZoneString(state, timeZoneLike.isUndefined() ? temporalTimeZoneLike.asString()->toNonGCUTF8StringData() : timeZoneLike.asString()->toNonGCUTF8StringData()); + TemporalObject::TimeZone parseResult = parseTemporalTimeZoneString(state, timeZoneLike.isUndefined() ? temporalTimeZoneLike.asString()->toNonGCUTF8StringData() : timeZoneLike.asString()->toNonGCUTF8StringData()); if (parseResult.name->length() != 0) { unsigned int index = 0; @@ -2778,10 +2817,10 @@ Value TemporalPlainYearMonthObject::createTemporalYearMonth(ExecutionState& stat } if (!newTarget.hasValue()) { - newTarget = state.context()->globalObject()->temporal()->asTemporalObject()->getTemporalPlainYearMonthPrototype(); + newTarget = state.context()->globalObject()->temporalPlainYearMonthPrototype(); } - return new TemporalPlainYearMonthObject(state, state.context()->globalObject()->temporal()->asTemporalObject()->getTemporalPlainYearMonthPrototype(), isoYear, isoMonth, calendar.asObject()->asTemporalCalendarObject(), referenceISODay); + return new TemporalPlainYearMonthObject(state, state.context()->globalObject()->temporalPlainYearMonthPrototype(), isoYear, isoMonth, calendar.asObject()->asTemporalCalendarObject(), referenceISODay); } bool TemporalPlainYearMonthObject::isoYearMonthWithinLimits(int isoYear, int isoMonth) @@ -2801,12 +2840,12 @@ Value TemporalPlainYearMonthObject::toTemporalYearMonth(ExecutionState& state, c StaticStrings& strings = state.context()->staticStrings(); auto calendar = TemporalCalendarObject::getTemporalCalendarWithISODefault(state, item); auto fieldNames = TemporalCalendarObject::calendarFields(state, calendar, { strings.lazyMonth().string(), strings.lazyMonthCode().string(), strings.lazyYear().string() }); - auto fields = Temporal::prepareTemporalFields(state, item, fieldNames, {}); + auto fields = prepareTemporalFields(state, item, fieldNames, {}); return TemporalCalendarObject::calendarYearMonthFromFields(state, calendar, fields, options); } - Temporal::toTemporalOverflow(state, options); - auto result = TemporalObject::parseTemporalYearMonthString(state, item.asString()->toNonGCUTF8StringData()); + TemporalObject::toTemporalOverflow(state, options); + auto result = parseTemporalYearMonthString(state, item.asString()->toNonGCUTF8StringData()); auto calendar = TemporalCalendarObject::toTemporalCalendarWithISODefault(state, Value(result.calendar)); auto retVal = TemporalPlainYearMonthObject::createTemporalYearMonth(state, result.year, result.month, calendar, result.day); @@ -2823,9 +2862,9 @@ Value TemporalPlainYearMonthObject::addDurationToOrSubtractDurationFromPlainYear std::map tmp = { { TemporalObject::DAY_UNIT, duration->getDay() }, { TemporalObject::HOUR_UNIT, duration->getHour() }, { TemporalObject::MINUTE_UNIT, duration->getMinute() }, { TemporalObject::SECOND_UNIT, duration->getSecond() }, { TemporalObject::MILLISECOND_UNIT, duration->getMillisecond() }, { TemporalObject::MICROSECOND_UNIT, duration->getMicrosecond() }, { TemporalObject::NANOSECOND_UNIT, duration->getNanosecond() } }; std::map balanceResult = TemporalDurationObject::balanceDuration(state, tmp, TemporalObject::DAY_UNIT); - Value optionsObject = Temporal::getOptionsObject(state, options); + Value optionsObject = TemporalObject::getOptionsObject(state, options); ValueVector fieldNames = TemporalCalendarObject::calendarFields(state, yearMonth->getCalendar(), { Value(state.context()->staticStrings().lazyMonthCode().string()), Value(state.context()->staticStrings().lazyYear().string()) }); - Value fields = Temporal::prepareTemporalFields(state, yearMonth, fieldNames, {}); + Value fields = prepareTemporalFields(state, yearMonth, fieldNames, {}); int durationArray[] = { duration->getYear(), duration->getMonth(), duration->getWeek(), balanceResult[TemporalObject::DAY_UNIT], 0, 0, 0, 0, 0, 0 }; int sign = TemporalDurationObject::durationSign(durationArray); int day = 1; @@ -2850,7 +2889,7 @@ Value TemporalPlainYearMonthObject::addDurationToOrSubtractDurationFromPlainYear } Value addedDate = TemporalCalendarObject::calendarDateAdd(state, yearMonth->getCalendar(), date, durationToAdd, options); - Value addedDateFields = Temporal::prepareTemporalFields(state, addedDate, fieldNames, {}); + Value addedDateFields = prepareTemporalFields(state, addedDate, fieldNames, {}); return TemporalCalendarObject::calendarYearMonthFromFields(state, yearMonth->getCalendar(), addedDateFields, optionsCopy); } @@ -2896,7 +2935,7 @@ Value TemporalDurationObject::createTemporalDuration(ExecutionState& state, int ErrorObject::throwBuiltinError(state, ErrorCode::RangeError, "Invalid time"); } - return new TemporalDurationObject(state, state.context()->globalObject()->temporal()->asTemporalObject()->getTemporalDurationPrototype(), years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds); + return new TemporalDurationObject(state, state.context()->globalObject()->temporalDurationPrototype(), years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds); } Value TemporalDurationObject::toTemporalDuration(ExecutionState& state, const Value& item) @@ -2913,7 +2952,7 @@ Value TemporalDurationObject::toTemporalDuration(ExecutionState& state, const Va std::map TemporalDurationObject::toTemporalDurationRecord(ExecutionState& state, const Value& temporalDurationLike) { if (!temporalDurationLike.isObject()) { - return TemporalObject::parseTemporalDurationString(state, temporalDurationLike.asString()->toNonGCUTF8StringData()); + return parseTemporalDurationString(state, temporalDurationLike.asString()->toNonGCUTF8StringData()); } else if (temporalDurationLike.asObject()->isTemporalDurationObject()) { auto duration = temporalDurationLike.asObject()->asTemporalDurationObject(); return TemporalDurationObject::createDurationRecord(state, duration->getYear(), duration->getMonth(), duration->getWeek(), duration->getDay(), duration->getHour(), duration->getMinute(), duration->getSecond(), duration->getMillisecond(), duration->getMicrosecond(), duration->getNanosecond()); @@ -2950,7 +2989,7 @@ std::map TemporalDurationObject::toTempora bool any = false; for (auto i : temporalTimeLikeProp) { - Value value = temporalDurationLike.asObject()->get(state, ObjectPropertyName(state, TemporalObject::dateTimeUnitString(state, i))).value(state, temporalDurationLike); + Value value = temporalDurationLike.asObject()->get(state, ObjectPropertyName(state, dateTimeUnitString(state, i))).value(state, temporalDurationLike); if (!value.isUndefined()) { any = true; @@ -2984,7 +3023,7 @@ Value TemporalDurationObject::createNegatedTemporalDuration(ExecutionState& stat Value TemporalDurationObject::addDurationToOrSubtractDurationFromDuration(ExecutionState& state, TemporalPlainTimeObject::Operation operation, TemporalDurationObject* duration, const Value& other, const Value& options) { auto otherDurationObject = TemporalDurationObject::toTemporalDurationRecord(state, other); - auto relativeTo = TemporalObject::toRelativeTemporalObject(state, Temporal::getOptionsObject(state, options).asObject()); + auto relativeTo = toRelativeTemporalObject(state, TemporalObject::getOptionsObject(state, options).asObject()); TemporalDurationObject* otherObject = other.asObject()->asTemporalDurationObject(); std::map durationMap1 = { { TemporalObject::YEAR_UNIT, duration->getYear() }, { TemporalObject::MONTH_UNIT, duration->getMonth() }, { TemporalObject::WEEK_UNIT, duration->getWeek() }, { TemporalObject::DAY_UNIT, duration->getDay() }, { TemporalObject::HOUR_UNIT, duration->getHour() }, { TemporalObject::MINUTE_UNIT, duration->getMinute() }, { TemporalObject::SECOND_UNIT, duration->getSecond() }, { TemporalObject::MILLISECOND_UNIT, duration->getMillisecond() }, { TemporalObject::MICROSECOND_UNIT, duration->getMicrosecond() }, { TemporalObject::NANOSECOND_UNIT, duration->getNanosecond() } }; std::map durationMap2 = { { TemporalObject::YEAR_UNIT, operation * otherObject->getYear() }, { TemporalObject::MONTH_UNIT, operation * otherObject->getMonth() }, { TemporalObject::WEEK_UNIT, operation * otherObject->getWeek() }, { TemporalObject::DAY_UNIT, operation * otherObject->getDay() }, { TemporalObject::HOUR_UNIT, operation * otherObject->getHour() }, { TemporalObject::MINUTE_UNIT, operation * otherObject->getMinute() }, { TemporalObject::SECOND_UNIT, operation * otherObject->getSecond() }, { TemporalObject::MILLISECOND_UNIT, operation * otherObject->getMillisecond() }, { TemporalObject::MICROSECOND_UNIT, operation * otherObject->getMicrosecond() }, { TemporalObject::NANOSECOND_UNIT, operation * otherObject->getNanosecond() } }; @@ -3028,7 +3067,7 @@ std::map TemporalDurationObject::addDuration Value end = TemporalCalendarObject::calendarDateAdd(state, calendar, intermediate, dateDuration2, Value(), dateAdd); auto dateLargestUnit = TemporalObject::DAY_UNIT > largestUnit ? TemporalObject::DAY_UNIT : largestUnit; auto differenceOptions = new Object(state, Object::PrototypeIsNull); - differenceOptions->defineOwnProperty(state, ObjectPropertyName(state.context()->staticStrings().lazyLargestUnit()), ObjectPropertyDescriptor(TemporalObject::dateTimeUnitString(state, dateLargestUnit), ObjectPropertyDescriptor::AllPresent)); + differenceOptions->defineOwnProperty(state, ObjectPropertyName(state.context()->staticStrings().lazyLargestUnit()), ObjectPropertyDescriptor(dateTimeUnitString(state, dateLargestUnit), ObjectPropertyDescriptor::AllPresent)); auto dateDifference = TemporalCalendarObject::calendarDateUntil(state, calendar, relativeTo, end, differenceOptions).asObject()->asTemporalDurationObject(); duration[TemporalObject::DAY_UNIT] = dateDifference->getDay(); auto result = TemporalDurationObject::balanceDuration(state, duration, largestUnit); @@ -3199,7 +3238,7 @@ Value TemporalPlainMonthDayObject::createTemporalMonthDay(ExecutionState& state, ErrorObject::throwBuiltinError(state, ErrorCode::RangeError, "Invalid date"); } - return new TemporalPlainMonthDayObject(state, state.context()->globalObject()->temporal()->asTemporalObject()->getTemporalPlainMonthDayPrototype(), isoMonth, isoDay, calendar, referenceISOYear); + return new TemporalPlainMonthDayObject(state, state.context()->globalObject()->temporalPlainMonthDayPrototype(), isoMonth, isoDay, calendar, referenceISOYear); } Value TemporalPlainMonthDayObject::toTemporalMonthDay(ExecutionState& state, const Value& item, const Value& options) @@ -3210,8 +3249,8 @@ Value TemporalPlainMonthDayObject::toTemporalMonthDay(ExecutionState& state, con int referenceISOYear = 1972; if (!item.isObject()) { - Temporal::toTemporalOverflow(state, options); - auto result = TemporalObject::parseTemporalMonthDayString(state, item.asString()->toNonGCUTF8StringData()); + TemporalObject::toTemporalOverflow(state, options); + auto result = parseTemporalMonthDayString(state, item.asString()->toNonGCUTF8StringData()); auto calendar = TemporalCalendarObject::toTemporalCalendarWithISODefault(state, Value(result.calendar)); if (result.year == 0) { @@ -3238,7 +3277,7 @@ Value TemporalPlainMonthDayObject::toTemporalMonthDay(ExecutionState& state, con } ValueVector fieldNames = TemporalCalendarObject::calendarFields(state, calendar, { strings.lazyDay().string(), strings.lazyMonth().string(), strings.lazyMonthCode().string(), strings.lazyYear().string() }); - Value fields = Temporal::prepareTemporalFields(state, item, fieldNames, {}); + Value fields = prepareTemporalFields(state, item, fieldNames, {}); Value month = fields.asObject()->get(state, strings.lazyMonth()).value(state, fields); Value monthCode = fields.asObject()->get(state, strings.lazyMonthCode()).value(state, fields); Value year = fields.asObject()->get(state, strings.lazyYear()).value(state, fields); diff --git a/src/runtime/TemporalObject.h b/src/runtime/TemporalObject.h index d8e316fbf..a3bea1a0d 100644 --- a/src/runtime/TemporalObject.h +++ b/src/runtime/TemporalObject.h @@ -22,10 +22,11 @@ #define __EscargotTemporalObject__ #include "Escargot.h" +#include "Context.h" #include "runtime/Object.h" #include "runtime/GlobalObject.h" -#include "runtime/Temporal.h" #include "runtime/DateObject.h" +#include "intl/Intl.h" namespace Escargot { @@ -103,7 +104,7 @@ enum UnsignedRoundingMode { static UnsignedRoundingMode positiveUnsignedRoundingMode[] = { INF, ZERO, INF, ZERO, HALF_INF, HALF_ZERO, HALF_INF, HALF_ZERO }; static UnsignedRoundingMode negativeUnsignedRoundingMode[] = { ZERO, INF, INF, ZERO, HALF_ZERO, HALF_INF, HALF_INF, HALF_ZERO }; -class TemporalObject : public Temporal { +class TemporalObject : public DerivedObject { public: class TimeZone : public gc { public: @@ -146,50 +147,88 @@ class TemporalObject : public Temporal { explicit TemporalObject(ExecutionState& state); explicit TemporalObject(ExecutionState& state, Object* proto); - virtual bool hasCalendar() const + + virtual bool isTemporalObject() const override { - return false; + return true; } - bool isTemporalObject() const + + virtual bool hasCalendar() const { - return true; + return false; } + virtual TemporalCalendarObject* getCalendar() const { return nullptr; } + static Value toISODateTime(ExecutionState& state, DateObject& d); static Value toISODate(ExecutionState& state, DateObject& d); static Value toISOTime(ExecutionState& state, DateObject& d); - static String* dateTimeUnitString(ExecutionState& state, DateTimeUnits unit); - - static TemporalObject::DateTime parseValidIso8601String(ExecutionState& state, std::string isoString, bool parseTimeZone); - static TemporalObject::DateTime parseTemporalInstantString(ExecutionState& state, const std::string& isoString); - static TemporalObject::DateTime parseTemporalZonedDateTimeString(ExecutionState& state, const std::string& isoString); - static TemporalObject::DateTime parseTemporalDateString(ExecutionState& state, const std::string& isoString); - static TemporalObject::DateTime parseTemporalDateTimeString(ExecutionState& state, const std::string& isoString); - static std::map parseTemporalDurationString(ExecutionState& state, const std::string& isoString); - static TemporalObject::DateTime parseTemporalYearMonthString(ExecutionState& state, const std::string& isoString); - static TemporalObject::DateTime parseTemporalMonthDayString(ExecutionState& state, const std::string& isoString); - static TemporalObject::TimeZone parseTemporalTimeZoneString(ExecutionState& state, const std::string& isoString); - static std::string getNNumberFromString(ExecutionState& state, std::string& isoString, int n, unsigned int& index); - static std::map getSeconds(ExecutionState& state, std::string& isoString, unsigned int& index); static std::string offset(ExecutionState& state, std::string& isoString, unsigned int& index); - static std::string tzComponent(ExecutionState& state, std::string& isoString, unsigned int& index); - static TemporalObject::TimeZone parseTimeZoneOffset(ExecutionState& state, std::string& isoString, unsigned int& index); - static bool isNumber(const std::string& s) + + static Value getOptionsObject(ExecutionState& state, const Value& options) + { + if (options.isObject()) { + return options; + } + + if (!options.isUndefined()) { + ErrorObject::throwBuiltinError(state, ErrorCode::TypeError, "options must be object"); + } + + return {}; + } + + static Value toTemporalOverflow(ExecutionState& state, const Value& normalizedOptions) + { + if (normalizedOptions.isUndefined()) { + return state.context()->staticStrings().lazyConstrain().string(); + } + auto options = normalizedOptions.toObject(state); + Value matcherValues[2] = { state.context()->staticStrings().lazyConstrain().string(), state.context()->staticStrings().reject.string() }; + return Intl::getOption(state, options, state.context()->staticStrings().lazyOverflow().string(), Intl::StringValue, matcherValues, 2, matcherValues[0]); + } + + static Value toTemporalDisambiguation(ExecutionState& state, const Value& options) { - return !s.empty() && std::find_if(s.begin(), s.end(), [](unsigned char c) { return !std::isdigit(c); }) == s.end(); + if (options.isUndefined()) { + return state.context()->staticStrings().lazyConstrain().string(); + } + + Value matcherValues[4] = { state.context()->staticStrings().lazyConstrain().string(), state.context()->staticStrings().lazyEarlier().string(), state.context()->staticStrings().lazyLater().string(), state.context()->staticStrings().reject.string() }; + return Intl::getOption(state, options.asObject(), state.context()->staticStrings().lazyDisambiguation().string(), Intl::StringValue, matcherValues, 4, matcherValues[0]); } - static Value toRelativeTemporalObject(ExecutionState& state, Object* options); - static Object* mergeLargestUnitOption(ExecutionState& state, const Value& option, TemporalObject::DateTimeUnits largestUnit); - static UnsignedRoundingMode getUnsignedRoundingMode(ExecutionState& state, RoundingMode roundingMode, bool isNegative); - static BigInt* roundNumberToIncrementAsIfPositive(ExecutionState& state, BigInt* x, int64_t increment, RoundingMode roundingMode); - static BigInt* applyUnsignedRoundingMode(ExecutionState& state, BigInt* x, BigInt* r1, BigInt* r2, UnsignedRoundingMode unsignedRoundingMode); - static int64_t floor(double num); - static int64_t modulo(int64_t num1, int64_t num2); + static Value toTemporalOffset(ExecutionState& state, const Value& options, const Value& fallback) + { + if (options.isUndefined()) { + return fallback; + } + + Value matcherValues[4] = { state.context()->staticStrings().lazyPrefer().string(), state.context()->staticStrings().lazyUse().string(), state.context()->staticStrings().lazyIgnore().string(), state.context()->staticStrings().reject.string() }; + return Intl::getOption(state, options.asObject(), state.context()->staticStrings().lazyOffset().string(), Intl::StringValue, matcherValues, 4, fallback); + } + + + static void rejectObjectWithCalendarOrTimeZone(ExecutionState& state, const Value& object) + { + ASSERT(object.isObject()); + + if (object.asObject()->isTemporalPlainDateObject() || object.asObject()->isTemporalPlainDateTimeObject() || object.asObject()->isTemporalPlainTimeObject() || object.asObject()->isTemporalZonedDateTimeObject() || object.asObject()->isTemporalPlainYearMonthObject() || object.asObject()->isTemporalMonthDayObject()) { + ErrorObject::throwBuiltinError(state, ErrorCode::TypeError, new ASCIIString("Invalid type of Object")); + } + + if (!object.asObject()->get(state, ObjectPropertyName(state, state.context()->staticStrings().calendar.string())).value(state, object).isUndefined()) { + ErrorObject::throwBuiltinError(state, ErrorCode::TypeError, new ASCIIString("Object has calendar property")); + } + + if (!object.asObject()->get(state, ObjectPropertyName(state, state.context()->staticStrings().lazyTimeZone().string())).value(state, object).isUndefined()) { + ErrorObject::throwBuiltinError(state, ErrorCode::TypeError, new ASCIIString("Object has timezone property")); + } + } }; class TemporalCalendarObject : public TemporalObject {