@@ -160,22 +160,21 @@ impl<'a> Translator<'a> {
160
160
}
161
161
}
162
162
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 ) > {
164
164
self . text_range_for_node ( node)
165
165
. and_then ( |r| self . location ( r) )
166
- . unwrap_or ( UNKNOWN_LOCATION )
167
166
}
168
167
169
168
pub fn emit_location < T : TrapClass > ( & mut self , label : Label < T > , node : & impl ast:: AstNode ) {
170
169
match self . location_for_node ( node) {
171
- UNKNOWN_LOCATION => self . emit_diagnostic (
170
+ None => self . emit_diagnostic (
172
171
DiagnosticSeverity :: Debug ,
173
172
"locations" . to_owned ( ) ,
174
173
"missing location for AstNode" . to_owned ( ) ,
175
174
"missing location for AstNode" . to_owned ( ) ,
176
175
UNKNOWN_LOCATION ,
177
176
) ,
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) ,
179
178
} ;
180
179
}
181
180
pub fn emit_location_token (
@@ -669,7 +668,7 @@ impl<'a> Translator<'a> {
669
668
"item_expansion" . to_owned ( ) ,
670
669
message. clone ( ) ,
671
670
message,
672
- location,
671
+ location. unwrap_or ( UNKNOWN_LOCATION ) ,
673
672
) ;
674
673
None
675
674
} ) ?;
0 commit comments