pgenutil.pas, generate_specialization: set the correct module index, so that warnings, etc. that are generated for a type declaration are printed using the module where the generic came from (this is already done for method bodies, but not for declarations)

git-svn-id: trunk@21271 -
This commit is contained in:
svenbarth 2012-05-11 06:44:12 +00:00
parent 810bd7ddab
commit b3595893c8

View File

@ -91,6 +91,8 @@ uses
old_block_type: tblock_type;
hashedid: thashedidstring;
state : tspecializationstate;
hmodule : tmodule;
oldcurrent_filepos : tfileposinfo;
begin
{ retrieve generic def that we are going to replace }
genericdef:=tstoreddef(tt);
@ -426,9 +428,17 @@ uses
if not assigned(genericdef.generictokenbuf) then
internalerror(200511171);
hmodule:=find_module_from_symtable(genericdef.owner);
if hmodule=nil then
internalerror(2012051202);
oldcurrent_filepos:=current_filepos;
{ use the index the module got from the current compilation process }
current_filepos.moduleindex:=hmodule.unit_index;
current_tokenpos:=current_filepos;
current_scanner.startreplaytokens(genericdef.generictokenbuf,
genericdef.change_endian);
read_named_type(tt,finalspecializename,genericdef,generictypelist,false);
current_filepos:=oldcurrent_filepos;
ttypesym(srsym).typedef:=tt;
tt.typesym:=srsym;