Show callstack in browser upon REPL crashes

Summary:
Fixing some incompatibility between heapGraph and `__optimize()`.
Essence of the issue was an implicit assumption that only one visitor would visit certain entries.

Original Issue: https://github.com/facebook/prepack/issues/1732
Closes https://github.com/facebook/prepack/pull/2021

Reviewed By: trueadm

Differential Revision: D8248761

Pulled By: caiismyname

fbshipit-source-id: dd27487b490e3924fdc0fe6aaca7f1c103e137cb
This commit is contained in:
David Cai 2018-06-03 07:32:10 -07:00 committed by Facebook Github Bot
parent 8bf0e78a58
commit d96eaf45c4
2 changed files with 9 additions and 3 deletions

View File

@ -260,9 +260,15 @@ class ModifiedBindingEntry extends GeneratorEntry {
containingGenerator === this.containingGenerator,
"This entry requires effects to be applied and may not be moved"
);
invariant(this.modifiedBinding.value === this.newValue);
invariant(
this.modifiedBinding.value === this.newValue,
"ModifiedBinding's value has been changed since last visit."
);
let [residualBinding, newValue] = context.visitModifiedBinding(this.modifiedBinding);
invariant(this.residualFunctionBinding === undefined || this.residualFunctionBinding === residualBinding);
invariant(
this.residualFunctionBinding === undefined || this.residualFunctionBinding === residualBinding,
"ResidualFunctionBinding has been changed since last visit."
);
this.residualFunctionBinding = residualBinding;
this.newValue = newValue;
return true;

View File

@ -42,7 +42,7 @@ onmessage = function(e) {
}
} catch (err) {
buffer.push({
message: err.message || 'An unknown error occurred'
message: err.stack || 'An unknown error occurred'
});
postMessage({ type: 'error', data: buffer });
}