raz / commit 338ec357

commit
338ec3570a685a25bf1a93c3373723af439a2217
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
f627f570
A message about no place in a file is said without one

Compiling a module in a directory that holds another Rt.raz, such as a
copy of lib/, crashed: CheckOneModule rightly found Rt twice, but Rt is
imported before any file is read, so the message's place named no file
and Show read past the files. Show now says such a message as raz: and
its kind. Found while listing lib/Str.raz from a copy of lib/.

patch · log

1 file changed, +6 -0

src/diag.pas modified +6 -0

@@ -175,6 +175,12 @@
175175 procedure Show(const p: TPos; const kind, kindColour, msg: shortstring);
176176 var line, start, stop, lo, hi, i, n: longint; buf: PChar; num, gutter: shortstring;
177177 begin
178+ if p.f >= numFiles then begin
179+ { about no place in a file, as for Rt, which the compiler imports
180+ before it reads one }
181+ writeln(StdErr, Paint(Bold, 'raz:'), ' ', Paint(kindColour, kind + ':'), ' ', Paint(Bold, msg));
182+ exit;
183+ end;
178184 Locate(p, line, start);
179185 buf := files[p.f].buf;
180186 writeln(StdErr, Paint(Bold, files[p.f].path + ':' + IntStr(line) + ':'