aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-03-08 18:14:47 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-03-08 18:14:47 -0800
commit6742048b4a761d8064d495fc22248ca87ff5ea1d (patch)
tree8b6edec63071a6f7e6a5041e178701a3588057ed
parent99a6455bffe5598b0b33ff95d30b9b0fb61976b4 (diff)
assertions on number of minified names
-rw-r--r--tools/js-optimizer.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index 59ec1c3b..fdc456f8 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -1418,6 +1418,7 @@ function registerize(ast) {
});
assert(fun[1] in minifierInfo.globals, fun[1]);
fun[1] = minifierInfo.globals[fun[1]];
+ assert(fun[1]);
}
if (asm) var asmData = normalizeAsm(fun);
// Add parameters as a first (fake) var (with assignment), so they get taken into consideration
@@ -2187,6 +2188,7 @@ function minifyGlobals(ast) {
var vars = node[1];
for (var i = 0; i < vars.length; i++) {
var name = vars[i][0];
+ assert(next < minifierInfo.names.length);
vars[i][0] = minified[name] = minifierInfo.names[next++];
}
}
@@ -2194,6 +2196,7 @@ function minifyGlobals(ast) {
// add all globals in function chunks, i.e. not here but passed to us
for (var i = 0; i < minifierInfo.globals.length; i++) {
name = minifierInfo.globals[i];
+ assert(next < minifierInfo.names.length);
minified[name] = minifierInfo.names[next++];
}
// apply minification