From db57539c2793c20812dd53bccfd95a7be722cf17 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 9 Jan 2012 14:52:46 -0800 Subject: [PATCH] notice alignment in byval params --- src/jsifier.js | 2 +- src/parseTools.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/jsifier.js b/src/jsifier.js index f8fa0e0f7..3f41c1792 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -520,7 +520,7 @@ function JSify(data, functionsOnly, givenFunctions) { var type = removePointing(param.type); var typeInfo = Types.types[type]; func.JS += ' var tempParam = ' + param.ident + '; ' + param.ident + ' = ' + RuntimeGenerator.stackAlloc(typeInfo.flatSize) + ';' + - makeCopyValues(param.ident, 'tempParam', typeInfo.flatSize, 'null', null, 1) + ';\n'; + makeCopyValues(param.ident, 'tempParam', typeInfo.flatSize, 'null', null, param.byVal) + ';\n'; } }); diff --git a/src/parseTools.js b/src/parseTools.js index 3a88fc255..0601045d4 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -314,12 +314,14 @@ function parseParamTokens(params) { var segment = params.slice(0, i); params = params.slice(i+1); segment = cleanSegment(segment); - var byVal = false; + var byVal = 0; if (segment[1] && segment[1].text === 'byval') { - // handle 'byval' and 'byval align X' - byVal = true; + // handle 'byval' and 'byval align X'. We store the alignment in 'byVal' + byVal = QUANTUM_SIZE; segment.splice(1, 1); if (segment[1] && segment[1].text === 'align') { + assert(isNumber(segment[2].text)); + byVal = parseInt(segment[2].text); segment.splice(1, 2); } }