@@ -69,7 +69,7 @@ impl CrateTranslator<'_> {
69
69
} )
70
70
}
71
71
72
- fn emit_location_ast_ptr < T > (
72
+ fn emit_location_for_ast_ptr < T > (
73
73
& mut self ,
74
74
source : ra_ap_hir:: InFile < ra_ap_syntax:: AstPtr < T > > ,
75
75
) -> Option < trap:: Label >
@@ -83,26 +83,26 @@ impl CrateTranslator<'_> {
83
83
. and_then ( |( file_id, source) | self . emit_file ( file_id) . map ( |data| ( data, source) ) )
84
84
. map ( |( data, source) | {
85
85
let range = source. value . text_range ( ) ;
86
- self . emit_location_textrange ( data, range)
86
+ self . emit_location_for_textrange ( data, range)
87
87
} )
88
88
}
89
89
90
- fn emit_location_expr (
90
+ fn emit_location_for_expr (
91
91
& mut self ,
92
92
expr : ra_ap_hir_def:: hir:: ExprId ,
93
93
source_map : & BodySourceMap ,
94
94
) -> Option < trap:: Label > {
95
95
let source = source_map. expr_syntax ( expr) . ok ( ) ?;
96
- self . emit_location_ast_ptr ( source)
96
+ self . emit_location_for_ast_ptr ( source)
97
97
}
98
98
99
- fn emit_location_pat (
99
+ fn emit_location_for_pat (
100
100
& mut self ,
101
101
pat_id : ra_ap_hir_def:: hir:: PatId ,
102
102
source_map : & BodySourceMap ,
103
103
) -> Option < trap:: Label > {
104
104
let source = source_map. pat_syntax ( pat_id) . ok ( ) ?;
105
- self . emit_location_ast_ptr ( source)
105
+ self . emit_location_for_ast_ptr ( source)
106
106
}
107
107
108
108
fn emit_literal_or_const_pat (
@@ -130,14 +130,14 @@ impl CrateTranslator<'_> {
130
130
}
131
131
}
132
132
133
- fn emit_location_label (
133
+ fn emit_location_for_label (
134
134
& mut self ,
135
135
label_id : ra_ap_hir_def:: hir:: LabelId ,
136
136
source_map : & BodySourceMap ,
137
137
) -> Option < trap:: Label > {
138
138
// 'catch' a panic if the source map is incomplete
139
139
let source = std:: panic:: catch_unwind ( || source_map. label_syntax ( label_id) ) . ok ( ) ;
140
- source. and_then ( |source| self . emit_location_ast_ptr ( source) )
140
+ source. and_then ( |source| self . emit_location_for_ast_ptr ( source) )
141
141
}
142
142
fn emit_location < T : HasSource > ( & mut self , entity : T ) -> Option < trap:: Label >
143
143
where
@@ -149,10 +149,10 @@ impl CrateTranslator<'_> {
149
149
. and_then ( |( file_id, source) | self . emit_file ( file_id) . map ( |data| ( data, source) ) )
150
150
. map ( |( data, source) | {
151
151
let range = source. value . syntax ( ) . text_range ( ) ;
152
- self . emit_location_textrange ( data, range)
152
+ self . emit_location_for_textrange ( data, range)
153
153
} )
154
154
}
155
- fn emit_location_textrange ( & mut self , data : FileData , range : TextRange ) -> trap:: Label {
155
+ fn emit_location_for_textrange ( & mut self , data : FileData , range : TextRange ) -> trap:: Label {
156
156
let start = data. line_index . line_col ( range. start ( ) ) ;
157
157
let end = data. line_index . line_col (
158
158
range
@@ -168,7 +168,7 @@ impl CrateTranslator<'_> {
168
168
body : & Body ,
169
169
source_map : & BodySourceMap ,
170
170
) -> trap:: Label {
171
- let location: Option < trap:: Label > = self . emit_location_label ( label_id, source_map) ;
171
+ let location: Option < trap:: Label > = self . emit_location_for_label ( label_id, source_map) ;
172
172
let label = & body. labels [ label_id] ;
173
173
self . trap . emit ( generated:: Label {
174
174
id : TrapId :: Star ,
@@ -177,7 +177,7 @@ impl CrateTranslator<'_> {
177
177
} )
178
178
}
179
179
fn emit_pat ( & mut self , pat_id : PatId , body : & Body , source_map : & BodySourceMap ) -> trap:: Label {
180
- let location: Option < trap:: Label > = self . emit_location_pat ( pat_id, source_map) ;
180
+ let location: Option < trap:: Label > = self . emit_location_for_pat ( pat_id, source_map) ;
181
181
let pat = & body. pats [ pat_id] ;
182
182
match pat {
183
183
ra_ap_hir_def:: hir:: Pat :: Missing => self . trap . emit ( generated:: MissingPat {
@@ -329,7 +329,7 @@ impl CrateTranslator<'_> {
329
329
body : & Body ,
330
330
source_map : & BodySourceMap ,
331
331
) -> trap:: Label {
332
- let location: Option < trap:: Label > = self . emit_location_pat ( arm. pat , source_map) ;
332
+ let location: Option < trap:: Label > = self . emit_location_for_pat ( arm. pat , source_map) ;
333
333
let pat = self . emit_pat ( arm. pat , body, source_map) ;
334
334
let guard = arm. guard . map ( |g| self . emit_expr ( g, body, source_map) ) ;
335
335
let expr = self . emit_expr ( arm. expr , body, source_map) ;
@@ -355,7 +355,7 @@ impl CrateTranslator<'_> {
355
355
else_branch,
356
356
} => {
357
357
// TODO: find a way to get the location of the entire statement
358
- let location = self . emit_location_pat ( * pat, source_map) ;
358
+ let location = self . emit_location_for_pat ( * pat, source_map) ;
359
359
let pat = self . emit_pat ( * pat, body, source_map) ;
360
360
let type_ref = type_ref
361
361
. as_ref ( )
@@ -374,7 +374,7 @@ impl CrateTranslator<'_> {
374
374
} )
375
375
}
376
376
Statement :: Expr { expr, has_semi } => {
377
- let location = self . emit_location_expr ( * expr, source_map) ;
377
+ let location = self . emit_location_for_expr ( * expr, source_map) ;
378
378
let expr = self . emit_expr ( * expr, body, source_map) ;
379
379
self . trap . emit ( generated:: ExprStmt {
380
380
id : TrapId :: Star ,
@@ -395,7 +395,7 @@ impl CrateTranslator<'_> {
395
395
body : & Body ,
396
396
source_map : & BodySourceMap ,
397
397
) -> trap:: Label {
398
- let location: Option < trap:: Label > = self . emit_location_expr ( expr_id, source_map) ;
398
+ let location: Option < trap:: Label > = self . emit_location_for_expr ( expr_id, source_map) ;
399
399
let expr = & body[ expr_id] ;
400
400
match expr {
401
401
ra_ap_hir_def:: hir:: Expr :: Missing => self . trap . emit ( generated:: MissingExpr {
0 commit comments