Number.toString(base)
does not have @nosideeffects
semantics
#4169
Labels
Number.toString(base)
does not have @nosideeffects
semantics
#4169
It is mentioned in various places that
.toString()
method has a hardcoded@nosideeffects
property. (e.g., Angular nosideeffect annotation)) (On a side note, is this hack still relevant after the @nosideeffects being allowed in non-externs code?)However the same is not true for
Number.toString(base)
variant, which writes the number in bases other than base 10.The first one is detected as suspicious code, the second one isn't.
The relevant externs definition appears correct, however it looks like there some special handling of
.toString()
in the java code.This is important because in many fields (crypto, verifiable computation) some constants need to be generated (instead of being written out as literals). If GCC can eliminate the ones that aren't used, it will result in significant reductions. However when the generation code uses
toString(16)
elimination does not happen.The text was updated successfully, but these errors were encountered: