mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-29 20:20:16 +02:00
* factored out adding a single field to a record based on a def
git-svn-id: branches/hlcgllvm@28757 -
This commit is contained in:
parent
bdb22772d9
commit
0def3629cc
@ -299,6 +299,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(n: string; packrecords: shortint); virtual;
|
constructor create_global_internal(n: string; packrecords: shortint); virtual;
|
||||||
|
procedure add_field_by_def(def: tdef);
|
||||||
procedure add_fields_from_deflist(fieldtypes: tfplist);
|
procedure add_fields_from_deflist(fieldtypes: tfplist);
|
||||||
constructor ppuload(ppufile:tcompilerppufile);
|
constructor ppuload(ppufile:tcompilerppufile);
|
||||||
destructor destroy;override;
|
destructor destroy;override;
|
||||||
@ -3982,17 +3983,22 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure trecorddef.add_field_by_def(def: tdef);
|
||||||
|
var
|
||||||
|
sym: tfieldvarsym;
|
||||||
|
begin
|
||||||
|
sym:=cfieldvarsym.create('$f'+tostr(trecordsymtable(symtable).symlist.count),vs_value,def,[]);
|
||||||
|
symtable.insert(sym);
|
||||||
|
trecordsymtable(symtable).addfield(sym,vis_hidden);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure trecorddef.add_fields_from_deflist(fieldtypes: tfplist);
|
procedure trecorddef.add_fields_from_deflist(fieldtypes: tfplist);
|
||||||
var
|
var
|
||||||
i: longint;
|
i: longint;
|
||||||
sym: tfieldvarsym;
|
|
||||||
begin
|
begin
|
||||||
for i:=0 to fieldtypes.count-1 do
|
for i:=0 to fieldtypes.count-1 do
|
||||||
begin
|
add_field_by_def(tdef(fieldtypes[i]));
|
||||||
sym:=cfieldvarsym.create('$f'+tostr(i),vs_value,tdef(fieldtypes[i]),[]);
|
|
||||||
symtable.insert(sym);
|
|
||||||
trecordsymtable(symtable).addfield(sym,vis_hidden);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user