diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-08-26 12:33:43 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-08-26 12:33:52 -0700 |
commit | 38a35036a93b3a96b8324f9943b1430d2ee67b53 (patch) | |
tree | f9f15ca80092bbff56ac375dd9b720ab12941eb1 /src/jsifier.js | |
parent | 422d9a1f3227ae8f47fa8bd0037c2220bb2017f7 (diff) |
re-parse function types after types are fully analyzed, so we get the signatures of functions receiving struct types as parameters
Diffstat (limited to 'src/jsifier.js')
-rw-r--r-- | src/jsifier.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 179a910a..49cfc09a 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -51,6 +51,7 @@ function JSify(data, functionsOnly, givenFunctions) { var pre = processMacros(preprocess(read(preFile).replace('{{RUNTIME}}', getRuntime()))); print(pre); + // Populate implementedFunctions. Note that this is before types, and will be updated later. data.unparsedFunctions.forEach(function(func) { Functions.implementedFunctions[func.ident] = Functions.getSignature(func.returnType, func.params.map(function(param) { return param.type })); }); @@ -1871,6 +1872,12 @@ function JSify(data, functionsOnly, givenFunctions) { // Data if (mainPass) { + if (phase == 'pre') { + // types have been parsed, so we can figure out function signatures (which can use types) + data.unparsedFunctions.forEach(function(func) { + Functions.implementedFunctions[func.ident] = Functions.getSignature(func.returnType, func.params.map(function(param) { return param.type })); + }); + } substrate.addItems(data.functionStubs, 'FunctionStub'); assert(data.functions.length == 0); } else { |