From 98c1cf33a6e53c54e16035378ff8d0ff5a782461 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sun, 20 Jan 2013 16:03:20 -0800 Subject: refactor getProcAddress --- src/modules.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/modules.js') 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; -- cgit v1.2.3-18-g5258