diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-10-28 13:32:23 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-10-28 13:32:23 -0700 |
commit | 7b963a2a7060eeacd624b73c9645455642f3ec0d (patch) | |
tree | 423c1b45cd2678ed7a751775a925d61b67b27d13 | |
parent | 1f9f5f9a820f7251f04127b8ae90e910413759ce (diff) |
IGNORE_FUNCTIONS option
-rw-r--r-- | src/jsifier.js | 2 | ||||
-rw-r--r-- | src/settings.js | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 91cfbe6a..bd432001 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -300,6 +300,7 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) { substrate.addActor('FunctionStub', { processItem: function(item) { var ret = [item]; + if (IGNORED_FUNCTIONS.indexOf(item.ident) >= 0) return null; var shortident = item.ident.substr(1); if (BUILD_AS_SHARED_LIB) { // Shared libraries reuse the runtime of their parents. @@ -410,6 +411,7 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) { funcs: {}, seen: {}, processItem: function(item) { + if (IGNORED_FUNCTIONS.indexOf(item.ident) >= 0) return null; if (this.seen[item.__uid__]) return null; if (item.intertype == 'function') { this.funcs[item.ident] = item; diff --git a/src/settings.js b/src/settings.js index 0fdc445d..0e70316f 100644 --- a/src/settings.js +++ b/src/settings.js @@ -116,6 +116,13 @@ PROFILE = 0; // Enables runtime profiling. See test_profiling for a usage exampl EXPORTED_FUNCTIONS = ['_main']; // Functions that are explicitly exported, so they are guaranteed to // be accessible outside of the generated code. +IGNORED_FUNCTIONS = []; // Functions that we should not generate, neither a stub nor a complete function. + // This is useful if your project code includes a function, and you want to replace + // that in the compiled code with your own handwritten JS. (Of course even without + // this option, you could just override the generated function at runtime. However, + // JS engines might optimize better if the function is defined once in a single + // place in your code.) + EXPORTED_GLOBALS = []; // Global non-function variables that are explicitly // exported, so they are guaranteed to be // accessible outside of the generated code. |