From bca5f2264f05734d81322a7bb7e658954bf96496 Mon Sep 17 00:00:00 2001 From: johnlenz Date: Thu, 7 Nov 2024 15:55:24 -0800 Subject: [PATCH] Remove the unused $jscomp.SIMPLE_FROUND_POLYFILL define and simplify the `fround` polyfill when ASSUME_ES5 is enabled. PiperOrigin-RevId: 694276260 --- src/com/google/javascript/jscomp/js/es6/math/fround.js | 2 +- src/com/google/javascript/jscomp/js/util/defines.js | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/com/google/javascript/jscomp/js/es6/math/fround.js b/src/com/google/javascript/jscomp/js/es6/math/fround.js index fe5af55414a..81fae6492bc 100644 --- a/src/com/google/javascript/jscomp/js/es6/math/fround.js +++ b/src/com/google/javascript/jscomp/js/es6/math/fround.js @@ -20,7 +20,7 @@ $jscomp.polyfill('Math.fround', function(orig) { if (orig) return orig; - if ($jscomp.SIMPLE_FROUND_POLYFILL || typeof Float32Array !== 'function') { + if (!$jscomp.ASSUME_ES5 && typeof Float32Array !== 'function') { // Explicitly requested a no-op polyfill, or Float32Array not available. return /** @return {number} */ function(/** number */ arg) { return arg; diff --git a/src/com/google/javascript/jscomp/js/util/defines.js b/src/com/google/javascript/jscomp/js/util/defines.js index 3ee0eec5be4..09ae72be6e6 100644 --- a/src/com/google/javascript/jscomp/js/util/defines.js +++ b/src/com/google/javascript/jscomp/js/util/defines.js @@ -36,16 +36,6 @@ $jscomp.ASSUME_NO_NATIVE_MAP = false; */ $jscomp.ASSUME_NO_NATIVE_SET = false; -/** - * Whether to provide an incorrect but tiny Math.fround polyfill that just - * returns the number given. This is usually okay to do, particularly if - * `Math.fround` is only used to allow the JavaScript engine to use faster - * 32-bit float operations, but could cause problems if program logic is - * dependent on floats being truncated consistently. - * @define {boolean} - */ -$jscomp.SIMPLE_FROUND_POLYFILL = false; - /** * Whether to isolate all injected polyfills from global state. This is not * on by default, as it bloats code size, but is useful when code needs to