Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

[debugger] optimize context's properties initialization, make 'list' …

…a function, not a getter
  • Loading branch information...
indutny authored and ry committed Sep 21, 2011
1 parent 3148f14 commit 79fd1f7f0b4e77b1c8660d45cd6628ed6a78ae5b
Showing with 9 additions and 5 deletions.
  1. +9 −5 lib/_debugger.js
@@ -737,13 +737,16 @@ function Interface() {

function defineProperty(key, protoKey) {
// Check arity
var fn = proto[protoKey].bind(self);

if (proto[protoKey].length === 0) {
Object.defineProperty(self.repl.context, key, {
get: proto[protoKey].bind(self),
enumerable: true
get: fn,
enumerable: true,
configurable: false
});
} else {
self.repl.context[key] = proto[protoKey].bind(self);
self.repl.context[key] = fn;
}
};

@@ -1021,12 +1024,13 @@ Interface.prototype.version = function() {
};

// List source code
Interface.prototype.list = function() {
Interface.prototype.list = function(delta) {
if (!this.requireConnection()) return;

delta || (delta = 5);

var self = this,
client = this.client,
delta = arguments[0] || 5,
from = client.currentSourceLine - delta + 1,
to = client.currentSourceLine + delta + 1;

0 comments on commit 79fd1f7

Please sign in to comment.
You can’t perform that action at this time.