Skip to content

Commit

Permalink
Merge pull request #2385 from ddprrt/extend-warnings
Browse files Browse the repository at this point in the history
checking for doubles when warning for empty extends
  • Loading branch information
lukeapage committed Jan 13, 2015
2 parents c036495 + 5551c40 commit ea6bd41
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/less/visitors/extend-visitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ var ProcessExtendsVisitor = function() {
ProcessExtendsVisitor.prototype = {
run: function(root) {
var extendFinder = new ExtendFinderVisitor();
this.extendIndicies = {};
extendFinder.run(root);
if (!extendFinder.foundExtends) { return root; }
root.allExtends = root.allExtends.concat(this.doExtendChaining(root.allExtends, root.allExtends));
Expand All @@ -104,14 +105,19 @@ ProcessExtendsVisitor.prototype = {
return newRoot;
},
checkExtendsForNonMatched: function(extendList) {
var indicies = this.extendIndicies;
extendList.filter(function(extend) {
return !extend.hasFoundMatches && extend.parent_ids.length == 1;
}).forEach(function(extend) {
var selector = "_unknown_";
try {
selector = extend.selector.toCSS({});
}catch(_){}
logger.warn("extend '"+selector+"' has no matches");

if(!indicies[extend.index + ' ' + selector]) {
indicies[extend.index + ' ' + selector] = true;
logger.warn("extend '"+selector+"' has no matches");
}
});
},
doExtendChaining: function (extendsList, extendsListTarget, iterationCount) {
Expand Down

0 comments on commit ea6bd41

Please sign in to comment.