aboutsummaryrefslogtreecommitdiff
path: root/tools/js-optimizer.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-10-28 21:24:30 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-10-28 21:24:30 -0700
commit3e8911fb2246523ffbbb3c86cd593d2cbb32148c (patch)
tree925ef8cdbb9105629b236fdd8dd3e13edb3a5dda /tools/js-optimizer.js
parentd20e28258f5116882d24ccce55082ed1d9442b8c (diff)
make js optimizer detection of generated functions marker more robust
Diffstat (limited to 'tools/js-optimizer.js')
-rw-r--r--tools/js-optimizer.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index e62402a9..3cd9788f 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -143,7 +143,8 @@ var FALSE_NODE = ['unary-prefix', '!', ['num', 1]];
var GENERATED_FUNCTIONS_MARKER = '// EMSCRIPTEN_GENERATED_FUNCTIONS:';
var generatedFunctions = null;
function setGeneratedFunctions(metadata) {
- generatedFunctions = set(eval(metadata.replace(GENERATED_FUNCTIONS_MARKER, '')));
+ var start = metadata.indexOf(GENERATED_FUNCTIONS_MARKER);
+ generatedFunctions = set(eval(metadata.substr(start + GENERATED_FUNCTIONS_MARKER.length)));
}
function isGenerated(ident) {
return ident in generatedFunctions;
@@ -1869,7 +1870,7 @@ var passes = {
var src = read(arguments_[0]);
var ast = srcToAst(src);
//printErr(JSON.stringify(ast)); throw 1;
-var metadata = src.split('\n').filter(function(line) { return line.indexOf('EMSCRIPTEN_GENERATED_FUNCTIONS') >= 0 })[0];
+var metadata = src.split('\n').filter(function(line) { return line.indexOf(GENERATED_FUNCTIONS_MARKER) >= 0 })[0];
//assert(metadata, 'Must have EMSCRIPTEN_GENERATED_FUNCTIONS metadata');
if (metadata) setGeneratedFunctions(metadata);