aboutsummaryrefslogtreecommitdiff
path: root/src/modules.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-01-20 16:03:20 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-01-20 16:03:20 -0800
commit98c1cf33a6e53c54e16035378ff8d0ff5a782461 (patch)
tree692444e950a2ad98076d28e2100b454e6c190e7e /src/modules.js
parentb251f29a2efdc1ceaf6490d0bc3cf8bca0ae5589 (diff)
refactor getProcAddress
Diffstat (limited to 'src/modules.js')
-rw-r--r--src/modules.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/modules.js b/src/modules.js
index d4d86510..325730dd 100644
--- a/src/modules.js
+++ b/src/modules.js
@@ -240,12 +240,17 @@ var Functions = {
// Mark a function as needing indexing. Python will coordinate them all
getIndex: function(ident, doNotCreate) {
+ if (doNotCreate && !(ident in this.indexedFunctions)) {
+ if (!Functions.getIndex.tentative) Functions.getIndex.tentative = {}; // only used by GL emulation; TODO: generalize when needed
+ Functions.getIndex.tentative[ident] = 0;
+ }
if (phase != 'post' && singlePhase) {
if (!doNotCreate) this.indexedFunctions[ident] = 0; // tell python we need this indexized
- return '{{{ FI_' + ident + ' }}}'; // something python will replace later
+ return '"{{ FI_' + ident + ' }}"'; // something python will replace later
} else {
var ret = this.indexedFunctions[ident];
if (!ret) {
+ if (doNotCreate) return '0';
ret = this.nextIndex;
this.nextIndex += 2; // Need to have indexes be even numbers, see |polymorph| test
this.indexedFunctions[ident] = ret;