aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xemscripten.py13
-rw-r--r--src/jsifier.js2
2 files changed, 9 insertions, 6 deletions
diff --git a/emscripten.py b/emscripten.py
index 19c74531..dbc7b551 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -98,19 +98,22 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,
if DEBUG: t = time.time()
in_func = False
ll_lines = open(infile).readlines()
+ curr_func = None
for line in ll_lines:
if in_func:
- funcs[-1][1].append(line)
+ curr_func.append(line)
if line.startswith('}'):
in_func = False
- funcs[-1] = (funcs[-1][0], ''.join(funcs[-1][1]))
- pre.append(line) # pre needs it to, so we know about all implemented functions
+ funcs.append((curr_func[0], ''.join(curr_func))) # use the entire line as the identifier
+ # pre needs to know about all implemented functions, even for non-pre func
+ pre.append(curr_func[0])
+ pre.append(line)
+ curr_func = None
else:
if line.startswith(';'): continue
if line.startswith('define '):
in_func = True
- funcs.append((line, [line])) # use the entire line as the identifier
- pre.append(line) # pre needs it to, so we know about all implemented functions
+ curr_func = [line]
elif line.find(' = type { ') > 0:
pre.append(line) # type
elif line.startswith('!'):
diff --git a/src/jsifier.js b/src/jsifier.js
index 23fbb4c5..0786f622 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -108,7 +108,7 @@ function JSify(data, functionsOnly, givenFunctions) {
}
});
- if (phase == 'funcs') { // pre has function shells, just to defined implementedFunctions
+ if (phase == 'funcs') { // || phase == 'pre') { // pre has function shells, just to defined implementedFunctions
var MAX_BATCH_FUNC_LINES = 1000;
while (data.unparsedFunctions.length > 0) {
var currFuncLines = [];