From 5551c40662b19df3466c1cb24e8d5a0fdb5f6a15 Mon Sep 17 00:00:00 2001 From: Stefan Baumgartner Date: Tue, 13 Jan 2015 11:11:47 +0100 Subject: [PATCH] checking for doubles when warning for empty extends follow up #2369 --- lib/less/visitors/extend-visitor.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/less/visitors/extend-visitor.js b/lib/less/visitors/extend-visitor.js index 5792ef357..2aaba7221 100644 --- a/lib/less/visitors/extend-visitor.js +++ b/lib/less/visitors/extend-visitor.js @@ -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)); @@ -104,6 +105,7 @@ 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) { @@ -111,7 +113,11 @@ ProcessExtendsVisitor.prototype = { 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) {