diff options
author | Xuejie Xiao <xxuejie@gmail.com> | 2012-12-10 20:41:58 -0500 |
---|---|---|
committer | Xuejie Xiao <xxuejie@gmail.com> | 2012-12-10 20:47:47 -0500 |
commit | 3732b13dce850dd6dc43ab390a7caf363d9d8edd (patch) | |
tree | cf55fefff939b60b05dffe37b34d51de4d22c26a /src/jsifier.js | |
parent | 1522befda65f6bc6c9cf5234ae7e078437cb5e65 (diff) |
Remove regexp case since it is slow and rarely used
Diffstat (limited to 'src/jsifier.js')
-rw-r--r-- | src/jsifier.js | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index ea278342..aaa827bb 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -486,25 +486,17 @@ function JSify(data, functionsOnly, givenFunctions) { } }); - function functionNameFilterTest(ident) { - if (LABEL_FUNCTION_FILTERS.length == 0) { - // empty array means filter is disabled + // function for filtering functions for label debugging + if (LABEL_FUNCTION_FILTERS.length > 0) { + var LABEL_FUNCTION_FILTER_SET = set(LABEL_FUNCTION_FILTERS); + var functionNameFilterTest = function(ident) { + return (ident in LABEL_FUNCTION_FILTER_SET); + }; + } else { + // no filters are specified, all function names are printed + var functionNameFilterTest = function(ident) { return true; } - - for (var i = 0; i < LABEL_FUNCTION_FILTERS.length; i++) { - var filter = LABEL_FUNCTION_FILTERS[i]; - var match = false; - - if (typeof filter == 'string') { - match = (filter == ident); - } else if (filter instanceof RegExp) { // typeof would return 'object' for RegExp - match = filter.test(ident); - } - - if (match) return true; - } - return false; } // function reconstructor & post-JS optimizer |