summaryrefslogtreecommitdiff
path: root/tools/eslint/lib/code-path-analysis
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2016-10-15 11:30:25 -0700
committerRich Trott <rtrott@gmail.com>2016-10-18 15:28:21 -0700
commit2981f24f926da32d708c8bb39d90fff5aa73bc3f (patch)
treee154567c25398160dfe9ac8e27dd79c65a436272 /tools/eslint/lib/code-path-analysis
parent150dc5c2e6a848aa49bb95f4e6c0cbf0da5d0e73 (diff)
downloadnode-new-2981f24f926da32d708c8bb39d90fff5aa73bc3f.tar.gz
tools: update ESLint to v3.8.0
Update ESLint to v3.8.0. * Installed with `npm install --production` to avoid installing unnecessary dev files * Used `dmn -f clean` to further eliminate unneeded files PR-URL: https://github.com/nodejs/node/pull/9112 Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
Diffstat (limited to 'tools/eslint/lib/code-path-analysis')
-rw-r--r--tools/eslint/lib/code-path-analysis/code-path-analyzer.js12
-rw-r--r--tools/eslint/lib/code-path-analysis/code-path-state.js2
-rw-r--r--tools/eslint/lib/code-path-analysis/code-path.js2
-rw-r--r--tools/eslint/lib/code-path-analysis/debug-helpers.js34
-rw-r--r--tools/eslint/lib/code-path-analysis/fork-context.js4
5 files changed, 27 insertions, 27 deletions
diff --git a/tools/eslint/lib/code-path-analysis/code-path-analyzer.js b/tools/eslint/lib/code-path-analysis/code-path-analyzer.js
index 1d3b632c62..655211430b 100644
--- a/tools/eslint/lib/code-path-analysis/code-path-analyzer.js
+++ b/tools/eslint/lib/code-path-analysis/code-path-analyzer.js
@@ -148,7 +148,7 @@ function forwardCurrentToHead(analyzer, node) {
headSegment = headSegments[i];
if (currentSegment !== headSegment && currentSegment) {
- debug.dump("onCodePathSegmentEnd " + currentSegment.id);
+ debug.dump(`onCodePathSegmentEnd ${currentSegment.id}`);
if (currentSegment.reachable) {
analyzer.emitter.emit(
@@ -168,7 +168,7 @@ function forwardCurrentToHead(analyzer, node) {
headSegment = headSegments[i];
if (currentSegment !== headSegment && headSegment) {
- debug.dump("onCodePathSegmentStart " + headSegment.id);
+ debug.dump(`onCodePathSegmentStart ${headSegment.id}`);
CodePathSegment.markUsed(headSegment);
if (headSegment.reachable) {
@@ -197,7 +197,7 @@ function leaveFromCurrentSegment(analyzer, node) {
for (let i = 0; i < currentSegments.length; ++i) {
const currentSegment = currentSegments[i];
- debug.dump("onCodePathSegmentEnd " + currentSegment.id);
+ debug.dump(`onCodePathSegmentEnd ${currentSegment.id}`);
if (currentSegment.reachable) {
analyzer.emitter.emit(
"onCodePathSegmentEnd",
@@ -353,7 +353,7 @@ function processCodePathToEnter(analyzer, node) {
state = CodePath.getState(codePath);
// Emits onCodePathStart events.
- debug.dump("onCodePathStart " + codePath.id);
+ debug.dump(`onCodePathStart ${codePath.id}`);
analyzer.emitter.emit("onCodePathStart", codePath, node);
break;
@@ -546,7 +546,7 @@ function postprocess(analyzer, node) {
leaveFromCurrentSegment(analyzer, node);
// Emits onCodePathEnd event of this code path.
- debug.dump("onCodePathEnd " + codePath.id);
+ debug.dump(`onCodePathEnd ${codePath.id}`);
analyzer.emitter.emit("onCodePathEnd", codePath, node);
debug.dumpDot(codePath);
@@ -643,7 +643,7 @@ CodePathAnalyzer.prototype = {
*/
onLooped(fromSegment, toSegment) {
if (fromSegment.reachable && toSegment.reachable) {
- debug.dump("onCodePathSegmentLoop " + fromSegment.id + " -> " + toSegment.id);
+ debug.dump(`onCodePathSegmentLoop ${fromSegment.id} -> ${toSegment.id}`);
this.emitter.emit(
"onCodePathSegmentLoop",
fromSegment,
diff --git a/tools/eslint/lib/code-path-analysis/code-path-state.js b/tools/eslint/lib/code-path-analysis/code-path-state.js
index 392e3898f6..3b0b1606e2 100644
--- a/tools/eslint/lib/code-path-analysis/code-path-state.js
+++ b/tools/eslint/lib/code-path-analysis/code-path-state.js
@@ -967,7 +967,7 @@ CodePathState.prototype = {
/* istanbul ignore next */
default:
- throw new Error("unknown type: \"" + type + "\"");
+ throw new Error(`unknown type: "${type}"`);
}
},
diff --git a/tools/eslint/lib/code-path-analysis/code-path.js b/tools/eslint/lib/code-path-analysis/code-path.js
index 1e7b76e5ab..96363423c2 100644
--- a/tools/eslint/lib/code-path-analysis/code-path.js
+++ b/tools/eslint/lib/code-path-analysis/code-path.js
@@ -49,7 +49,7 @@ function CodePath(id, upper, onLooped) {
Object.defineProperty(
this,
"internal",
- {value: new CodePathState(new IdGenerator(id + "_"), onLooped)});
+ {value: new CodePathState(new IdGenerator(`${id}_`), onLooped)});
// Adds this into `childCodePaths` of `upper`.
if (upper) {
diff --git a/tools/eslint/lib/code-path-analysis/debug-helpers.js b/tools/eslint/lib/code-path-analysis/debug-helpers.js
index ac163268b6..5e311eb352 100644
--- a/tools/eslint/lib/code-path-analysis/debug-helpers.js
+++ b/tools/eslint/lib/code-path-analysis/debug-helpers.js
@@ -64,10 +64,10 @@ module.exports = {
}
}
- debug(
- state.currentSegments.map(getId).join(",") + ") " +
- node.type + (leaving ? ":exit" : "")
- );
+ debug([
+ `${state.currentSegments.map(getId).join(",")})`,
+ `${node.type}${leaving ? ":exit" : ""}`
+ ].join(" "));
},
/**
@@ -99,7 +99,7 @@ module.exports = {
for (const id in traceMap) { // eslint-disable-line guard-for-in
const segment = traceMap[id];
- text += id + "[";
+ text += `${id}[`;
if (segment.reachable) {
text += "label=\"";
@@ -110,17 +110,17 @@ module.exports = {
if (segment.internal.nodes.length > 0) {
text += segment.internal.nodes.map(function(node) {
switch (node.type) {
- case "Identifier": return node.type + " (" + node.name + ")";
- case "Literal": return node.type + " (" + node.value + ")";
+ case "Identifier": return `${node.type} (${node.name})`;
+ case "Literal": return `${node.type} (${node.value})`;
default: return node.type;
}
}).join("\\n");
} else if (segment.internal.exitNodes.length > 0) {
text += segment.internal.exitNodes.map(function(node) {
switch (node.type) {
- case "Identifier": return node.type + ":exit (" + node.name + ")";
- case "Literal": return node.type + ":exit (" + node.value + ")";
- default: return node.type + ":exit";
+ case "Identifier": return `${node.type}:exit (${node.name})`;
+ case "Literal": return `${node.type}:exit (${node.value})`;
+ default: return `${node.type}:exit`;
}
}).join("\\n");
} else {
@@ -130,7 +130,7 @@ module.exports = {
text += "\"];\n";
}
- text += arrows + "\n";
+ text += `${arrows}\n`;
text += "}";
debug("DOT", text);
},
@@ -147,7 +147,7 @@ module.exports = {
const stack = [[codePath.initialSegment, 0]];
const done = traceMap || Object.create(null);
let lastId = codePath.initialSegment.id;
- let text = "initial->" + codePath.initialSegment.id;
+ let text = `initial->${codePath.initialSegment.id}`;
while (stack.length > 0) {
const item = stack.pop();
@@ -166,9 +166,9 @@ module.exports = {
}
if (lastId === segment.id) {
- text += "->" + nextSegment.id;
+ text += `->${nextSegment.id}`;
} else {
- text += ";\n" + segment.id + "->" + nextSegment.id;
+ text += `;\n${segment.id}->${nextSegment.id}`;
}
lastId = nextSegment.id;
@@ -180,7 +180,7 @@ module.exports = {
if (lastId === finalSegment.id) {
text += "->final";
} else {
- text += ";\n" + finalSegment.id + "->final";
+ text += `;\n${finalSegment.id}->final`;
}
lastId = null;
});
@@ -189,11 +189,11 @@ module.exports = {
if (lastId === finalSegment.id) {
text += "->thrown";
} else {
- text += ";\n" + finalSegment.id + "->thrown";
+ text += `;\n${finalSegment.id}->thrown`;
}
lastId = null;
});
- return text + ";";
+ return `${text};`;
}
};
diff --git a/tools/eslint/lib/code-path-analysis/fork-context.js b/tools/eslint/lib/code-path-analysis/fork-context.js
index f47249b998..6996af1dcc 100644
--- a/tools/eslint/lib/code-path-analysis/fork-context.js
+++ b/tools/eslint/lib/code-path-analysis/fork-context.js
@@ -187,7 +187,7 @@ ForkContext.prototype = {
* @returns {void}
*/
add(segments) {
- assert(segments.length >= this.count, segments.length + " >= " + this.count);
+ assert(segments.length >= this.count, `${segments.length} >= ${this.count}`);
this.segmentsList.push(mergeExtraSegments(this, segments));
},
@@ -200,7 +200,7 @@ ForkContext.prototype = {
* @returns {void}
*/
replaceHead(segments) {
- assert(segments.length >= this.count, segments.length + " >= " + this.count);
+ assert(segments.length >= this.count, `${segments.length} >= ${this.count}`);
this.segmentsList.splice(-1, 1, mergeExtraSegments(this, segments));
},