Add isShallow to getVars in build.js.

Former-commit-id: c863a26a1e43e4ab8b0d4d84ecea78653663660e
This commit is contained in:
John-David Dalton
2013-06-18 08:33:42 -07:00
parent f6d9239b37
commit ee936fe1a1

View File

@@ -1061,11 +1061,15 @@
* *
* @private * @private
* @param {String} source The source to process. * @param {String} source The source to process.
* @param {Boolean} [isShallow=false] A flag to indicate looking for varaibles one closure deep.
* @returns {Array} Returns a new array of variable names. * @returns {Array} Returns a new array of variable names.
*/ */
function getVars(source) { function getVars(source, isShallow) {
var indentA = isRemoved(source, 'runInContext') ? ' {2}' : ' {2,4}', if (isShallow == null) {
indentB = isRemoved(source, 'runInContext') ? ' {6}' : ' {6,8}', isShallow = isRemoved(source, 'runInContext');
}
var indentA = isShallow ? ' {2}' : ' {2,4}',
indentB = isShallow ? ' {6}' : ' {6,8}',
result = []; result = [];
var snippet = removeComments(source); var snippet = removeComments(source);
@@ -3615,9 +3619,9 @@
// remove unused variables // remove unused variables
(function() { (function() {
var useMap = {}, var isShallow = isRemoved(source, 'runInContext'),
varNames = getVars(source), useMap = {},
isShallow = isRemoved(source, 'runInContext'); varNames = getVars(source, isShallow);
while (varNames.length) { while (varNames.length) {
varNames = _.sortBy(varNames, function(varName) { varNames = _.sortBy(varNames, function(varName) {