removed some unused variables

This commit is contained in:
Mihai Bazon
2012-10-04 08:49:18 +03:00
parent f20c251882
commit 682a58a1f5
3 changed files with 9 additions and 14 deletions

View File

@@ -210,7 +210,6 @@ merge(Compressor.prototype, {
function handle_if_return(statements, compressor) { function handle_if_return(statements, compressor) {
var self = compressor.self(); var self = compressor.self();
var in_lambda = self instanceof AST_Lambda; var in_lambda = self instanceof AST_Lambda;
var last = statements.length - 1;
var ret = []; var ret = [];
loop: for (var i = statements.length; --i >= 0;) { loop: for (var i = statements.length; --i >= 0;) {
var stat = statements[i]; var stat = statements[i];
@@ -1378,8 +1377,8 @@ merge(Compressor.prototype, {
} }
if (compressor.option("booleans") && compressor.in_boolean_context()) switch (self.operator) { if (compressor.option("booleans") && compressor.in_boolean_context()) switch (self.operator) {
case "&&": case "&&":
var ll = self.left.evaluate(compressor), left = ll[0]; var ll = self.left.evaluate(compressor);
var rr = self.right.evaluate(compressor), right = rr[0]; var rr = self.right.evaluate(compressor);
if ((ll.length > 1 && !ll[1]) || (rr.length > 1 && !rr[1])) { if ((ll.length > 1 && !ll[1]) || (rr.length > 1 && !rr[1])) {
compressor.warn("Boolean && always false [{file}:{line},{col}]", self.start); compressor.warn("Boolean && always false [{file}:{line},{col}]", self.start);
return make_node(AST_False, self); return make_node(AST_False, self);
@@ -1392,8 +1391,8 @@ merge(Compressor.prototype, {
} }
break; break;
case "||": case "||":
var ll = self.left.evaluate(compressor), left = ll[0]; var ll = self.left.evaluate(compressor);
var rr = self.right.evaluate(compressor), right = rr[0]; var rr = self.right.evaluate(compressor);
if ((ll.length > 1 && ll[1]) || (rr.length > 1 && rr[1])) { if ((ll.length > 1 && ll[1]) || (rr.length > 1 && rr[1])) {
compressor.warn("Boolean || always true [{file}:{line},{col}]", self.start); compressor.warn("Boolean || always true [{file}:{line},{col}]", self.start);
return make_node(AST_True, self); return make_node(AST_True, self);
@@ -1406,8 +1405,8 @@ merge(Compressor.prototype, {
} }
break; break;
case "+": case "+":
var ll = self.left.evaluate(compressor), left = ll[0]; var ll = self.left.evaluate(compressor);
var rr = self.right.evaluate(compressor), right = rr[0]; var rr = self.right.evaluate(compressor);
if ((ll.length > 1 && ll[0] instanceof AST_String && ll[1]) || if ((ll.length > 1 && ll[0] instanceof AST_String && ll[1]) ||
(rr.length > 1 && rr[0] instanceof AST_String && rr[1])) { (rr.length > 1 && rr[0] instanceof AST_String && rr[1])) {
compressor.warn("+ in boolean context always true [{file}:{line},{col}]", self.start); compressor.warn("+ in boolean context always true [{file}:{line},{col}]", self.start);

View File

@@ -304,10 +304,6 @@ function tokenizer($TEXT, filename) {
return ch; return ch;
}; };
function eof() {
return !S.peek();
};
function find(what, signal_eof) { function find(what, signal_eof) {
var pos = S.text.indexOf(what, S.pos); var pos = S.text.indexOf(what, S.pos);
if (signal_eof && pos == -1) throw EX_EOF; if (signal_eof && pos == -1) throw EX_EOF;
@@ -909,7 +905,7 @@ function parse($TEXT, options) {
} }
expect(":"); expect(":");
S.labels.push(label); S.labels.push(label);
var start = S.token, stat = statement(); var stat = statement();
S.labels.pop(); S.labels.pop();
return new AST_LabeledStatement({ body: stat, label: label }); return new AST_LabeledStatement({ body: stat, label: label });
}; };
@@ -1036,7 +1032,7 @@ function parse($TEXT, options) {
var switch_body_ = curry(in_loop, function(){ var switch_body_ = curry(in_loop, function(){
expect("{"); expect("{");
var a = [], cur = null, branch = null, start = S.token; var a = [], cur = null, branch = null;
while (!is("punc", "}")) { while (!is("punc", "}")) {
if (is("eof")) unexpected(); if (is("eof")) unexpected();
if (is("keyword", "case")) { if (is("keyword", "case")) {

View File

@@ -243,7 +243,7 @@ AST_Lambda.DEFMETHOD("init_scope_vars", function(){
AST_SymbolRef.DEFMETHOD("reference", function() { AST_SymbolRef.DEFMETHOD("reference", function() {
var def = this.definition(); var def = this.definition();
def.references.push(this); def.references.push(this);
var orig_scope = def.scope, s = this.scope; var s = this.scope;
while (s) { while (s) {
push_uniq(s.enclosed, def); push_uniq(s.enclosed, def);
s = s.parent_scope; s = s.parent_scope;