aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-04-09 16:32:22 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-04-09 17:26:57 -0700
commit6d67e17176321f4c9c9bcf9aa9cd9d4db5c33aa5 (patch)
treee90be484a70d769cd7ae6bc98cef794884a45b87 /src/jsifier.js
parent7b2d1583a184edef4b920982426706224b937414 (diff)
only emit postsets in pre and when they actually exist
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 6ef9781c..eab4a88d 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1527,12 +1527,15 @@ function JSify(data, functionsOnly, givenFunctions) {
} else {
print('/* no memory initializer */'); // test purposes
}
+
+ // Run postsets right before main, and after the memory initializer has been set up
+ if (itemsDict.GlobalVariablePostSet.length > 0) {
+ print('__ATMAIN__.push(function() {\n');
+ print(itemsDict.GlobalVariablePostSet.map(function(item) { return item.JS }).join('\n'));
+ print('});\n');
+ }
}
- // Run postsets right before main, and after the memory initializer has been set up
- print('__ATMAIN__.push(function() {\n');
- print(itemsDict.GlobalVariablePostSet.map(function(item) { return item.JS }).join('\n'));
- print('});\n');
return;
}