aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-06-26 00:24:46 +0300
committermax99x <max99x@gmail.com>2011-06-26 00:24:46 +0300
commitb7cd8aad767e9cb4b0555a60c489966df8dc9405 (patch)
tree4c4eec0c69e1ad03d83588d96f35d87bcedcdbf3 /src/jsifier.js
parent37a1ccacaa79addac6094983897d67e0a8630160 (diff)
Fixed function indexing issues between parent and child;
Child no longer includes library, using the parent's instead.
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index ac45d829..d4f3be66 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -200,7 +200,10 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
processItem: function(item) {
var ret = [item];
var shortident = item.ident.substr(1);
- if (shortident in Library) {
+ if (BUILD_AS_SHARED_LIB) {
+ // Shared libraries reuse the runtime of their parents.
+ item.JS = '';
+ } else if (shortident in Library) {
function addFromLibrary(ident) {
if (ident in addedLibraryItems) return '';
// Don't replace implemented functions with library ones (which can happen when we add dependencies).
@@ -261,13 +264,7 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
} else {
ident = '_' + ident;
}
- var depsString = deps ? '\n' + deps.map(addFromLibrary).join('\n') : '';
- if (BUILD_AS_SHARED_LIB) {
- var defString = 'if (typeof ' + ident + ' === "undefined") {\n this.' + ident + '=' + snippet + ';\n}';
- } else {
- var defString = 'var ' + ident + '=' + snippet + ';';
- }
- return depsString + defString;
+ return (deps ? '\n' + deps.map(addFromLibrary).join('\n') : '') + 'var ' + ident + '=' + snippet + ';';
}
item.JS = addFromLibrary(shortident);
} else {