|
|
@ -649,14 +649,26 @@ function Interface() { |
|
|
|
var proto = Interface.prototype, |
|
|
|
ignored = ['pause', 'resume', 'exitRepl', 'handleBreak', |
|
|
|
'requireConnection', 'killChild', 'trySpawn', |
|
|
|
'controlEval', 'debugEval']; |
|
|
|
'controlEval', 'debugEval'], |
|
|
|
synonym = { |
|
|
|
'run': 'r', |
|
|
|
'cont': 'c', |
|
|
|
'next': 'n', |
|
|
|
'step': 's', |
|
|
|
'out': 'o' |
|
|
|
}; |
|
|
|
|
|
|
|
for (var i in proto) { |
|
|
|
if (proto.hasOwnProperty(i) && ignored.indexOf(i) === -1) { |
|
|
|
Object.defineProperty(this.repl.context, i, { |
|
|
|
get: proto[i].bind(this), |
|
|
|
function defineProperty(key, protoKey) { |
|
|
|
Object.defineProperty(self.repl.context, key, { |
|
|
|
get: proto[protoKey].bind(self), |
|
|
|
enumerable: true |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
for (var i in proto) { |
|
|
|
if (proto.hasOwnProperty(i) && ignored.indexOf(i) === -1) { |
|
|
|
defineProperty(i, i); |
|
|
|
if (synonym[i]) defineProperty(synonym[i], i); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -689,35 +701,19 @@ Interface.prototype.resume = function() { |
|
|
|
|
|
|
|
|
|
|
|
Interface.prototype.handleBreak = function(r) { |
|
|
|
var expected = this.paused !== 0; |
|
|
|
|
|
|
|
this.pause(); |
|
|
|
var result = '\n'; |
|
|
|
if (r.breakpoints) { |
|
|
|
result += 'breakpoint'; |
|
|
|
if (r.breakpoints.length > 1) { |
|
|
|
result += 's'; |
|
|
|
} |
|
|
|
result += ' #'; |
|
|
|
for (var i = 0; i < r.breakpoints.length; i++) { |
|
|
|
if (i > 0) { |
|
|
|
result += ', #'; |
|
|
|
} |
|
|
|
result += r.breakpoints[i]; |
|
|
|
} |
|
|
|
} else { |
|
|
|
result += 'break'; |
|
|
|
} |
|
|
|
result += ' in '; |
|
|
|
result += r.invocationText; |
|
|
|
result += ', '; |
|
|
|
result += SourceInfo(r); |
|
|
|
result += '\n'; |
|
|
|
result += SourceUnderline(r.sourceLineText, r.sourceColumn); |
|
|
|
|
|
|
|
this.client.currentSourceLine = r.sourceLine; |
|
|
|
this.client.currentFrame = 0; |
|
|
|
this.client.currentScript = r.script.name; |
|
|
|
|
|
|
|
console.log(result); |
|
|
|
if (!expected) { |
|
|
|
console.log(''); |
|
|
|
} |
|
|
|
console.log(SourceInfo(r)); |
|
|
|
console.log(SourceUnderline(r.sourceLineText, r.sourceColumn)); |
|
|
|
this.resume(); |
|
|
|
}; |
|
|
|
|
|
|
@ -942,8 +938,10 @@ Interface.prototype.cont = function() { |
|
|
|
|
|
|
|
var self = this; |
|
|
|
this.client.reqContinue(function() { |
|
|
|
process.nextTick(function() { |
|
|
|
self.resume(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -955,8 +953,10 @@ Interface.prototype.next = function() { |
|
|
|
|
|
|
|
var self = this; |
|
|
|
this.client.step('next', 1, function(res) { |
|
|
|
process.nextTick(function() { |
|
|
|
self.resume(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -968,8 +968,10 @@ Interface.prototype.step = function() { |
|
|
|
|
|
|
|
var self = this; |
|
|
|
this.client.step('in', 1, function(res) { |
|
|
|
process.nextTick(function() { |
|
|
|
self.resume(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -981,8 +983,10 @@ Interface.prototype.out = function() { |
|
|
|
|
|
|
|
var self = this; |
|
|
|
this.client.step('out', 1, function(res) { |
|
|
|
process.nextTick(function() { |
|
|
|
self.resume(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|