Skip to content

Commit ac306cb

Browse files
authored
emscripten no longer allows modifying Module['print'] at runtime. Modify the internal out() method instead. see emscripten-core/emscripten#6756 (#1614)
1 parent 11047d8 commit ac306cb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/js/binaryen.js-post.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,19 +1163,19 @@ Module['Module'] = function(module) {
11631163
return Module['_BinaryenSetStart'](module, start);
11641164
};
11651165
this['emitText'] = function() {
1166-
var old = Module['print'];
1166+
var old = out;
11671167
var ret = '';
1168-
Module['print'] = function(x) { ret += x + '\n' };
1168+
out = function(x) { ret += x + '\n' };
11691169
Module['_BinaryenModulePrint'](module);
1170-
Module['print'] = old;
1170+
out = old;
11711171
return ret;
11721172
};
11731173
this['emitAsmjs'] = function() {
1174-
var old = Module['print'];
1174+
var old = out;
11751175
var ret = '';
1176-
Module['print'] = function(x) { ret += x + '\n' };
1176+
out = function(x) { ret += x + '\n' };
11771177
Module['_BinaryenModulePrintAsmjs'](module);
1178-
Module['print'] = old;
1178+
out = old;
11791179
return ret;
11801180
};
11811181
this['validate'] = function() {
@@ -1550,11 +1550,11 @@ Module['emitText'] = function(expr) {
15501550
if (typeof expr === 'object') {
15511551
return expr.emitText();
15521552
}
1553-
var old = Module['print'];
1553+
var old = out;
15541554
var ret = '';
1555-
Module['print'] = function(x) { ret += x + '\n' };
1555+
out = function(x) { ret += x + '\n' };
15561556
Module['_BinaryenExpressionPrint'](expr);
1557-
Module['print'] = old;
1557+
out = old;
15581558
return ret;
15591559
};
15601560

0 commit comments

Comments
 (0)