From 987c79e9af73767fd80eff4a49f1496c78bf3719 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 11 Jan 2016 15:38:38 -0800 Subject: [PATCH 1/2] debugger: remove variable redeclarations --- lib/_debugger.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/_debugger.js b/lib/_debugger.js index e1f0f812a5d2b5..56b6b5f4636a75 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -463,7 +463,7 @@ Client.prototype.setBreakpoint = function(req, cb) { }; Client.prototype.clearBreakpoint = function(req, cb) { - var req = { + req = { command: 'clearbreakpoint', arguments: req }; @@ -1353,9 +1353,10 @@ Interface.prototype.setBreakpoint = function(script, line, return; } + var req; if (/\(\)$/.test(script)) { // setBreakpoint('functionname()'); - var req = { + req = { type: 'function', target: script.replace(/\(\)$/, ''), condition: condition @@ -1381,7 +1382,6 @@ Interface.prototype.setBreakpoint = function(script, line, if (ambiguous) return this.error('Script name is ambiguous'); if (line <= 0) return this.error('Line should be a positive value'); - var req; if (scriptId) { req = { type: 'scriptId', @@ -1653,8 +1653,9 @@ Interface.prototype.trySpawn = function(cb) { assert(!this.child); var isRemote = false; + var match; if (this.args.length === 2) { - var match = this.args[1].match(/^([^:]+):(\d+)$/); + match = this.args[1].match(/^([^:]+):(\d+)$/); if (match) { // Connecting to remote debugger @@ -1678,7 +1679,7 @@ Interface.prototype.trySpawn = function(cb) { } isRemote = true; } else { - var match = this.args[1].match(/^--port=(\d+)$/); + match = this.args[1].match(/^--port=(\d+)$/); if (match) { // Start debugger on custom port // `node debug --port=5858 app.js` From 5cdead51bec78da5f8951e849e06a7b7701ad693 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 12 Jan 2016 22:01:19 -0800 Subject: [PATCH 2/2] fixup --- lib/_debugger.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/_debugger.js b/lib/_debugger.js index 56b6b5f4636a75..6bc385378dcc81 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -1353,7 +1353,7 @@ Interface.prototype.setBreakpoint = function(script, line, return; } - var req; + let req; if (/\(\)$/.test(script)) { // setBreakpoint('functionname()'); req = { @@ -1653,9 +1653,8 @@ Interface.prototype.trySpawn = function(cb) { assert(!this.child); var isRemote = false; - var match; if (this.args.length === 2) { - match = this.args[1].match(/^([^:]+):(\d+)$/); + const match = this.args[1].match(/^([^:]+):(\d+)$/); if (match) { // Connecting to remote debugger @@ -1679,7 +1678,7 @@ Interface.prototype.trySpawn = function(cb) { } isRemote = true; } else { - match = this.args[1].match(/^--port=(\d+)$/); + const match = this.args[1].match(/^--port=(\d+)$/); if (match) { // Start debugger on custom port // `node debug --port=5858 app.js`