Skip to content

Commit e772dea

Browse files
Added this to locals window
1 parent b3abb01 commit e772dea

2 files changed

Lines changed: 28 additions & 4 deletions

File tree

demo/a.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ console.error('this is an error')
4343

4444
var d = 10;
4545

46+
var Person = function (firstName, lastName) {
47+
this.firstName = firstName;
48+
this.lastName = lastName;
49+
this.toString = function() {
50+
return firstName + " " + lastName;
51+
}
52+
};
53+
54+
var person = new Person('Alice', 'Babs');
55+
console.log(person.toString());
56+
4657
b(100, function(err, res) {
4758
result = res
4859
console.log('result is: ', result)

lib/Components/CallStackPane.coffee

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ exports.create = (_debugger) ->
9090
TreeViewItem("#{name} : function() { ... }")
9191
when 'object'
9292
decorate = (title) -> (state) -> if state.isOpen then title else "#{title} { ... }"
93-
ref = value.value.ref
93+
ref = value.value.ref || value.value.handle
9494
TreeView(decorate("#{name} : #{className}"), (() => builder.loadProperties(ref).map(builder.property)))
9595

9696
frame: (frame) ->
@@ -128,13 +128,26 @@ exports.create = (_debugger) ->
128128
builder2 =
129129
selectedFrame: null
130130

131+
loadThis: () ->
132+
_debugger.eval("this")
133+
.then (result) ->
134+
return [{
135+
name: "___this___"
136+
value: result
137+
}]
138+
.catch ->
139+
return []
140+
131141
loadLocals: () ->
132142
framePromise = if builder2.selectedFrame then Promise.resolve(builder2.selectedFrame)
133143
else builder.loadFrames().then (frames) -> return frames[0]
144+
thisPromise = builder2.loadThis()
134145

135-
framePromise
136-
.then (frame) ->
137-
return frame.arguments.concat(frame.locals)
146+
Promise.all [framePromise, thisPromise]
147+
.then (result) ->
148+
frame = result[0]
149+
_this = result[1]
150+
return _this.concat(frame.arguments.concat(frame.locals))
138151

139152
root: () ->
140153
sortLocals = (locals) ->

0 commit comments

Comments
 (0)