You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a build step that removes dev().assert calls:
// input:functionhello(){dev().assert(ASSERTION,'some text to describe');}// output:functionhello(){ASSERTION;}// v0.js:functionhello(){}
Generally, that ASSERTION then gets removed in v0.js, because it's a useless (side-effect free) reference. But, sometimes we assert call expressions...
Now, Closure Compiler sucks pretty badly tries to decide if a method call will have a side effect. So, this will not be eliminated from the final build.
// input:functionhello(){dev().assert(array.includes('something'),'some text to describe');}// output:functionhello(){array.includes('something');}// v0.js:functionhello(){array.includes('something');}
That's no good. We know that call it totally useless, but Closure doesn't. And that useless call stays there, and over the numerous assertions we do, those bytes add up.
Proposal
From now on, any call expression inside dev().assert()must be marked as /*PURE*/:
Using this, we will now that we can completely remove the assertion:
// input:functionhello(){dev().assert(array./*PURE*/includes('something'),'some text to describe');}// output:functionhello(){undefined;}// v0.js:functionhello(){}
The text was updated successfully, but these errors were encountered:
We have a build step that removes
dev().assert
calls:Generally, that
ASSERTION
then gets removed inv0.js
, because it's a useless (side-effect free) reference. But, sometimes we assert call expressions...Now, Closure Compiler sucks pretty badly tries to decide if a method call will have a side effect. So, this will not be eliminated from the final build.
That's no good. We know that call it totally useless, but Closure doesn't. And that useless call stays there, and over the numerous assertions we do, those bytes add up.
Proposal
From now on, any call expression inside
dev().assert()
must be marked as/*PURE*/
:Using this, we will now that we can completely remove the assertion:
The text was updated successfully, but these errors were encountered: