diff options
author | Alon Zakai <azakai@mozilla.com> | 2010-11-14 21:23:48 -0800 |
---|---|---|
committer | Alon Zakai <azakai@mozilla.com> | 2010-11-14 21:23:48 -0800 |
commit | ee0166c83cd91a469bbe2d1da3c27f180da7b582 (patch) | |
tree | ca61137046a01c43e3579c93ef9bc5a0cee4a7a3 /src/jsifier.js | |
parent | 1a9c1c95c6552f835f53493299e90a9f6743c6f7 (diff) |
handle global constants that are llvm function calls +test
Diffstat (limited to 'src/jsifier.js')
-rw-r--r-- | src/jsifier.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index bac2038d..4c02cf26 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -147,7 +147,9 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) { // Gets an entire constant expression function parseConst(value, type) { //dprint('gconst', '//yyyyy ' + JSON.stringify(value) + ',' + type + '\n'); - if (Runtime.isNumberType(type) || pointingLevels(type) >= 1) { + if (value.intertype) { + return makePointer(finalizeLLVMFunctionCall(value), null, 'ALLOC_STATIC', type); + } else if (Runtime.isNumberType(type) || pointingLevels(type) >= 1) { return makePointer(indexizeFunctions(parseNumerical(toNiceIdent(value.text))), null, 'ALLOC_STATIC', type); } else if (value.text == 'zeroinitializer') { return makePointer(JSON.stringify(makeEmptyStruct(type)), null, 'ALLOC_STATIC', type); @@ -222,7 +224,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) { item.JS = 'var ' + item.ident + ';'; return [item, { intertype: 'GlobalVariable', - JS: 'globalFuncs.push(function() { ' + item.ident + ' = ' + parseConst(item.value, item.type) + ' });', + JS: 'globalFuncs.push(function() { return ' + item.ident + ' = ' + parseConst(item.value, item.type) + ' });', __result__: true, }]; } |