RESOLVED FIXED 213440
Convert DateComponents parsing code to use Optional based return values rather than out-parameters
https://bugs.webkit.org/show_bug.cgi?id=213440
Summary Convert DateComponents parsing code to use Optional based return values rathe...
Sam Weinig
Reported 2020-06-20 17:12:02 PDT
Convert DateComponents code parsing code to use Optional based return values rather than out-parameters
Attachments
Patch (42.66 KB, patch)
2020-06-20 17:26 PDT, Sam Weinig
no flags
Patch (42.66 KB, patch)
2020-06-20 17:33 PDT, Sam Weinig
no flags
Patch (42.85 KB, patch)
2020-06-20 17:49 PDT, Sam Weinig
no flags
Patch (42.92 KB, patch)
2020-06-20 20:44 PDT, Sam Weinig
no flags
Patch (43.48 KB, patch)
2020-06-21 06:21 PDT, Sam Weinig
no flags
Patch (43.48 KB, patch)
2020-06-21 08:09 PDT, Sam Weinig
no flags
Patch (43.42 KB, patch)
2020-07-03 08:21 PDT, Sam Weinig
no flags
Sam Weinig
Comment 1 2020-06-20 17:26:46 PDT Comment hidden (obsolete)
Sam Weinig
Comment 2 2020-06-20 17:33:57 PDT Comment hidden (obsolete)
Sam Weinig
Comment 3 2020-06-20 17:49:54 PDT Comment hidden (obsolete)
Sam Weinig
Comment 4 2020-06-20 20:44:40 PDT Comment hidden (obsolete)
Sam Weinig
Comment 5 2020-06-21 06:21:53 PDT Comment hidden (obsolete)
Sam Weinig
Comment 6 2020-06-21 08:09:01 PDT
Darin Adler
Comment 7 2020-06-21 12:50:20 PDT
Comment on attachment 402425 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=402425&action=review > Source/WebCore/html/BaseDateAndTimeInputType.cpp:81 > + return !value.isEmpty() && parseToDateComponents(value) == WTF::nullopt; I think !parse reads better than parse == nullopt. But I suppose others might argue that the ! one looks like it’s about 0; not for me. (As an aside, I hope we change our style to allow "== 0" at some point.) > Source/WebCore/html/BaseDateAndTimeInputType.h:58 > + virtual Optional<DateComponents> setMillisecondToDateComponents(double) const = 0; What does the word "set" refer to in this (already existing, not new to this patch) function name? > Source/WebCore/platform/DateComponents.cpp:116 > + const CharacterType* current = src + parseStart; > + const CharacterType* end = current + parseLength; I just woulda done auto for these. > Source/WebCore/platform/DateComponents.cpp:201 > + return createFromString(source, [] (auto& date, const auto* src, auto length, auto& end) { Not a big fan of the use of the string "src" here. Also I think just auto src would do, no need for const auto*.
Darin Adler
Comment 8 2020-06-21 12:50:50 PDT
Comment on attachment 402425 [details] Patch Even though I had comments I think I will set commit-queue+, probably good to land this as-is.
EWS
Comment 9 2020-06-21 12:58:30 PDT
Committed r263331: <https://trac.webkit.org/changeset/263331> All reviewed patches have been landed. Closing bug and clearing flags on attachment 402425 [details].
Radar WebKit Bug Importer
Comment 10 2020-06-21 12:59:16 PDT
Jason Lawrence
Comment 11 2020-06-22 08:26:40 PDT
Reverted r263331 for reason: This commit was causing 50+ iOS debug tests to crash. Committed r263349: <https://trac.webkit.org/changeset/263349>
Sam Weinig
Comment 12 2020-07-03 08:21:32 PDT
Sam Weinig
Comment 13 2020-07-03 08:22:02 PDT
(In reply to Sam Weinig from comment #12) > Created attachment 403461 [details] > Patch Now with the missing empty string check added back.
EWS
Comment 14 2020-07-03 09:45:34 PDT
Committed r263900: <https://trac.webkit.org/changeset/263900> All reviewed patches have been landed. Closing bug and clearing flags on attachment 403461 [details].
Note You need to log in before you can comment on or make changes to this bug.