* applied patch by Blaise.ru to reduce code duplication in trecorddef.create_global_internal()

git-svn-id: trunk@42652 -
This commit is contained in:
svenbarth 2019-08-11 17:26:35 +00:00
parent 45c4e81b62
commit 955ebf2f09

View File

@ -4786,6 +4786,7 @@ implementation
constructor trecorddef.create_global_internal(n: string; packrecords, recordalignmin: shortint);
var
oldsymtablestack: tsymtablestack;
where : tsymtable;
ts: ttypesym;
definedname: boolean;
begin
@ -4802,27 +4803,19 @@ implementation
symtable.defowner:=self;
isunion:=false;
inherited create(n,recorddef,true);
where:=current_module.localsymtable;
if not assigned(where) then
where:=current_module.globalsymtable;
where.insertdef(self);
{ if we specified a name, then we'll probably want to look up the
type again by name too -> create typesym }
ts:=nil;
if definedname then
begin
ts:=ctypesym.create(n,self,true);
{ avoid hints about unused types (these may only be used for
typed constant data) }
ts.increfcount;
end;
if assigned(current_module.localsymtable) then
begin
current_module.localsymtable.insertdef(self);
if definedname then
current_module.localsymtable.insert(ts);
end
else
begin
current_module.globalsymtable.insertdef(self);
if definedname then
current_module.globalsymtable.insert(ts);
where.insert(ts);
end;
symtablestack:=oldsymtablestack;
{ don't create RTTI for internal types, these are not exported }