diff options
-rw-r--r-- | src/analyzer.js | 17 | ||||
-rw-r--r-- | src/jsifier.js | 17 |
2 files changed, 18 insertions, 16 deletions
diff --git a/src/analyzer.js b/src/analyzer.js index bae05ec8..9b8af51b 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -1124,21 +1124,6 @@ function analyzer(data) { }, 'Sorter'); // Solve it - var ret = substrate.solve(); - - // Add additional necessary items - if (INCLUDE_FULL_LIBRARY) { - assert(!BUILD_AS_SHARED_LIB, 'Cannot have both INCLUDE_FULL_LIBRARY and BUILD_AS_SHARED_LIB set.') - var libFuncsToInclude = keys(Library); - } else { - var libFuncsToInclude = ['memset', 'malloc', 'free']; - } - libFuncsToInclude.forEach(function(ident) { - ret.functionStubs.push({ - intertype: 'functionStub', - ident: '_' + ident - }); - }); - return ret; + return substrate.solve(); } diff --git a/src/jsifier.js b/src/jsifier.js index d20812ae..4af1223a 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -3,6 +3,23 @@ // Main function function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) { + // Add additional necessary items for the main pass + if (!functionsOnly) { + var libFuncsToInclude; + if (INCLUDE_FULL_LIBRARY) { + assert(!BUILD_AS_SHARED_LIB, 'Cannot have both INCLUDE_FULL_LIBRARY and BUILD_AS_SHARED_LIB set.') + libFuncsToInclude = keys(Library); + } else { + libFuncsToInclude = ['memset', 'malloc', 'free']; + } + libFuncsToInclude.forEach(function(ident) { + data.functionStubs.push({ + intertype: 'functionStub', + ident: '_' + ident + }); + }); + } + // Does simple 'macro' substitution, using Django-like syntax, // {{{ code }}} will be replaced with |eval(code)|. function processMacros(text) { |