diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-03-24 11:14:04 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-03-24 11:14:04 -0700 |
commit | 97b99d6e689d0740b85be1ad7279df7a1ca74f7f (patch) | |
tree | 8fd5715165fc35aeeae7fcb581e455f369368195 /src | |
parent | e309c2077097725c71e2cd0f20d3ada3b5f79bf6 (diff) |
fix caching of asm const strings; fixes #2253
Diffstat (limited to 'src')
-rw-r--r-- | src/runtime.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/runtime.js b/src/runtime.js index 2ae68279..edcbf637 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -399,17 +399,17 @@ var Runtime = { for (var i = 0; i < numArgs; i++) { args.push(String.fromCharCode(36) + i); // $0, $1 etc } - code = Pointer_stringify(code); - if (code[0] === '"') { + var source = Pointer_stringify(code); + if (source[0] === '"') { // tolerate EM_ASM("..code..") even though EM_ASM(..code..) is correct - if (code.indexOf('"', 1) === code.length-1) { - code = code.substr(1, code.length-2); + if (source.indexOf('"', 1) === source.length-1) { + source = source.substr(1, source.length-2); } else { // something invalid happened, e.g. EM_ASM("..code($0)..", input) - abort('invalid EM_ASM input |' + code + '|. Please use EM_ASM(..code..) (no quotes) or EM_ASM({ ..code($0).. }, input) (to input values)'); + abort('invalid EM_ASM input |' + source + '|. Please use EM_ASM(..code..) (no quotes) or EM_ASM({ ..code($0).. }, input) (to input values)'); } } - return Runtime.asmConstCache[code] = eval('(function(' + args.join(',') + '){ ' + code + ' })'); // new Function does not allow upvars in node + return Runtime.asmConstCache[code] = eval('(function(' + args.join(',') + '){ ' + source + ' })'); // new Function does not allow upvars in node }, warnOnce: function(text) { |