Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created November 1, 2017 19:06
Show Gist options
  • Save jasonLaster/ded9826e89c1e3ee4490ef4ab09ab2be to your computer and use it in GitHub Desktop.
Save jasonLaster/ded9826e89c1e3ee4490ef4ab09ab2be to your computer and use it in GitHub Desktop.
diff --git a/src/utils/scopes.js b/src/utils/scopes.js
index 79bdc1b..22851bc 100644
--- a/src/utils/scopes.js
+++ b/src/utils/scopes.js
@@ -71,10 +71,12 @@ function getSourceBindingVariables(
}
export function getSpecialVariables(pauseInfo: Pause, path: string) {
- const thrown = get(pauseInfo, "why.frameFinished.throw", undefined);
-
- const returned = get(pauseInfo, "why.frameFinished.return", undefined);
+ if (!pauseInfo.why || !pauseInfo.why.frameFinished) {
+ return;
+ }
+ const thrown = pauseInfo.why.frameFinished.thrown;
+ const returned = pauseInfo.why.frameFinished.return;
const vars = [];
if (thrown !== undefined) {
@@ -125,6 +127,8 @@ export function getScopes(
// NOTE: it's possible that we're inspecting an old server
// that does not support getting frame scopes directly
selectedScope = selectedScope || selectedFrame.scope;
+ const isTopmostFrame = selectedFrame === pauseInfo.frame
+
if (!selectedScope) {
return null;
@@ -135,6 +139,7 @@ export function getScopes(
let scope = selectedScope;
const pausedScopeActor = get(pauseInfo, "frame.scope.actor");
let scopeIndex = 1;
+ const isLocalScope = scopeIndex === 1
do {
const { type, actor } = scope;
@@ -156,7 +161,7 @@ export function getScopes(
: getBindingVariables(bindings, key);
// show exception, return, and this variables in innermost scope
- if (scope.actor === pausedScopeActor) {
+ if (isTopmostFrame && isLocalScope) {
vars = vars.concat(getSpecialVariables(pauseInfo, key));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment