From f8af24b3839c09e46ff99904b62d3a27d5a68a77 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 23 May 2012 00:52:39 -0400 Subject: [PATCH] Remove unneeded variable references. Former-commit-id: ab2f5f4408db25dc63b5d85b4adf156f9f978711 --- build/pre-compile.js | 10 ---------- lodash.js | 14 +++++++------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/build/pre-compile.js b/build/pre-compile.js index fad4c8a3b..1a440c553 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -8,33 +8,24 @@ /** Used to minify variables embedded in compiled strings */ var compiledVars = [ 'accumulator', - 'args', - 'array', 'arrayClass', 'bind', 'callback', 'className', 'collection', - 'concat', 'ctor', 'false', 'funcClass', 'hasOwnProperty', 'identity', 'index', - 'indexOf', - 'isArray', - 'isEmpty', - 'isFunc', 'length', 'object', 'objectTypes', 'noaccum', - 'prop', 'property', 'result', 'skipProto', - 'slice', 'source', 'sourceIndex', 'stringClass', @@ -177,7 +168,6 @@ 'throttle', 'times', 'toArray', - 'toArray', 'union', 'uniq', 'unique', diff --git a/lodash.js b/lodash.js index a1e8c82e0..ffe815dd7 100644 --- a/lodash.js +++ b/lodash.js @@ -391,8 +391,8 @@ 'exit': '', 'init': '', 'top': '', - 'arrayBranch': { 'loopExp': '++index < length' }, - 'objectBranch': {} + 'arrayBranch': { 'beforeLoop': '', 'loopExp': '++index < length' }, + 'objectBranch': { 'beforeLoop': '' } }; while (++index < length) { @@ -427,7 +427,7 @@ data.useHas = data.useHas !== false; if (!data.exit) { - data.exit = 'if (' + firstArg + ' == null) return result'; + data.exit = 'if (!' + firstArg + ') return result'; } if (firstArg == 'object' || !arrayBranch.inLoop) { data.arrayBranch = null; @@ -437,14 +437,14 @@ } // create the function factory var factory = Function( - 'arrayClass, bind, concat, funcClass, hasOwnProperty, identity, indexOf, ' + - 'isArray, isEmpty, objectTypes, slice, stringClass, toString, undefined', + 'arrayClass, bind, funcClass, hasOwnProperty, identity, objectTypes, ' + + 'stringClass, toString, undefined', '"use strict"; return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}' ); // return the compiled function return factory( - arrayClass, bind, concat, funcClass, hasOwnProperty, identity, indexOf, - isArray, isEmpty, objectTypes, slice, stringClass, toString + arrayClass, bind, funcClass, hasOwnProperty, identity, objectTypes, + stringClass, toString ); }