summaryrefslogtreecommitdiff
path: root/modules/script
diff options
context:
space:
mode:
authorNasah <nasahnash19@gmail.com>2022-07-15 22:24:48 +0100
committerNasah <nasahnash19@gmail.com>2022-07-23 17:39:24 +0100
commitd1b9de1c7530e982482fb4775bef56608ab5a18f (patch)
tree893f8aef738fc65845e5f587ff78ea3e2d22db4c /modules/script
parenta4519094885fae4887a5472369e94d875cad7fb6 (diff)
downloadgjs-d1b9de1c7530e982482fb4775bef56608ab5a18f.tar.gz
automatically adding () to the expression to be printed
An expression like {a:2} is ambiguous since it can be an object literal with property a and value 2 or a statement block with label a and one expression inside, 2. Adding () disambiguates {}.
Diffstat (limited to 'modules/script')
-rw-r--r--modules/script/_bootstrap/debugger.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/script/_bootstrap/debugger.js b/modules/script/_bootstrap/debugger.js
index 6ae0d9c2..dc42228f 100644
--- a/modules/script/_bootstrap/debugger.js
+++ b/modules/script/_bootstrap/debugger.js
@@ -324,10 +324,12 @@ function splitPrintOptions(s, style) {
function doPrint(expr, style) {
// This is the real deal.
+ expr = `(${expr})`;
const cv = saveExcursion(
() => focusedFrame === null
? debuggeeGlobalWrapper.executeInGlobalWithBindings(expr, debuggeeValues)
: focusedFrame.evalWithBindings(expr, debuggeeValues));
+
if (cv === null) {
print('Debuggee died.');
} else if ('return' in cv) {