tools: update ESLint to 2.7.0

PR-URL: https://github.com/nodejs/node/pull/6132
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: thefourtheye <thechargingvolcano@gmail.com>
This commit is contained in:
silverwind 2016-04-09 14:11:01 +02:00
parent 8f4fdc93f0
commit 2f6ff1bb64
No known key found for this signature in database
GPG key ID: 2E62B41C93869443
2040 changed files with 40696 additions and 36989 deletions

View file

@ -79,6 +79,7 @@ function isReachable(segment) {
* @param {boolean} reachable - A flag which shows this is reachable.
*/
function CodePathSegment(id, allPrevSegments, reachable) {
/**
* The identifier of this code path.
* Rules use it to store additional information of each rule.
@ -120,7 +121,8 @@ function CodePathSegment(id, allPrevSegments, reachable) {
// Internal data.
Object.defineProperty(this, "internal", {value: {
used: false
used: false,
loopedPrevSegments: []
}});
/* istanbul ignore if */
@ -130,6 +132,20 @@ function CodePathSegment(id, allPrevSegments, reachable) {
}
}
CodePathSegment.prototype = {
constructor: CodePathSegment,
/**
* Checks a given previous segment is coming from the end of a loop.
*
* @param {CodePathSegment} segment - A previous segment to check.
* @returns {boolean} `true` if the segment is coming from the end of a loop.
*/
isLoopedPrevSegment: function(segment) {
return this.internal.loopedPrevSegments.indexOf(segment) !== -1;
}
};
/**
* Creates the root segment.
*
@ -191,6 +207,7 @@ CodePathSegment.markUsed = function(segment) {
segment.internal.used = true;
var i;
if (segment.reachable) {
for (i = 0; i < segment.allPrevSegments.length; ++i) {
var prevSegment = segment.allPrevSegments[i];
@ -205,4 +222,15 @@ CodePathSegment.markUsed = function(segment) {
}
};
/**
* Marks a previous segment as looped.
*
* @param {CodePathSegment} segment - A segment.
* @param {CodePathSegment} prevSegment - A previous segment to mark.
* @returns {void}
*/
CodePathSegment.markPrevSegmentAsLooped = function(segment, prevSegment) {
segment.internal.loopedPrevSegments.push(prevSegment);
};
module.exports = CodePathSegment;