diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-11-06 13:51:48 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-11-06 13:51:48 -0800 |
commit | f1341adb3476dcd582b7cb218a864a61a949059d (patch) | |
tree | 5d25cf6c20cb67742300693338996d2aa47790ab /src | |
parent | d1ae32fba535c79a0bb9f9245c617b15c7a7e3d0 (diff) |
process each function separately in emscript
Diffstat (limited to 'src')
-rw-r--r-- | src/modules.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/modules.js b/src/modules.js index d100b8d4..fe2f79cd 100644 --- a/src/modules.js +++ b/src/modules.js @@ -226,15 +226,20 @@ var Functions = { blockAddresses: {}, // maps functions to a map of block labels to label ids - // Mark a function as needing indexing, and returns the index + // Mark a function as needing indexing. Python will coordinate them all getIndex: function(ident) { - var ret = this.indexedFunctions[ident]; - if (!ret) { - ret = this.nextIndex; - this.nextIndex += 2; // Need to have indexes be even numbers, see |polymorph| test - this.indexedFunctions[ident] = ret; + if (phase != 'post') { + this.indexedFunctions[ident] = 0; // tell python we need this indexized + return '{{{ FI_' + ident + ' }}}'; // something python will replace later + } else { + var ret = this.indexedFunctions[ident]; + if (!ret) { + ret = this.nextIndex; + this.nextIndex += 2; // Need to have indexes be even numbers, see |polymorph| test + this.indexedFunctions[ident] = ret; + } + return ret.toString(); } - return ret.toString(); }, // Generate code for function indexing @@ -320,11 +325,13 @@ var PassManager = { for (var i in data.Functions) { Functions[i] = data.Functions[i]; } + /* print('\n//LOADED_DATA:' + phase + ':' + JSON.stringify({ Types: Types, Variables: Variables, Functions: Functions })); + */ } }; |