@@ -180,7 +180,7 @@ public void process(Node externs, Node root) {
180
180
cssNamesBySymbol .put (getCssNameInstance .getCssClosureClassesMemberName (), cssClassName );
181
181
classesObjectsQualifiedNames .add (getCssNameInstance .getCssClosureClassesQualifiedName ());
182
182
} else {
183
- updateCssNamesCount (cssClassName );
183
+ cssNameCollector . add (cssClassName );
184
184
}
185
185
getCssNameInstance .replaceWithExpression ();
186
186
}
@@ -316,24 +316,6 @@ private class TraversalState {
316
316
}
317
317
}
318
318
319
- /**
320
- * Update the count of CSS class names.
321
- *
322
- * <p>We maintain a count of references to CSS classes, so that unused classes can be flagged.
323
- *
324
- * <p>Unused class matching is always done by-part: if a CSS class definition or reference
325
- * contains hyphens, each hyphenated section is checked separately. For example, if the CSS class
326
- * contains .myComponent-highlight, it can be satisfied by separate calls to
327
- * goog.getCssName('myComponent') and goog.getCssName('highlight'). A single call to
328
- * goog.getCssName('myComponent-highlight') will also work.
329
- */
330
- private void updateCssNamesCount (String cssClassName ) {
331
- String [] parts = cssClassName .split ("-" , -1 );
332
- for (String element : parts ) {
333
- cssNameCollector .add (element );
334
- }
335
- }
336
-
337
319
private boolean isNotInCssClosureFile (Node node ) {
338
320
String sourceFileName = node .getSourceFileName ();
339
321
return sourceFileName == null || !sourceFileName .endsWith (".css.closure.js" );
@@ -585,7 +567,7 @@ public void visit(NodeTraversal t, Node n, Node parent) {
585
567
return ;
586
568
}
587
569
String className = cssNamesBySymbol .get (classQualifiedName );
588
- updateCssNamesCount (className );
570
+ cssNameCollector . add (className );
589
571
}
590
572
}
591
573
}
0 commit comments