aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/intertyper.js5
-rw-r--r--src/jsifier.js2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/intertyper.js b/src/intertyper.js
index 2ffae602..78827e87 100644
--- a/src/intertyper.js
+++ b/src/intertyper.js
@@ -5,8 +5,9 @@ var LLVM_STYLE = null;
//! @param parseFunctions We parse functions only on later passes, since we do not
//! want to parse all of them at once, and have all their
//! lines and data in memory at the same time.
-function intertyper(data, parseFunctions) {
+function intertyper(data, parseFunctions, baseLineNum) {
//parseFunctions = true; // Uncomment to do all parsing in a single big RAM-heavy pass. Faster, if you have the RAM
+ baseLineNum = baseLineNum || 0;
// Substrate
@@ -45,7 +46,7 @@ function intertyper(data, parseFunctions) {
} else {
ret.push({
lineText: line,
- lineNum: i + 1,
+ lineNum: i + 1 + baseLineNum,
});
if (new RegExp(/^\ +switch\ .*/g).test(line)) {
// beginning of llvm switch
diff --git a/src/jsifier.js b/src/jsifier.js
index 4c02cf26..6bf3e712 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -15,7 +15,7 @@ function JSify(data, functionsOnly, givenTypes, givenFunctions) {
for (var i = 0; i < data.unparsedFunctions.length; i++) {
var func = data.unparsedFunctions[i];
dprint('unparsedFunctions', 'processing |' + func.ident + '|, ' + i + '/' + data.unparsedFunctions.length);
- func.JS = JSify(analyzer(intertyper(func.lines, true), TYPES), true, TYPES, FUNCTIONS);
+ func.JS = JSify(analyzer(intertyper(func.lines, true, func.lineNum-1), TYPES), true, TYPES, FUNCTIONS);
delete func.lines; // clean up memory as much as possible
}