@@ -25,8 +25,8 @@ exports.start = function(argv, stdin, stdout) {
25
25
stdin = stdin || process . stdin ;
26
26
stdout = stdout || process . stdout ;
27
27
28
- var args = [ '--debug-brk' ] . concat ( argv ) ,
29
- interface_ = new Interface ( stdin , stdout , args ) ;
28
+ const args = [ '--debug-brk' ] . concat ( argv ) ;
29
+ const interface_ = new Interface ( stdin , stdout , args ) ;
30
30
31
31
stdin . resume ( ) ;
32
32
@@ -197,8 +197,8 @@ Client.prototype._removeScript = function(desc) {
197
197
198
198
199
199
Client . prototype . _onResponse = function ( res ) {
200
- var cb ,
201
- index = - 1 ;
200
+ var cb ;
201
+ var index = - 1 ;
202
202
203
203
this . _reqCallbacks . some ( function ( fn , i ) {
204
204
if ( fn . request_seq == res . body . request_seq ) {
@@ -295,11 +295,11 @@ Client.prototype.reqLookup = function(refs, cb) {
295
295
} ;
296
296
297
297
Client . prototype . reqScopes = function ( cb ) {
298
- var self = this ,
299
- req = {
300
- command : 'scopes' ,
301
- arguments : { }
302
- } ;
298
+ const self = this ;
299
+ const req = {
300
+ command : 'scopes' ,
301
+ arguments : { }
302
+ } ;
303
303
304
304
cb = cb || function ( ) { } ;
305
305
this . req ( req , function ( err , res ) {
@@ -525,8 +525,8 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
525
525
return ;
526
526
}
527
527
528
- var mirror ,
529
- waiting = 1 ;
528
+ var mirror ;
529
+ var waiting = 1 ;
530
530
531
531
if ( handle . className == 'Array' ) {
532
532
mirror = [ ] ;
@@ -676,8 +676,8 @@ var helpMessage = 'Commands: ' + commands.map(function(group) {
676
676
function SourceUnderline ( sourceText , position , repl ) {
677
677
if ( ! sourceText ) return '' ;
678
678
679
- var head = sourceText . slice ( 0 , position ) ,
680
- tail = sourceText . slice ( position ) ;
679
+ const head = sourceText . slice ( 0 , position ) ;
680
+ var tail = sourceText . slice ( position ) ;
681
681
682
682
// Colourize char if stdout supports colours
683
683
if ( repl . useColors ) {
@@ -697,8 +697,8 @@ function SourceInfo(body) {
697
697
698
698
if ( body . script ) {
699
699
if ( body . script . name ) {
700
- var name = body . script . name ,
701
- dir = path . resolve ( ) + '/' ;
700
+ var name = body . script . name ;
701
+ const dir = path . resolve ( ) + '/' ;
702
702
703
703
// Change path to relative, if possible
704
704
if ( name . indexOf ( dir ) === 0 ) {
@@ -969,8 +969,8 @@ Interface.prototype.controlEval = function(code, context, filename, callback) {
969
969
Interface . prototype . debugEval = function ( code , context , filename , callback ) {
970
970
if ( ! this . requireConnection ( ) ) return ;
971
971
972
- var self = this ,
973
- client = this . client ;
972
+ const self = this ;
973
+ const client = this . client ;
974
974
975
975
// Repl asked for scope variables
976
976
if ( code === '.scope' ) {
@@ -1004,9 +1004,9 @@ Interface.prototype.debugEval = function(code, context, filename, callback) {
1004
1004
// Adds spaces and prefix to number
1005
1005
// maxN is a maximum number we should have space for
1006
1006
function leftPad ( n , prefix , maxN ) {
1007
- var s = n . toString ( ) ,
1008
- nchars = Math . max ( 2 , String ( maxN ) . length ) + 1 ,
1009
- nspaces = nchars - s . length - 1 ;
1007
+ const s = n . toString ( ) ;
1008
+ const nchars = Math . max ( 2 , String ( maxN ) . length ) + 1 ;
1009
+ const nspaces = nchars - s . length - 1 ;
1010
1010
1011
1011
for ( var i = 0 ; i < nspaces ; i ++ ) {
1012
1012
prefix += ' ' ;
@@ -1078,10 +1078,10 @@ Interface.prototype.list = function(delta) {
1078
1078
1079
1079
delta || ( delta = 5 ) ;
1080
1080
1081
- var self = this ,
1082
- client = this . client ,
1083
- from = client . currentSourceLine - delta + 1 ,
1084
- to = client . currentSourceLine + delta + 1 ;
1081
+ const self = this ;
1082
+ const client = this . client ;
1083
+ const from = client . currentSourceLine - delta + 1 ;
1084
+ const to = client . currentSourceLine + delta + 1 ;
1085
1085
1086
1086
self . pause ( ) ;
1087
1087
client . reqSource ( from , to , function ( err , res ) {
@@ -1096,12 +1096,12 @@ Interface.prototype.list = function(delta) {
1096
1096
var lineno = res . fromLine + i + 1 ;
1097
1097
if ( lineno < from || lineno > to ) continue ;
1098
1098
1099
- var current = lineno == 1 + client . currentSourceLine ,
1100
- breakpoint = client . breakpoints . some ( function ( bp ) {
1101
- return ( bp . scriptReq === client . currentScript ||
1102
- bp . script === client . currentScript ) &&
1103
- bp . line == lineno ;
1104
- } ) ;
1099
+ const current = lineno == 1 + client . currentSourceLine ;
1100
+ const breakpoint = client . breakpoints . some ( function ( bp ) {
1101
+ return ( bp . scriptReq === client . currentScript ||
1102
+ bp . script === client . currentScript ) &&
1103
+ bp . line == lineno ;
1104
+ } ) ;
1105
1105
1106
1106
if ( lineno == 1 ) {
1107
1107
// The first line needs to have the module wrapper filtered out of
@@ -1139,8 +1139,8 @@ Interface.prototype.list = function(delta) {
1139
1139
Interface . prototype . backtrace = function ( ) {
1140
1140
if ( ! this . requireConnection ( ) ) return ;
1141
1141
1142
- var self = this ,
1143
- client = this . client ;
1142
+ const self = this ;
1143
+ const client = this . client ;
1144
1144
1145
1145
self . pause ( ) ;
1146
1146
client . fullTrace ( function ( err , bt ) {
@@ -1153,8 +1153,8 @@ Interface.prototype.backtrace = function() {
1153
1153
if ( bt . totalFrames == 0 ) {
1154
1154
self . print ( '(empty stack)' ) ;
1155
1155
} else {
1156
- var trace = [ ] ,
1157
- firstFrameNative = bt . frames [ 0 ] . script . isNative ;
1156
+ const trace = [ ] ;
1157
+ const firstFrameNative = bt . frames [ 0 ] . script . isNative ;
1158
1158
1159
1159
for ( var i = 0 ; i < bt . frames . length ; i ++ ) {
1160
1160
var frame = bt . frames [ i ] ;
@@ -1183,9 +1183,9 @@ Interface.prototype.backtrace = function() {
1183
1183
Interface . prototype . scripts = function ( ) {
1184
1184
if ( ! this . requireConnection ( ) ) return ;
1185
1185
1186
- var client = this . client ,
1187
- displayNatives = arguments [ 0 ] || false ,
1188
- scripts = [ ] ;
1186
+ const client = this . client ;
1187
+ const displayNatives = arguments [ 0 ] || false ;
1188
+ const scripts = [ ] ;
1189
1189
1190
1190
this . pause ( ) ;
1191
1191
for ( var id in client . scripts ) {
@@ -1323,9 +1323,9 @@ Interface.prototype.setBreakpoint = function(script, line,
1323
1323
condition , silent ) {
1324
1324
if ( ! this . requireConnection ( ) ) return ;
1325
1325
1326
- var self = this ,
1327
- scriptId ,
1328
- ambiguous ;
1326
+ const self = this ;
1327
+ var scriptId ;
1328
+ var ambiguous ;
1329
1329
1330
1330
// setBreakpoint() should insert breakpoint on current line
1331
1331
if ( script === undefined ) {
@@ -1429,10 +1429,10 @@ Interface.prototype.setBreakpoint = function(script, line,
1429
1429
Interface . prototype . clearBreakpoint = function ( script , line ) {
1430
1430
if ( ! this . requireConnection ( ) ) return ;
1431
1431
1432
- var ambiguous ,
1433
- breakpoint ,
1434
- scriptId ,
1435
- index ;
1432
+ var ambiguous ;
1433
+ var breakpoint ;
1434
+ var scriptId ;
1435
+ var index ;
1436
1436
1437
1437
this . client . breakpoints . some ( function ( bp , i ) {
1438
1438
if ( bp . scriptId === script ||
@@ -1474,10 +1474,8 @@ Interface.prototype.clearBreakpoint = function(script, line) {
1474
1474
return this . error ( 'Breakpoint not found on line ' + line ) ;
1475
1475
}
1476
1476
1477
- var self = this ,
1478
- req = {
1479
- breakpoint : breakpoint
1480
- } ;
1477
+ var self = this ;
1478
+ const req = { breakpoint} ;
1481
1479
1482
1480
self . pause ( ) ;
1483
1481
self . client . clearBreakpoint ( req , function ( err , res ) {
@@ -1513,8 +1511,8 @@ Interface.prototype.breakpoints = function() {
1513
1511
Interface . prototype . pause_ = function ( ) {
1514
1512
if ( ! this . requireConnection ( ) ) return ;
1515
1513
1516
- var self = this ,
1517
- cmd = 'process._debugPause();' ;
1514
+ const self = this ;
1515
+ const cmd = 'process._debugPause();' ;
1518
1516
1519
1517
this . pause ( ) ;
1520
1518
this . client . reqFrameEval ( cmd , NO_FRAME , function ( err , res ) {
@@ -1621,11 +1619,11 @@ Interface.prototype.killChild = function() {
1621
1619
1622
1620
// Spawns child process (and restores breakpoints)
1623
1621
Interface . prototype . trySpawn = function ( cb ) {
1624
- var self = this ,
1625
- breakpoints = this . breakpoints || [ ] ,
1626
- port = exports . port ,
1627
- host = '127.0.0.1' ,
1628
- childArgs = this . args ;
1622
+ const self = this ;
1623
+ const breakpoints = this . breakpoints || [ ] ;
1624
+ var port = exports . port ;
1625
+ var host = '127.0.0.1' ;
1626
+ var childArgs = this . args ;
1629
1627
1630
1628
this . killChild ( ) ;
1631
1629
assert ( ! this . child ) ;
@@ -1676,8 +1674,8 @@ Interface.prototype.trySpawn = function(cb) {
1676
1674
1677
1675
this . pause ( ) ;
1678
1676
1679
- var client = self . client = new Client ( ) ,
1680
- connectionAttempts = 0 ;
1677
+ const client = self . client = new Client ( ) ;
1678
+ var connectionAttempts = 0 ;
1681
1679
1682
1680
client . once ( 'ready' , function ( ) {
1683
1681
self . stdout . write ( ' ok\n' ) ;
0 commit comments