@@ -53,13 +53,6 @@ function missingDirective(name: string, isComponent: boolean) {
5353 'available inside a template. Consider adding it to a NgModule declaration.' ;
5454}
5555
56- /**
57- * Logs an error for an impossible state with a certain message.
58- */
59- function logImpossibleState ( message : string ) {
60- console . error ( `Impossible state: ${ message } ` ) ;
61- }
62-
6356/**
6457 * Performs a variety diagnostics on directive declarations.
6558 *
@@ -85,14 +78,14 @@ export function getDeclarationDiagnostics(
8578
8679 const sf = host . getSourceFile ( type . filePath ) ;
8780 if ( ! sf ) {
88- logImpossibleState ( `directive ${ type . name } exists but has no source file` ) ;
81+ host . error ( `directive ${ type . name } exists but has no source file` ) ;
8982 return [ ] ;
9083 }
9184 // TypeScript identifier of the directive declaration annotation (e.g. "Component" or
9285 // "Directive") on a directive class.
9386 const directiveIdentifier = findTightestNode ( sf , declarationSpan . start ) ;
9487 if ( ! directiveIdentifier ) {
95- logImpossibleState ( `directive ${ type . name } exists but has no identifier` ) ;
88+ host . error ( `directive ${ type . name } exists but has no identifier` ) ;
9689 return [ ] ;
9790 }
9891
@@ -138,7 +131,7 @@ export function getDeclarationDiagnostics(
138131 const templateUrlNode = findPropertyValueOfType (
139132 directiveIdentifier . parent , 'templateUrl' , ts . isLiteralExpression ) ;
140133 if ( ! templateUrlNode ) {
141- logImpossibleState ( `templateUrl ${ templateUrl } exists but its TypeScript node doesn't` ) ;
134+ host . error ( `templateUrl ${ templateUrl } exists but its TypeScript node doesn't` ) ;
142135 return [ ] ;
143136 }
144137
@@ -151,7 +144,7 @@ export function getDeclarationDiagnostics(
151144 const styleUrlsNode = findPropertyValueOfType (
152145 directiveIdentifier . parent , 'styleUrls' , ts . isArrayLiteralExpression ) ;
153146 if ( ! styleUrlsNode ) {
154- logImpossibleState ( `styleUrls property exists but its TypeScript node doesn't'` ) ;
147+ host . error ( `styleUrls property exists but its TypeScript node doesn't'` ) ;
155148 return [ ] ;
156149 }
157150
0 commit comments