@@ -26,8 +26,8 @@ exports.start = function(argv, stdin, stdout) {
26
26
stdin = stdin || process . stdin ;
27
27
stdout = stdout || process . stdout ;
28
28
29
- var args = [ '--debug-brk' ] . concat ( argv ) ,
30
- interface_ = new Interface ( stdin , stdout , args ) ;
29
+ const args = [ '--debug-brk' ] . concat ( argv ) ;
30
+ const interface_ = new Interface ( stdin , stdout , args ) ;
31
31
32
32
stdin . resume ( ) ;
33
33
@@ -198,8 +198,8 @@ Client.prototype._removeScript = function(desc) {
198
198
199
199
200
200
Client . prototype . _onResponse = function ( res ) {
201
- var cb ,
202
- index = - 1 ;
201
+ var cb ;
202
+ var index = - 1 ;
203
203
204
204
this . _reqCallbacks . some ( function ( fn , i ) {
205
205
if ( fn . request_seq == res . body . request_seq ) {
@@ -296,11 +296,11 @@ Client.prototype.reqLookup = function(refs, cb) {
296
296
} ;
297
297
298
298
Client . prototype . reqScopes = function ( cb ) {
299
- var self = this ,
300
- req = {
301
- command : 'scopes' ,
302
- arguments : { }
303
- } ;
299
+ const self = this ;
300
+ const req = {
301
+ command : 'scopes' ,
302
+ arguments : { }
303
+ } ;
304
304
305
305
cb = cb || function ( ) { } ;
306
306
this . req ( req , function ( err , res ) {
@@ -526,8 +526,8 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
526
526
return ;
527
527
}
528
528
529
- var mirror ,
530
- waiting = 1 ;
529
+ var mirror ;
530
+ var waiting = 1 ;
531
531
532
532
if ( handle . className == 'Array' ) {
533
533
mirror = [ ] ;
@@ -678,8 +678,8 @@ var helpMessage = 'Commands: ' + commands.map(function(group) {
678
678
function SourceUnderline ( sourceText , position , repl ) {
679
679
if ( ! sourceText ) return '' ;
680
680
681
- var head = sourceText . slice ( 0 , position ) ,
682
- tail = sourceText . slice ( position ) ;
681
+ const head = sourceText . slice ( 0 , position ) ;
682
+ var tail = sourceText . slice ( position ) ;
683
683
684
684
// Colourize char if stdout supports colours
685
685
if ( repl . useColors ) {
@@ -699,8 +699,8 @@ function SourceInfo(body) {
699
699
700
700
if ( body . script ) {
701
701
if ( body . script . name ) {
702
- var name = body . script . name ,
703
- dir = path . resolve ( ) + '/' ;
702
+ var name = body . script . name ;
703
+ const dir = path . resolve ( ) + '/' ;
704
704
705
705
// Change path to relative, if possible
706
706
if ( name . indexOf ( dir ) === 0 ) {
@@ -977,8 +977,8 @@ Interface.prototype.controlEval = function(code, context, filename, callback) {
977
977
Interface . prototype . debugEval = function ( code , context , filename , callback ) {
978
978
if ( ! this . requireConnection ( ) ) return ;
979
979
980
- var self = this ,
981
- client = this . client ;
980
+ const self = this ;
981
+ const client = this . client ;
982
982
983
983
// Repl asked for scope variables
984
984
if ( code === '.scope' ) {
@@ -1012,9 +1012,9 @@ Interface.prototype.debugEval = function(code, context, filename, callback) {
1012
1012
// Adds spaces and prefix to number
1013
1013
// maxN is a maximum number we should have space for
1014
1014
function leftPad ( n , prefix , maxN ) {
1015
- var s = n . toString ( ) ,
1016
- nchars = Math . max ( 2 , String ( maxN ) . length ) + 1 ,
1017
- nspaces = nchars - s . length - 1 ;
1015
+ const s = n . toString ( ) ;
1016
+ const nchars = Math . max ( 2 , String ( maxN ) . length ) + 1 ;
1017
+ const nspaces = nchars - s . length - 1 ;
1018
1018
1019
1019
for ( var i = 0 ; i < nspaces ; i ++ ) {
1020
1020
prefix += ' ' ;
@@ -1086,10 +1086,10 @@ Interface.prototype.list = function(delta) {
1086
1086
1087
1087
delta || ( delta = 5 ) ;
1088
1088
1089
- var self = this ,
1090
- client = this . client ,
1091
- from = client . currentSourceLine - delta + 1 ,
1092
- to = client . currentSourceLine + delta + 1 ;
1089
+ const self = this ;
1090
+ const client = this . client ;
1091
+ const from = client . currentSourceLine - delta + 1 ;
1092
+ const to = client . currentSourceLine + delta + 1 ;
1093
1093
1094
1094
self . pause ( ) ;
1095
1095
client . reqSource ( from , to , function ( err , res ) {
@@ -1104,12 +1104,12 @@ Interface.prototype.list = function(delta) {
1104
1104
var lineno = res . fromLine + i + 1 ;
1105
1105
if ( lineno < from || lineno > to ) continue ;
1106
1106
1107
- var current = lineno == 1 + client . currentSourceLine ,
1108
- breakpoint = client . breakpoints . some ( function ( bp ) {
1109
- return ( bp . scriptReq === client . currentScript ||
1110
- bp . script === client . currentScript ) &&
1111
- bp . line == lineno ;
1112
- } ) ;
1107
+ const current = lineno == 1 + client . currentSourceLine ;
1108
+ const breakpoint = client . breakpoints . some ( function ( bp ) {
1109
+ return ( bp . scriptReq === client . currentScript ||
1110
+ bp . script === client . currentScript ) &&
1111
+ bp . line == lineno ;
1112
+ } ) ;
1113
1113
1114
1114
if ( lineno == 1 ) {
1115
1115
// The first line needs to have the module wrapper filtered out of
@@ -1147,8 +1147,8 @@ Interface.prototype.list = function(delta) {
1147
1147
Interface . prototype . backtrace = function ( ) {
1148
1148
if ( ! this . requireConnection ( ) ) return ;
1149
1149
1150
- var self = this ,
1151
- client = this . client ;
1150
+ const self = this ;
1151
+ const client = this . client ;
1152
1152
1153
1153
self . pause ( ) ;
1154
1154
client . fullTrace ( function ( err , bt ) {
@@ -1161,8 +1161,8 @@ Interface.prototype.backtrace = function() {
1161
1161
if ( bt . totalFrames == 0 ) {
1162
1162
self . print ( '(empty stack)' ) ;
1163
1163
} else {
1164
- var trace = [ ] ,
1165
- firstFrameNative = bt . frames [ 0 ] . script . isNative ;
1164
+ const trace = [ ] ;
1165
+ const firstFrameNative = bt . frames [ 0 ] . script . isNative ;
1166
1166
1167
1167
for ( var i = 0 ; i < bt . frames . length ; i ++ ) {
1168
1168
var frame = bt . frames [ i ] ;
@@ -1191,9 +1191,9 @@ Interface.prototype.backtrace = function() {
1191
1191
Interface . prototype . scripts = function ( ) {
1192
1192
if ( ! this . requireConnection ( ) ) return ;
1193
1193
1194
- var client = this . client ,
1195
- displayNatives = arguments [ 0 ] || false ,
1196
- scripts = [ ] ;
1194
+ const client = this . client ;
1195
+ const displayNatives = arguments [ 0 ] || false ;
1196
+ const scripts = [ ] ;
1197
1197
1198
1198
this . pause ( ) ;
1199
1199
for ( var id in client . scripts ) {
@@ -1331,9 +1331,9 @@ Interface.prototype.setBreakpoint = function(script, line,
1331
1331
condition , silent ) {
1332
1332
if ( ! this . requireConnection ( ) ) return ;
1333
1333
1334
- var self = this ,
1335
- scriptId ,
1336
- ambiguous ;
1334
+ const self = this ;
1335
+ var scriptId ;
1336
+ var ambiguous ;
1337
1337
1338
1338
// setBreakpoint() should insert breakpoint on current line
1339
1339
if ( script === undefined ) {
@@ -1437,10 +1437,10 @@ Interface.prototype.setBreakpoint = function(script, line,
1437
1437
Interface . prototype . clearBreakpoint = function ( script , line ) {
1438
1438
if ( ! this . requireConnection ( ) ) return ;
1439
1439
1440
- var ambiguous ,
1441
- breakpoint ,
1442
- scriptId ,
1443
- index ;
1440
+ var ambiguous ;
1441
+ var breakpoint ;
1442
+ var scriptId ;
1443
+ var index ;
1444
1444
1445
1445
this . client . breakpoints . some ( function ( bp , i ) {
1446
1446
if ( bp . scriptId === script ||
@@ -1482,10 +1482,8 @@ Interface.prototype.clearBreakpoint = function(script, line) {
1482
1482
return this . error ( 'Breakpoint not found on line ' + line ) ;
1483
1483
}
1484
1484
1485
- var self = this ,
1486
- req = {
1487
- breakpoint : breakpoint
1488
- } ;
1485
+ var self = this ;
1486
+ const req = { breakpoint} ;
1489
1487
1490
1488
self . pause ( ) ;
1491
1489
self . client . clearBreakpoint ( req , function ( err , res ) {
@@ -1521,8 +1519,8 @@ Interface.prototype.breakpoints = function() {
1521
1519
Interface . prototype . pause_ = function ( ) {
1522
1520
if ( ! this . requireConnection ( ) ) return ;
1523
1521
1524
- var self = this ,
1525
- cmd = 'process._debugPause();' ;
1522
+ const self = this ;
1523
+ const cmd = 'process._debugPause();' ;
1526
1524
1527
1525
this . pause ( ) ;
1528
1526
this . client . reqFrameEval ( cmd , NO_FRAME , function ( err , res ) {
@@ -1643,11 +1641,11 @@ Interface.prototype.killChild = function() {
1643
1641
1644
1642
// Spawns child process (and restores breakpoints)
1645
1643
Interface . prototype . trySpawn = function ( cb ) {
1646
- var self = this ,
1647
- breakpoints = this . breakpoints || [ ] ,
1648
- port = exports . port ,
1649
- host = '127.0.0.1' ,
1650
- childArgs = this . args ;
1644
+ const self = this ;
1645
+ const breakpoints = this . breakpoints || [ ] ;
1646
+ var port = exports . port ;
1647
+ var host = '127.0.0.1' ;
1648
+ var childArgs = this . args ;
1651
1649
1652
1650
this . killChild ( ) ;
1653
1651
assert ( ! this . child ) ;
@@ -1698,8 +1696,8 @@ Interface.prototype.trySpawn = function(cb) {
1698
1696
1699
1697
this . pause ( ) ;
1700
1698
1701
- var client = self . client = new Client ( ) ,
1702
- connectionAttempts = 0 ;
1699
+ const client = self . client = new Client ( ) ;
1700
+ var connectionAttempts = 0 ;
1703
1701
1704
1702
client . once ( 'ready' , function ( ) {
1705
1703
self . stdout . write ( ' ok\n' ) ;
0 commit comments