我有一个函数,其中创建了一个测试元素。在返回函数之前,我将测试元素的引用设置为 null,以帮助防止内存泄漏。但是 closure compiler 删除了这一行,因为它认为这不是必需的(在两种模式下都是如此)。是否有一种注释可以添加以防止删除该行?
function isExample (testElem) {
var bool;
testElem = testElem || document.createElement('div');
// Do stuff in here to determine `bool`
// ...
// Then nullify the reference
testElem = null; // The compiler removes this line. How do I make it keep it?
return bool;
}