diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-05-23 10:35:53 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-05-23 10:35:53 -0700 |
commit | 48b7d2a76594a0136444cc666c2532c6bec70e0b (patch) | |
tree | 410f863c0d6e109e2b234fc2c7445c49fc22d847 /src | |
parent | e1703b407293121e2f2133d189c4438d039ea846 (diff) |
fix argument counting regression from 5efd506 ; fixes #1202
Diffstat (limited to 'src')
-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--; |