From 2c2397d333f0ce55230f9cd4dc9b9d62fd063c38 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Thu, 8 Sep 2011 10:59:38 +0700 Subject: [PATCH] [debugger] simulate getters --- lib/_debugger.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/_debugger.js b/lib/_debugger.js index 5472fcd0fe0..ae11d236c46 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -652,6 +652,7 @@ function Interface() { for (var i in proto) { if (proto.hasOwnProperty(i) && ignored.indexOf(i) === -1) { this.repl.context[i] = proto[i].bind(this); + this.repl.context[i]._debugger = true; } } @@ -724,6 +725,12 @@ Interface.prototype.requireConnection = function() { Interface.prototype.controlEval = function(code, context, filename, callback) { try { var result = vm.runInContext(code, context, filename); + + // Simulate getters + if (typeof result === 'function' && result._debugger) { + result = result(); + } + if (this.paused === 0) return callback(null, result); this.waiting = function() { callback(null, result);