diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-07-02 14:20:11 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-07-03 15:31:05 -0700 |
commit | aebf1a7ba53cc744fe69f209126aea37b4eca1c7 (patch) | |
tree | 77c6c71d41d92fb88ec3980b32c2632c2857a312 /src/modules.js | |
parent | 1f4e0951b950db2b4474ae40fb9c42c24fdeec68 (diff) |
refactor getIndex calls to include the signature
Diffstat (limited to 'src/modules.js')
-rw-r--r-- | src/modules.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/modules.js b/src/modules.js index e04304fa..cf5be093 100644 --- a/src/modules.js +++ b/src/modules.js @@ -264,20 +264,25 @@ var Functions = { if (!Functions.getIndex.tentative) Functions.getIndex.tentative = {}; // only used by GL emulation; TODO: generalize when needed Functions.getIndex.tentative[ident] = 0; } + var ret; if (phase != 'post' && singlePhase) { if (!doNotCreate) this.indexedFunctions[ident] = 0; // tell python we need this indexized - return "'{{ FI_" + toNiceIdent(ident) + " }}'"; // something python will replace later + ret = "'{{ FI_" + toNiceIdent(ident) + " }}'"; // something python will replace later } else { if (!singlePhase) return 'NO_INDEX'; // Should not index functions in post - var ret = this.indexedFunctions[ident]; + 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; } - return ret.toString(); + ret = ret.toString(); } + if (BUILD_AS_SHARED_LIB) { + ret = '(FUNCTION_TABLE_OFFSET + ' + ret + ')'; + } + return ret; }, getTable: function(sig) { |