aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-03-21 19:48:26 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-03-21 19:48:26 -0700
commit24856d20699818b35f01963e4144c87d1a5c56ff (patch)
treeade6915ad86dedcc646eec29bcca845d5bf90212 /src/jsifier.js
parent98f6e8924d27246f40f50ec3f75084f1f04b6459 (diff)
optimize FUNCTION_POINTER and exporting
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 2c33eba1..7a7bc47f 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -117,7 +117,7 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
function indexizeFunctions(value) { // TODO: Also check for other functions (externals, library, etc.)
if (value in FUNCTIONS) {
- value = value + '.__index__'; // Store integer value
+ value = Functions.getIndex(value); // Store integer value
}
return value;
}
@@ -537,7 +537,10 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
func.JS += ' return' + (func.returnType !== 'void' ? ' null' : '') + ';\n';
}
func.JS += '}\n';
- func.JS += func.ident + '.__index__ = Runtime.getFunctionIndex(' + func.ident + ', "' + func.ident + '");\n';
+ if (func.ident in EXPORTED_FUNCTIONS) {
+ func.JS += 'Module["' + func.ident + '"] = ' + func.ident + ';';
+ }
+
return func;
}
});
@@ -1170,6 +1173,7 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
var pre = processMacros(preprocess(read('preamble.js').replace('{{RUNTIME}}', getRuntime()), CONSTANTS));
print(pre);
generated.forEach(function(item) { print(indentify(item.JS || '', 2)); });
+ print(Functions.generateIndexing());
var postParts = processMacros(preprocess(read('postamble.js'), CONSTANTS)).split('{{GLOBAL_VARS}}');
print(postParts[0]);