google/closure-compiler

Add an @pure annotation

Open

#2395 aperta il 31 mar 2017

Vedi su GitHub
 (5 commenti) (0 reazioni) (0 assegnatari)Java (1197 fork)batch import
feathelp wanted

Metriche repository

Star
 (7176 star)
Metriche merge PR
 (Merge medio 3g 4h) (1 PR mergiata in 30 g)

Descrizione

I'd like to have an annotation to declare an intent that a function will not have side effects. In the presence of this annotation, I'd like the compiler to warn me if the function has side effects.

In a lot of code, you have simple helper methods that are intended to be side-effect free. It's very easy for a side effect to be accidentally introduced at a later time. I'd like to have a warning issued for this so the developer can correct it.

Guida contributor