mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-11 11:49:24 +02:00
+ add a constructor for trecorddef to declare an internal record type as part of a specific other type
Based on code by Blaise.ru
This commit is contained in:
parent
92082ab28f
commit
5cf15be434
@ -389,6 +389,7 @@ interface
|
||||
isunion : boolean;
|
||||
constructor create(const n:string; p:TSymtable);virtual;
|
||||
constructor create_global_internal(const n: string; packrecords, recordalignmin: shortint); virtual;
|
||||
constructor create_internal(const n: string; packrecords, recordalignmin: shortint; where: tsymtable); virtual;
|
||||
function add_field_by_def(const optionalname: TIDString; def: tdef): tsym;
|
||||
procedure add_fields_from_deflist(fieldtypes: tfplist);
|
||||
constructor ppuload(ppufile:tcompilerppufile);
|
||||
@ -5092,12 +5093,11 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
constructor trecorddef.create_global_internal(const n: string; packrecords, recordalignmin: shortint);
|
||||
constructor trecorddef.create_internal(const n: string; packrecords, recordalignmin: shortint; where: tsymtable);
|
||||
var
|
||||
name : string;
|
||||
pname : pshortstring;
|
||||
oldsymtablestack: tsymtablestack;
|
||||
where : tsymtable;
|
||||
ts: ttypesym;
|
||||
begin
|
||||
{ construct name }
|
||||
@ -5118,9 +5118,6 @@ implementation
|
||||
symtable.defowner:=self;
|
||||
isunion:=false;
|
||||
inherited create(pname^,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 }
|
||||
@ -5140,6 +5137,17 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
constructor trecorddef.create_global_internal(const n: string; packrecords, recordalignmin: shortint);
|
||||
var
|
||||
where : tsymtable;
|
||||
begin
|
||||
where:=current_module.localsymtable;
|
||||
if not assigned(where) then
|
||||
where:=current_module.globalsymtable;
|
||||
create_internal(n,packrecords,recordalignmin,where);
|
||||
end;
|
||||
|
||||
|
||||
function trecorddef.add_field_by_def(const optionalname: TIDString; def: tdef): tsym;
|
||||
var
|
||||
sym: tfieldvarsym;
|
||||
|
Loading…
Reference in New Issue
Block a user