mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-26 22:09:44 +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;
|
isunion : boolean;
|
||||||
constructor create(const n:string; p:TSymtable);virtual;
|
constructor create(const n:string; p:TSymtable);virtual;
|
||||||
constructor create_global_internal(const n: string; packrecords, recordalignmin: shortint); 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;
|
function add_field_by_def(const optionalname: TIDString; def: tdef): tsym;
|
||||||
procedure add_fields_from_deflist(fieldtypes: tfplist);
|
procedure add_fields_from_deflist(fieldtypes: tfplist);
|
||||||
constructor ppuload(ppufile:tcompilerppufile);
|
constructor ppuload(ppufile:tcompilerppufile);
|
||||||
@ -5092,12 +5093,11 @@ implementation
|
|||||||
end;
|
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
|
var
|
||||||
name : string;
|
name : string;
|
||||||
pname : pshortstring;
|
pname : pshortstring;
|
||||||
oldsymtablestack: tsymtablestack;
|
oldsymtablestack: tsymtablestack;
|
||||||
where : tsymtable;
|
|
||||||
ts: ttypesym;
|
ts: ttypesym;
|
||||||
begin
|
begin
|
||||||
{ construct name }
|
{ construct name }
|
||||||
@ -5118,9 +5118,6 @@ implementation
|
|||||||
symtable.defowner:=self;
|
symtable.defowner:=self;
|
||||||
isunion:=false;
|
isunion:=false;
|
||||||
inherited create(pname^,recorddef,true);
|
inherited create(pname^,recorddef,true);
|
||||||
where:=current_module.localsymtable;
|
|
||||||
if not assigned(where) then
|
|
||||||
where:=current_module.globalsymtable;
|
|
||||||
where.insertdef(self);
|
where.insertdef(self);
|
||||||
{ if we specified a name, then we'll probably want to look up the
|
{ if we specified a name, then we'll probably want to look up the
|
||||||
type again by name too -> create typesym }
|
type again by name too -> create typesym }
|
||||||
@ -5140,6 +5137,17 @@ implementation
|
|||||||
end;
|
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;
|
function trecorddef.add_field_by_def(const optionalname: TIDString; def: tdef): tsym;
|
||||||
var
|
var
|
||||||
sym: tfieldvarsym;
|
sym: tfieldvarsym;
|
||||||
|
Loading…
Reference in New Issue
Block a user