aboutsummaryrefslogtreecommitdiff
path: root/src/parseTools.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-08-25 16:01:46 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-08-25 16:01:46 -0700
commit5b3b4c5ca4e10ce6ea22fb24ea429cb2c7dc213d (patch)
tree3e6e2bc3d54a0ddac924cc32a06b47bfddc6a85e /src/parseTools.js
parent51c74c1c724281fac1f3f22fc10d7e6c38feb7b8 (diff)
parentb7fcc0e14805f1ef5d0cd70d8d237a005379c73d (diff)
Merge pull request #71 from max99x/master
Varargs for externals, shared lib globals and other fixes
Diffstat (limited to 'src/parseTools.js')
-rw-r--r--src/parseTools.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index 4a2ff3a8..4b3e63e1 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -333,6 +333,15 @@ function parseParamTokens(params) {
return ret;
}
+function hasVarArgs(params) {
+ for (var i = 0; i < params.length; i++) {
+ if (params[i].intertype == 'varargs') {
+ return true;
+ }
+ }
+ return false;
+}
+
function finalizeParam(param) {
if (param.intertype in PARSABLE_LLVM_FUNCTIONS) {
return finalizeLLVMFunctionCall(param);
@@ -687,7 +696,7 @@ function getHeapOffset(offset, type) {
}
// See makeSetValue
-function makeGetValue(ptr, pos, type, noNeedFirst, unsigned) {
+function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore) {
if (isStructType(type)) {
var typeData = Types.types[type];
var ret = [];
@@ -701,7 +710,7 @@ function makeGetValue(ptr, pos, type, noNeedFirst, unsigned) {
if (SAFE_HEAP) {
if (type !== 'null' && type[0] !== '#') type = '"' + safeQuote(type) + '"';
if (type[0] === '#') type = type.substr(1);
- return 'SAFE_HEAP_LOAD(' + offset + ', ' + type + ', ' + (!!unsigned+0) + ', ' + (!checkSafeHeap()+0) + ')';
+ return 'SAFE_HEAP_LOAD(' + offset + ', ' + type + ', ' + (!!unsigned+0) + ', ' + ((!checkSafeHeap() || ignore)|0) + ')';
} else {
return makeGetSlabs(ptr, type, false, unsigned)[0] + '[' + getHeapOffset(offset, type) + ']';
}