mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 11:36:10 +00:00
LibJS: Simplify ParseTemporalCalendarString
This is an editorial change in the Temporal proposal. See: https://github.com/tc39/proposal-temporal/commit/1b1fd9f
This commit is contained in:
parent
67ed676831
commit
5372d07c5c
Notes:
github-actions[bot]
2025-01-28 11:26:45 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/5372d07c5ca Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3380 Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 8 additions and 10 deletions
|
@ -1369,18 +1369,16 @@ ThrowCompletionOr<String> parse_temporal_calendar_string(VM& vm, String const& s
|
|||
// c. Else, return calendar.
|
||||
return calendar.value_or("iso8601"_string);
|
||||
}
|
||||
// 3. Else,
|
||||
else {
|
||||
// a. Set parseResult to ParseText(StringToCodePoints(string), AnnotationValue).
|
||||
auto annotation_parse_result = parse_iso8601(Production::AnnotationValue, string);
|
||||
|
||||
// b. If parseResult is a List of errors, throw a RangeError exception.
|
||||
if (!annotation_parse_result.has_value())
|
||||
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarString, string);
|
||||
// 3. Set parseResult to ParseText(StringToCodePoints(string), AnnotationValue).
|
||||
auto annotation_parse_result = parse_iso8601(Production::AnnotationValue, string);
|
||||
|
||||
// c. Else, return string.
|
||||
return string;
|
||||
}
|
||||
// 4. If parseResult is a List of errors, throw a RangeError exception.
|
||||
if (!annotation_parse_result.has_value())
|
||||
return vm.throw_completion<RangeError>(ErrorType::TemporalInvalidCalendarString, string);
|
||||
|
||||
// 5. Return string.
|
||||
return string;
|
||||
}
|
||||
|
||||
// 13.35 ParseTemporalDurationString ( isoString ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaldurationstring
|
||||
|
|
Loading…
Add table
Reference in a new issue