Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Show callstack in browser upon REPL crashes #2021

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/test-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ function runTest(name, code, options: PrepackOptions, args) {
options.invariantLevel = code.includes("// omit invariants") || args.verbose ? 0 : 99;
if (code.includes("// emit concrete model")) options.emitConcreteModel = true;
if (code.includes("// exceeds stack limit")) options.maxStackDepth = 10;
if (code.includes("// heapGraph")) options.heapGraphFormat = "VISJS";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we need this change anymore.

if (code.includes("// react")) {
options.reactEnabled = true;
options.reactOutput = "jsx";
Expand Down
10 changes: 8 additions & 2 deletions src/utils/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,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;
Expand Down
2 changes: 1 addition & 1 deletion website/js/repl-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
Expand Down