[webkit-changes] [WebKit/WebKit] 2f0cbc: Implement with and round methods for TemporalPlain...

Ross Kirsling noreply at github.com
Fri Sep 16 12:00:07 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2f0cbc36b53452d3befb58be7e204dfd0f557cf0
      https://github.com/WebKit/WebKit/commit/2f0cbc36b53452d3befb58be7e204dfd0f557cf0
  Author: Ross Kirsling <rkirsling at gmail.com>
  Date:   2022-09-16 (Fri, 16 Sep 2022)

  Changed paths:
    M JSTests/stress/temporal-plaindate.js
    M JSTests/stress/temporal-plaindatetime.js
    M JSTests/test262/config.yaml
    M JSTests/test262/expectations.yaml
    M Source/JavaScriptCore/runtime/TemporalCalendar.cpp
    M Source/JavaScriptCore/runtime/TemporalCalendar.h
    M Source/JavaScriptCore/runtime/TemporalObject.cpp
    M Source/JavaScriptCore/runtime/TemporalObject.h
    M Source/JavaScriptCore/runtime/TemporalPlainDate.cpp
    M Source/JavaScriptCore/runtime/TemporalPlainDate.h
    M Source/JavaScriptCore/runtime/TemporalPlainDatePrototype.cpp
    M Source/JavaScriptCore/runtime/TemporalPlainDateTime.cpp
    M Source/JavaScriptCore/runtime/TemporalPlainDateTime.h
    M Source/JavaScriptCore/runtime/TemporalPlainDateTimePrototype.cpp
    M Source/JavaScriptCore/runtime/TemporalPlainTime.cpp
    M Source/JavaScriptCore/runtime/TemporalPlainTime.h

  Log Message:
  -----------
  Implement with and round methods for TemporalPlainDate[Time]
https://bugs.webkit.org/show_bug.cgi?id=245282

Reviewed by Yusuke Suzuki.

This patch implements the following Temporal API methods:
  - PlainDate.prototype.with
  - PlainDateTime.prototype.{with, withPlainDate, withPlainTime, round}

Note: `with` will likely need significant refactoring in the future. At present, the spec demands bafflingly inefficient
behavior, observably calling out to Calendar multiple times and creating multiple intermediate JSObjects, even in the
default case where the user is not making conscious use of Calendar at all. This is a showstopper, but one which Yusuke
already reported in tc39/proposal-temporal#1808.

* JSTests/stress/temporal-plaindate.js:
* JSTests/stress/temporal-plaindatetime.js:
* JSTests/test262/config.yaml:
* JSTests/test262/expectations.yaml:
* Source/JavaScriptCore/runtime/TemporalCalendar.cpp:
(JSC::TemporalCalendar::from):
(JSC::TemporalCalendar::isoDateFromFields): Split into two.
* Source/JavaScriptCore/runtime/TemporalCalendar.h:
* Source/JavaScriptCore/runtime/TemporalObject.cpp:
(JSC::rejectObjectWithCalendarOrTimeZone): Added.
* Source/JavaScriptCore/runtime/TemporalObject.h:
* Source/JavaScriptCore/runtime/TemporalPlainDate.cpp:
(JSC::TemporalPlainDate::toPartialDate): Added.
(JSC::TemporalPlainDate::with): Added.
* Source/JavaScriptCore/runtime/TemporalPlainDate.h:
* Source/JavaScriptCore/runtime/TemporalPlainDatePrototype.cpp:
* Source/JavaScriptCore/runtime/TemporalPlainDateTime.cpp:
(JSC::TemporalPlainDateTime::with): Added.
(JSC::TemporalPlainDateTime::round): Added.
* Source/JavaScriptCore/runtime/TemporalPlainDateTime.h:
* Source/JavaScriptCore/runtime/TemporalPlainDateTimePrototype.cpp:
* Source/JavaScriptCore/runtime/TemporalPlainTime.cpp:
(JSC::TemporalPlainTime::roundTime):
(JSC::TemporalPlainTime::toTemporalTimeRecord):
(JSC::TemporalPlainTime::toPartialTime):
(JSC::TemporalPlainTime::with const):
(JSC::toPartialTime): Made public static.
* Source/JavaScriptCore/runtime/TemporalPlainTime.h:

Canonical link: https://commits.webkit.org/254565@main




More information about the webkit-changes mailing list