implement getArch for LintingFile type

Fixes the overcaching of files for different arches in jshint
This commit is contained in:
Slava Kim
2015-06-22 19:49:31 -07:00
parent 366afe5c9a
commit 0072c5b538
4 changed files with 18 additions and 2 deletions

View File

@@ -56,7 +56,9 @@ JsHintLinter.prototype.processFilesForTarget = function (files, globals) {
return;
// skip files we already linted
var hashKey = file.getPackageName() + '/' + file.getPathInPackage();
var hashKey = JSON.stringify([
file.getPackageName(), file.getPathInPackage(), file.getArch()]);
if (self.hashDict[hashKey] === file.getSourceHash())
return;
self.hashDict[hashKey] = file.getSourceHash();

View File

@@ -79,6 +79,16 @@ _.extend(exports.InputFile.prototype, {
getSourceHash: function () {
throw new Error("Not Implemented");
},
/**
* @summary Returns a string symbol representing the architecture that is
* targetted by processing this file. Can be used to implement caching.
* XXX BBP is this doc string good?
* @memberof InputFile
* @returns {String}
*/
getArch: function () {
throw new Error("Not Implemented");
},
/**
* @summary Returns the full contents of the file as a string.

View File

@@ -251,7 +251,8 @@ var lintUnibuild = function (options) {
relPath: relPath,
contents: contents,
'package': isopack.name,
hash: hash
hash: hash,
arch: inputSourceArch.arch
};
});

View File

@@ -29,6 +29,9 @@ _.extend(LintingFile.prototype, {
},
getSourceHash: function () {
return this._source.hash;
},
getArch: function () {
return this._source.arch;
}
});