@@ -238,25 +238,16 @@ string CFG::toString(const core::GlobalState &gs) const {
238
238
return to_string (buf);
239
239
}
240
240
241
- string locToString (const core::GlobalState &gs, core::Loc loc) {
242
- if (!loc.exists () || loc.empty ()) {
243
- return " @ <>" ;
244
- }
245
- auto [start, end] = loc.position (gs);
246
- return start.line == end.line ? fmt::format (" @ {}:{}-{}" , start.line , start.column , end.column )
247
- : fmt::format (" @ {}:{}-{}:{}" , start.line , start.column , end.line , end.column );
248
- }
249
-
250
241
string CFG::toTextualString (const core::GlobalState &gs, optional<core::FileRef> file) const {
251
242
fmt::memory_buffer buf;
252
243
string symbolName = this ->symbol .showFullName (gs);
253
244
if (file) {
254
245
auto method = this ->symbol .data (gs);
255
246
if (method->nameLoc .exists () && !method->nameLoc .empty ()) {
256
- fmt::format_to (std::back_inserter (buf), " method{} {} {{\n\n " ,
257
- locToString (gs, core::Loc (file.value (), method->nameLoc )), symbolName);
247
+ fmt::format_to (std::back_inserter (buf), " method @ {} {} {{\n\n " ,
248
+ core::Loc (file.value (), method->nameLoc ). showRawLineColumn (gs ), symbolName);
258
249
} else {
259
- fmt::format_to (std::back_inserter (buf), " method{} (full) {} {{\n\n " , locToString (gs, method->loc ()),
250
+ fmt::format_to (std::back_inserter (buf), " method @ {} (full) {} {{\n\n " , method->loc (). showRawLineColumn (gs ),
260
251
symbolName);
261
252
}
262
253
} else {
@@ -399,7 +390,7 @@ string BasicBlock::toTextualString(const core::GlobalState &gs, optional<core::F
399
390
for (const Binding &exp : this ->exprs ) {
400
391
string positionText = " " ;
401
392
if (file) {
402
- positionText = locToString (gs , core::Loc (file.value (), exp.loc ));
393
+ positionText = fmt::format ( " @ {} " , core::Loc (file.value (), exp.loc ). showRawLineColumn (gs ));
403
394
}
404
395
405
396
fmt::format_to (std::back_inserter (buf), " {}{} = {}\n " , exp.bind .toString (gs, cfg), positionText,
0 commit comments