Skip to content

Commit

Permalink
Remove the unused $jscomp.SIMPLE_FROUND_POLYFILL define and simplify …
Browse files Browse the repository at this point in the history
…the `fround` polyfill when ASSUME_ES5 is enabled.

PiperOrigin-RevId: 694276260
  • Loading branch information
concavelenz authored and copybara-github committed Nov 7, 2024
1 parent 2424aa9 commit bca5f22
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
2 changes: 1 addition & 1 deletion src/com/google/javascript/jscomp/js/es6/math/fround.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 0 additions & 10 deletions src/com/google/javascript/jscomp/js/util/defines.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bca5f22

Please sign in to comment.