mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
[debugger] optimize context's properties initialization, make 'list' a function, not a getter
This commit is contained in:
parent
3148f1400e
commit
79fd1f7f0b
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user