diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compress.js | 13 | ||||
-rw-r--r-- | lib/parse.js | 8 | ||||
-rw-r--r-- | lib/scope.js | 2 |
3 files changed, 9 insertions, 14 deletions
diff --git a/lib/compress.js b/lib/compress.js index 10c1d222..fcf022e1 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -210,7 +210,6 @@ merge(Compressor.prototype, { function handle_if_return(statements, compressor) { var self = compressor.self(); var in_lambda = self instanceof AST_Lambda; - var last = statements.length - 1; var ret = []; loop: for (var i = statements.length; --i >= 0;) { var stat = statements[i]; @@ -1378,8 +1377,8 @@ merge(Compressor.prototype, { } if (compressor.option("booleans") && compressor.in_boolean_context()) switch (self.operator) { case "&&": - var ll = self.left.evaluate(compressor), left = ll[0]; - var rr = self.right.evaluate(compressor), right = rr[0]; + var ll = self.left.evaluate(compressor); + var rr = self.right.evaluate(compressor); if ((ll.length > 1 && !ll[1]) || (rr.length > 1 && !rr[1])) { compressor.warn("Boolean && always false [{file}:{line},{col}]", self.start); return make_node(AST_False, self); @@ -1392,8 +1391,8 @@ merge(Compressor.prototype, { } break; case "||": - var ll = self.left.evaluate(compressor), left = ll[0]; - var rr = self.right.evaluate(compressor), right = rr[0]; + var ll = self.left.evaluate(compressor); + var rr = self.right.evaluate(compressor); if ((ll.length > 1 && ll[1]) || (rr.length > 1 && rr[1])) { compressor.warn("Boolean || always true [{file}:{line},{col}]", self.start); return make_node(AST_True, self); @@ -1406,8 +1405,8 @@ merge(Compressor.prototype, { } break; case "+": - var ll = self.left.evaluate(compressor), left = ll[0]; - var rr = self.right.evaluate(compressor), right = rr[0]; + var ll = self.left.evaluate(compressor); + var rr = self.right.evaluate(compressor); if ((ll.length > 1 && ll[0] instanceof AST_String && ll[1]) || (rr.length > 1 && rr[0] instanceof AST_String && rr[1])) { compressor.warn("+ in boolean context always true [{file}:{line},{col}]", self.start); diff --git a/lib/parse.js b/lib/parse.js index 3bf8d29d..10a0f1af 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -304,10 +304,6 @@ function tokenizer($TEXT, filename) { return ch; }; - function eof() { - return !S.peek(); - }; - function find(what, signal_eof) { var pos = S.text.indexOf(what, S.pos); if (signal_eof && pos == -1) throw EX_EOF; @@ -909,7 +905,7 @@ function parse($TEXT, options) { } expect(":"); S.labels.push(label); - var start = S.token, stat = statement(); + var stat = statement(); S.labels.pop(); return new AST_LabeledStatement({ body: stat, label: label }); }; @@ -1036,7 +1032,7 @@ function parse($TEXT, options) { var switch_body_ = curry(in_loop, function(){ expect("{"); - var a = [], cur = null, branch = null, start = S.token; + var a = [], cur = null, branch = null; while (!is("punc", "}")) { if (is("eof")) unexpected(); if (is("keyword", "case")) { diff --git a/lib/scope.js b/lib/scope.js index 54839c4d..5f4a64a2 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -243,7 +243,7 @@ AST_Lambda.DEFMETHOD("init_scope_vars", function(){ AST_SymbolRef.DEFMETHOD("reference", function() { var def = this.definition(); def.references.push(this); - var orig_scope = def.scope, s = this.scope; + var s = this.scope; while (s) { push_uniq(s.enclosed, def); s = s.parent_scope; |