From 9a9bf4be91cac4f4d3c310837fb848f7e5684b9c Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 4 Jan 2015 21:23:26 +0000 Subject: [PATCH] * write better hint message about the first occurence of an identifuer in case of a duplicate identifier error git-svn-id: trunk@29400 - --- compiler/fppu.pas | 8 +++++++- compiler/symtable.pas | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/compiler/fppu.pas b/compiler/fppu.pas index 82638fdb01..bb2077dac3 100644 --- a/compiler/fppu.pas +++ b/compiler/fppu.pas @@ -836,7 +836,13 @@ var end; end else - temp:=' not available'; + begin + { still register the source module for proper error messages + since source_avail for the module is still false, this should not hurt } + sourcefiles.register_file(tdosinputfile.create(hs)); + + temp:=' not available'; + end; if is_main then begin mainsource:=hs; diff --git a/compiler/symtable.pas b/compiler/symtable.pas index 1f6f94513e..970ec4ce5f 100644 --- a/compiler/symtable.pas +++ b/compiler/symtable.pas @@ -2043,6 +2043,7 @@ implementation procedure duplicatesym(var hashedid:THashedIDString;dupsym,origsym:TSymEntry); var st : TSymtable; + filename : TIDString; begin Message1(sym_e_duplicate_id,tsym(origsym).realname); { Write hint where the original symbol was found } @@ -2054,7 +2055,13 @@ implementation st.iscurrentunit then Message2(sym_h_duplicate_id_where,current_module.sourcefiles.get_file_name(fileindex),tostr(line)) else if assigned(st.name) then - Message2(sym_h_duplicate_id_where,'unit '+st.name^,tostr(line)); + begin + filename:=find_module_from_symtable(st).sourcefiles.get_file_name(fileindex); + if filename<>'' then + Message2(sym_h_duplicate_id_where,'unit '+st.name^+': '+filename,tostr(line)) + else + Message2(sym_h_duplicate_id_where,'unit '+st.name^,tostr(line)) + end; end; { Rename duplicate sym to an unreachable name, but it can be inserted in the symtable without errors }