Skip to content

Commit

Permalink
debugger: remove variable redeclarations
Browse files Browse the repository at this point in the history
Some variables are declared with var more than once in the same scope.
This change reduces the declarations to one per scope.

PR-URL: nodejs#4633
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
Trott authored and Michael Scovetta committed Apr 2, 2016
1 parent bdec218 commit 307e0a5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/_debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ Client.prototype.setBreakpoint = function(req, cb) {
};

Client.prototype.clearBreakpoint = function(req, cb) {
var req = {
req = {
command: 'clearbreakpoint',
arguments: req
};
Expand Down Expand Up @@ -1353,9 +1353,10 @@ Interface.prototype.setBreakpoint = function(script, line,
return;
}

let req;
if (/\(\)$/.test(script)) {
// setBreakpoint('functionname()');
var req = {
req = {
type: 'function',
target: script.replace(/\(\)$/, ''),
condition: condition
Expand All @@ -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',
Expand Down Expand Up @@ -1652,7 +1652,7 @@ Interface.prototype.trySpawn = function(cb) {

var isRemote = false;
if (this.args.length === 2) {
var match = this.args[1].match(/^([^:]+):(\d+)$/);
const match = this.args[1].match(/^([^:]+):(\d+)$/);

if (match) {
// Connecting to remote debugger
Expand All @@ -1676,7 +1676,7 @@ Interface.prototype.trySpawn = function(cb) {
}
isRemote = true;
} else {
var 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`
Expand Down

0 comments on commit 307e0a5

Please sign in to comment.