Fix warnings for referenced non-hoisted functions.

Fixes #1034

Also added `expect_warnings` functionality to test framework.
This commit is contained in:
kzc
2016-04-10 15:41:38 -04:00
committed by Richard van Velzen
parent b434b75b36
commit 3907a5e3b2
3 changed files with 167 additions and 2 deletions

View File

@@ -801,7 +801,9 @@ merge(Compressor.prototype, {
};
function extract_declarations_from_unreachable_code(compressor, stat, target) {
compressor.warn("Dropping unreachable code [{file}:{line},{col}]", stat.start);
if (!(stat instanceof AST_Defun)) {
compressor.warn("Dropping unreachable code [{file}:{line},{col}]", stat.start);
}
stat.walk(new TreeWalker(function(node){
if (node instanceof AST_Definitions) {
compressor.warn("Declarations in unreachable code! [{file}:{line},{col}]", node.start);