diff options
Diffstat (limited to 'src/modules.js')
-rw-r--r-- | src/modules.js | 7 |
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; |