diff options
-rw-r--r-- | src/jsifier.js | 2 | ||||
-rw-r--r-- | src/parseTools.js | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 8ab96a25..2c83d036 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1357,7 +1357,7 @@ function JSify(data, functionsOnly, givenFunctions) { var ignoreFunctionIndexizing = []; var useJSArgs = (simpleIdent + '__jsargs') in LibraryManager.library; var hasVarArgs = isVarArgsFunctionType(type); - var normalArgs = (hasVarArgs && !useJSArgs) ? countNormalArgs(type) : -1; + var normalArgs = (hasVarArgs && !useJSArgs) ? countNormalArgs(type, null, true) : -1; var byPointer = getVarData(funcData, ident); var byPointerForced = false; diff --git a/src/parseTools.js b/src/parseTools.js index 8639ba35..45046558 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -290,18 +290,18 @@ function isVarArgsFunctionType(type) { return type.substr(-varArgsSuffix.length) == varArgsSuffix; } -function getNumVars(type) { // how many variables are needed to represent this type +function getNumLegalizedVars(type) { // how many legalized variables are needed to represent this type if (type in Runtime.FLOAT_TYPES) return 1; return Math.max(getNumIntChunks(type), 1); } -function countNormalArgs(type, out) { +function countNormalArgs(type, out, legalized) { out = out || {}; if (!isFunctionType(type, out)) return -1; var ret = 0; if (out.segments) { for (var i = 0; i < out.segments.length; i++) { - ret += getNumVars(out.segments[i][0].text); + ret += legalized ? getNumLegalizedVars(out.segments[i][0].text) : 1; } } if (isVarArgsFunctionType(type)) ret--; |