google/closure-compiler

Add an @pure annotation

Open

#2,395 建立於 2017年3月31日

在 GitHub 查看
 (5 留言) (0 反應) (0 負責人)Java (1,197 fork)batch import
feathelp wanted

倉庫指標

Star
 (7,176 star)
PR 合併指標
 (平均合併 3天 4小時) (30 天內合併 1 個 PR)

描述

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.

貢獻者指南