aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-03-09 16:50:41 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-03-09 16:50:41 -0800
commitb7093afaf4bb9fa593d687d6c9646289e8d75cff (patch)
treef40bc07006f2d74836287a3f7b6ba34188c9ed71
parent0ecad78d552f20c7dfc454489df3eba61361fa06 (diff)
do not wipe out everything after the generated functions suffix; fixes test_embind
-rw-r--r--tools/js_optimizer.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/js_optimizer.py b/tools/js_optimizer.py
index 98b34684..60093bca 100644
--- a/tools/js_optimizer.py
+++ b/tools/js_optimizer.py
@@ -118,7 +118,8 @@ def run_on_js(filename, passes, js_engine, jcache):
suffix_start = js.find(suffix_marker)
suffix = ''
if suffix_start >= 0:
- suffix = js[suffix_start:js.find('\n', suffix_start)] + '\n'
+ suffix_end = js.find('\n', suffix_start)
+ suffix = js[suffix_start:suffix_end] + '\n'
# if there is metadata, we will run only on the generated functions. If there isn't, we will run on everything.
generated = set(eval(suffix[len(suffix_marker)+1:]))
@@ -178,7 +179,10 @@ EMSCRIPTEN_FUNCS();
#if DEBUG: print >> sys.stderr, 'minify info:', minify_info
# remove suffix if no longer needed
if 'last' in passes:
- post = post.split(suffix_marker)[0]
+ suffix_start = post.find(suffix_marker)
+ suffix_end = post.find('\n', suffix_start)
+ post = post[:suffix_start] + post[suffix_end:]
+
else:
pre = ''
post = ''