From c2b0b69f2fa15a2cdd2677ba6b49dd8fd0abd765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Thu, 9 Jun 2022 11:12:01 +0200 Subject: [PATCH] Editorial: Remove unnecessary checks for undefined before ToPositiveInteger `ToPositiveInteger(undefined)` calls `ToIntegerThrowOnInfinity(undefined)`, which in turn calls `ToIntegerOrInfinity(undefined)`, which in turn calls `ToNumber(undefined)`. `ToNumber` returns `NaN`, `ToIntegerOrInfinity` then returns `0`, `ToIntegerThrowOnInfinity` returns `0` unchanged, and finally `ToPositiveInteger` will throw a RangeError for `0`. That means it's not necessary to handle `undefined` before calling `ToPositiveInteger`. --- spec/calendar.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/calendar.html b/spec/calendar.html index bdbff323a5..f35cdeac21 100644 --- a/spec/calendar.html +++ b/spec/calendar.html @@ -166,7 +166,6 @@

CalendarMonth ( _calendar_, _dateLike_ )

1. Assert: Type(_calendar_) is Object. 1. Let _result_ be ? Invoke(_calendar_, *"month"*, « _dateLike_ »). - 1. If _result_ is *undefined*, throw a *RangeError* exception. 1. Return ? ToPositiveInteger(_result_). @@ -192,7 +191,6 @@

CalendarDay ( _calendar_, _dateLike_ )

1. Assert: Type(_calendar_) is Object. 1. Let _result_ be ? Invoke(_calendar_, *"day"*, « _dateLike_ »). - 1. If _result_ is *undefined*, throw a *RangeError* exception. 1. Return ? ToPositiveInteger(_result_).