@ -25,8 +25,8 @@ exports.start = function(argv, stdin, stdout) {
stdin = stdin || process . stdin ;
stdout = stdout || process . stdout ;
var args = [ '--debug-brk' ] . concat ( argv ) ,
interface_ = new Interface ( stdin , stdout , args ) ;
const args = [ '--debug-brk' ] . concat ( argv ) ;
const interface_ = new Interface ( stdin , stdout , args ) ;
stdin . resume ( ) ;
@ -197,8 +197,8 @@ Client.prototype._removeScript = function(desc) {
Client . prototype . _ onResponse = function ( res ) {
var cb ,
index = - 1 ;
var cb ;
var index = - 1 ;
this . _ reqCallbacks . some ( function ( fn , i ) {
if ( fn . request_seq == res . body . request_seq ) {
@ -295,11 +295,11 @@ Client.prototype.reqLookup = function(refs, cb) {
} ;
Client . prototype . reqScopes = function ( cb ) {
var self = this ,
req = {
command : 'scopes' ,
arguments : { }
} ;
const self = this ;
const req = {
command : 'scopes' ,
arguments : { }
} ;
cb = cb || function ( ) { } ;
this . req ( req , function ( err , res ) {
@ -525,8 +525,8 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
return ;
}
var mirror ,
waiting = 1 ;
var mirror ;
var waiting = 1 ;
if ( handle . className == 'Array' ) {
mirror = [ ] ;
@ -676,8 +676,8 @@ var helpMessage = 'Commands: ' + commands.map(function(group) {
function SourceUnderline ( sourceText , position , repl ) {
if ( ! sourceText ) return '' ;
var head = sourceText . slice ( 0 , position ) ,
tail = sourceText . slice ( position ) ;
const head = sourceText . slice ( 0 , position ) ;
var tail = sourceText . slice ( position ) ;
// Colourize char if stdout supports colours
if ( repl . useColors ) {
@ -697,8 +697,8 @@ function SourceInfo(body) {
if ( body . script ) {
if ( body . script . name ) {
var name = body . script . name ,
dir = path . resolve ( ) + '/' ;
var name = body . script . name ;
const dir = path . resolve ( ) + '/' ;
// Change path to relative, if possible
if ( name . indexOf ( dir ) === 0 ) {
@ -969,8 +969,8 @@ Interface.prototype.controlEval = function(code, context, filename, callback) {
Interface . prototype . debugEval = function ( code , context , filename , callback ) {
if ( ! this . requireConnection ( ) ) return ;
var self = this ,
client = this . client ;
const self = this ;
const client = this . client ;
// Repl asked for scope variables
if ( code === '.scope' ) {
@ -1004,9 +1004,9 @@ Interface.prototype.debugEval = function(code, context, filename, callback) {
// Adds spaces and prefix to number
// maxN is a maximum number we should have space for
function leftPad ( n , prefix , maxN ) {
var s = n . toString ( ) ,
nchars = Math . max ( 2 , String ( maxN ) . length ) + 1 ,
nspaces = nchars - s . length - 1 ;
const s = n . toString ( ) ;
const nchars = Math . max ( 2 , String ( maxN ) . length ) + 1 ;
const nspaces = nchars - s . length - 1 ;
for ( var i = 0 ; i < nspaces ; i ++ ) {
prefix += ' ' ;
@ -1078,10 +1078,10 @@ Interface.prototype.list = function(delta) {
delta || ( delta = 5 ) ;
var self = this ,
client = this . client ,
from = client . currentSourceLine - delta + 1 ,
to = client . currentSourceLine + delta + 1 ;
const self = this ;
const client = this . client ;
const from = client . currentSourceLine - delta + 1 ;
const to = client . currentSourceLine + delta + 1 ;
self . pause ( ) ;
client . reqSource ( from , to , function ( err , res ) {
@ -1096,12 +1096,12 @@ Interface.prototype.list = function(delta) {
var lineno = res . fromLine + i + 1 ;
if ( lineno < from || lineno > to ) continue ;
var current = lineno == 1 + client . currentSourceLine ,
breakpoint = client . breakpoints . some ( function ( bp ) {
return ( bp . scriptReq === client . currentScript ||
bp . script === client . currentScript ) &&
bp . line == lineno ;
} ) ;
const current = lineno == 1 + client . currentSourceLine ;
const breakpoint = client . breakpoints . some ( function ( bp ) {
return ( bp . scriptReq === client . currentScript ||
bp . script === client . currentScript ) &&
bp . line == lineno ;
} ) ;
if ( lineno == 1 ) {
// The first line needs to have the module wrapper filtered out of
@ -1139,8 +1139,8 @@ Interface.prototype.list = function(delta) {
Interface . prototype . backtrace = function ( ) {
if ( ! this . requireConnection ( ) ) return ;
var self = this ,
client = this . client ;
const self = this ;
const client = this . client ;
self . pause ( ) ;
client . fullTrace ( function ( err , bt ) {
@ -1153,8 +1153,8 @@ Interface.prototype.backtrace = function() {
if ( bt . totalFrames == 0 ) {
self . print ( '(empty stack)' ) ;
} else {
var trace = [ ] ,
firstFrameNative = bt . frames [ 0 ] . script . isNative ;
const trace = [ ] ;
const firstFrameNative = bt . frames [ 0 ] . script . isNative ;
for ( var i = 0 ; i < bt . frames . length ; i ++ ) {
var frame = bt . frames [ i ] ;
@ -1183,9 +1183,9 @@ Interface.prototype.backtrace = function() {
Interface . prototype . scripts = function ( ) {
if ( ! this . requireConnection ( ) ) return ;
var client = this . client ,
displayNatives = arguments [ 0 ] || false ,
scripts = [ ] ;
const client = this . client ;
const displayNatives = arguments [ 0 ] || false ;
const scripts = [ ] ;
this . pause ( ) ;
for ( var id in client . scripts ) {
@ -1323,9 +1323,9 @@ Interface.prototype.setBreakpoint = function(script, line,
condition , silent ) {
if ( ! this . requireConnection ( ) ) return ;
var self = this ,
scriptId ,
ambiguous ;
const self = this ;
var scriptId ;
var ambiguous ;
// setBreakpoint() should insert breakpoint on current line
if ( script === undefined ) {
@ -1429,10 +1429,10 @@ Interface.prototype.setBreakpoint = function(script, line,
Interface . prototype . clearBreakpoint = function ( script , line ) {
if ( ! this . requireConnection ( ) ) return ;
var ambiguous ,
breakpoint ,
scriptId ,
index ;
var ambiguous ;
var breakpoint ;
var scriptId ;
var index ;
this . client . breakpoints . some ( function ( bp , i ) {
if ( bp . scriptId === script ||
@ -1474,10 +1474,8 @@ Interface.prototype.clearBreakpoint = function(script, line) {
return this . error ( 'Breakpoint not found on line ' + line ) ;
}
var self = this ,
req = {
breakpoint : breakpoint
} ;
var self = this ;
const req = { breakpoint } ;
self . pause ( ) ;
self . client . clearBreakpoint ( req , function ( err , res ) {
@ -1513,8 +1511,8 @@ Interface.prototype.breakpoints = function() {
Interface . prototype . pause_ = function ( ) {
if ( ! this . requireConnection ( ) ) return ;
var self = this ,
cmd = 'process._debugPause();' ;
const self = this ;
const cmd = 'process._debugPause();' ;
this . pause ( ) ;
this . client . reqFrameEval ( cmd , NO_FRAME , function ( err , res ) {
@ -1621,11 +1619,11 @@ Interface.prototype.killChild = function() {
// Spawns child process (and restores breakpoints)
Interface . prototype . trySpawn = function ( cb ) {
var self = this ,
breakpoints = this . breakpoints || [ ] ,
port = exports . port ,
host = '127.0.0.1' ,
childArgs = this . args ;
const self = this ;
const breakpoints = this . breakpoints || [ ] ;
var port = exports . port ;
var host = '127.0.0.1' ;
var childArgs = this . args ;
this . killChild ( ) ;
assert ( ! this . child ) ;
@ -1676,8 +1674,8 @@ Interface.prototype.trySpawn = function(cb) {
this . pause ( ) ;
var client = self . client = new Client ( ) ,
connectionAttempts = 0 ;
const client = self . client = new Client ( ) ;
var connectionAttempts = 0 ;
client . once ( 'ready' , function ( ) {
self . stdout . write ( ' ok\n' ) ;