@@ -160,22 +160,21 @@ impl<'a> Translator<'a> {
160160 }
161161 }
162162
163- fn location_for_node ( & mut self , node : & impl ast:: AstNode ) -> ( LineCol , LineCol ) {
163+ fn location_for_node ( & mut self , node : & impl ast:: AstNode ) -> Option < ( LineCol , LineCol ) > {
164164 self . text_range_for_node ( node)
165165 . and_then ( |r| self . location ( r) )
166- . unwrap_or ( UNKNOWN_LOCATION )
167166 }
168167
169168 pub fn emit_location < T : TrapClass > ( & mut self , label : Label < T > , node : & impl ast:: AstNode ) {
170169 match self . location_for_node ( node) {
171- UNKNOWN_LOCATION => self . emit_diagnostic (
170+ None => self . emit_diagnostic (
172171 DiagnosticSeverity :: Debug ,
173172 "locations" . to_owned ( ) ,
174173 "missing location for AstNode" . to_owned ( ) ,
175174 "missing location for AstNode" . to_owned ( ) ,
176175 UNKNOWN_LOCATION ,
177176 ) ,
178- ( start, end) => self . trap . emit_location ( self . label , label, start, end) ,
177+ Some ( ( start, end) ) => self . trap . emit_location ( self . label , label, start, end) ,
179178 } ;
180179 }
181180 pub fn emit_location_token (
@@ -669,7 +668,7 @@ impl<'a> Translator<'a> {
669668 "item_expansion" . to_owned ( ) ,
670669 message. clone ( ) ,
671670 message,
672- location,
671+ location. unwrap_or ( UNKNOWN_LOCATION ) ,
673672 ) ;
674673 None
675674 } ) ?;
0 commit comments