mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 13:30:42 +02:00
* remove sym from ttype, we can now reference any def in any unit directly
git-svn-id: trunk@5063 -
This commit is contained in:
parent
ca6f992504
commit
71af18855e
@ -208,7 +208,7 @@ implementation
|
|||||||
symtablestack.top.insert(sym);
|
symtablestack.top.insert(sym);
|
||||||
{ procvar can have proc directives, but not type references }
|
{ procvar can have proc directives, but not type references }
|
||||||
if (tt.def.deftype=procvardef) and
|
if (tt.def.deftype=procvardef) and
|
||||||
(tt.sym=nil) then
|
(tt.def.typesym=nil) then
|
||||||
begin
|
begin
|
||||||
{ support p : procedure;stdcall=nil; }
|
{ support p : procedure;stdcall=nil; }
|
||||||
if try_to_consume(_SEMICOLON) then
|
if try_to_consume(_SEMICOLON) then
|
||||||
@ -329,7 +329,7 @@ implementation
|
|||||||
if assigned(srsym) and
|
if assigned(srsym) and
|
||||||
(srsym.typ=typesym) then
|
(srsym.typ=typesym) then
|
||||||
begin
|
begin
|
||||||
tabstractpointerdef(pd).pointertype.setsym(srsym);
|
tabstractpointerdef(pd).pointertype.setdef(ttypesym(srsym).restype.def);
|
||||||
{ avoid wrong unused warnings web bug 801 PM }
|
{ avoid wrong unused warnings web bug 801 PM }
|
||||||
inc(ttypesym(srsym).refs);
|
inc(ttypesym(srsym).refs);
|
||||||
{ we need a class type for classrefdef }
|
{ we need a class type for classrefdef }
|
||||||
@ -485,19 +485,19 @@ implementation
|
|||||||
{ read the type definition }
|
{ read the type definition }
|
||||||
read_named_type(tt,orgtypename,nil,generictypelist,false);
|
read_named_type(tt,orgtypename,nil,generictypelist,false);
|
||||||
{ update the definition of the type }
|
{ update the definition of the type }
|
||||||
newtype.restype:=tt;
|
if assigned(tt.def) then
|
||||||
if assigned(tt.sym) then
|
|
||||||
istyperenaming:=true
|
|
||||||
else
|
|
||||||
tt.sym:=newtype;
|
|
||||||
if isunique and assigned(tt.def) then
|
|
||||||
begin
|
begin
|
||||||
tt.setdef(tstoreddef(tt.def).getcopy);
|
if assigned(tt.def.typesym) then
|
||||||
include(tt.def.defoptions,df_unique);
|
istyperenaming:=true;
|
||||||
newtype.restype:=tt;
|
if isunique then
|
||||||
|
begin
|
||||||
|
tt.setdef(tstoreddef(tt.def).getcopy);
|
||||||
|
include(tt.def.defoptions,df_unique);
|
||||||
|
end;
|
||||||
|
if not assigned(tt.def.typesym) then
|
||||||
|
tt.def.typesym:=newtype;
|
||||||
end;
|
end;
|
||||||
if assigned(tt.def) and not assigned(tt.def.typesym) then
|
newtype.restype:=tt;
|
||||||
tt.def.typesym:=newtype;
|
|
||||||
{ KAZ: handle TGUID declaration in system unit }
|
{ KAZ: handle TGUID declaration in system unit }
|
||||||
if (cs_compilesystem in aktmoduleswitches) and not assigned(rec_tguid) and
|
if (cs_compilesystem in aktmoduleswitches) and not assigned(rec_tguid) and
|
||||||
(typename='TGUID') and { name: TGUID and size=16 bytes that is 128 bits }
|
(typename='TGUID') and { name: TGUID and size=16 bytes that is 128 bits }
|
||||||
|
@ -1364,7 +1364,6 @@ implementation
|
|||||||
unionsymtable.datasize:=maxsize;
|
unionsymtable.datasize:=maxsize;
|
||||||
unionsymtable.fieldalignment:=maxalignment;
|
unionsymtable.fieldalignment:=maxalignment;
|
||||||
uniontype.def:=uniondef;
|
uniontype.def:=uniondef;
|
||||||
uniontype.sym:=nil;
|
|
||||||
UnionSym:=tfieldvarsym.create('$case',vs_value,uniontype,[]);
|
UnionSym:=tfieldvarsym.create('$case',vs_value,uniontype,[]);
|
||||||
unionsymtable.addalignmentpadding;
|
unionsymtable.addalignmentpadding;
|
||||||
{$ifdef powerpc}
|
{$ifdef powerpc}
|
||||||
|
@ -1413,7 +1413,7 @@ implementation
|
|||||||
|
|
||||||
typesym :
|
typesym :
|
||||||
begin
|
begin
|
||||||
htype.setsym(srsym);
|
htype:=ttypesym(srsym).restype;
|
||||||
if not assigned(htype.def) then
|
if not assigned(htype.def) then
|
||||||
begin
|
begin
|
||||||
again:=false;
|
again:=false;
|
||||||
|
@ -229,19 +229,7 @@ implementation
|
|||||||
tt:=generrortype;
|
tt:=generrortype;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{ Use the definitions for current unit, because
|
tt.setdef(ttypesym(srsym).restype.def);
|
||||||
they can be refered from the parameters and symbols are not
|
|
||||||
loaded at that time. Only write the definition when the
|
|
||||||
symbol is the real owner of the definition (not a redefine) }
|
|
||||||
if (ttypesym(srsym).owner.symtabletype in [staticsymtable,globalsymtable]) and
|
|
||||||
ttypesym(srsym).owner.iscurrentunit and
|
|
||||||
(
|
|
||||||
(ttypesym(srsym).restype.def.typesym=nil) or
|
|
||||||
(srsym=ttypesym(srsym).restype.def.typesym)
|
|
||||||
) then
|
|
||||||
tt.setdef(ttypesym(srsym).restype.def)
|
|
||||||
else
|
|
||||||
tt.setsym(srsym);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,11 +149,9 @@ interface
|
|||||||
|
|
||||||
ttype = object
|
ttype = object
|
||||||
def : tdef;
|
def : tdef;
|
||||||
sym : tsym;
|
|
||||||
deref : tderef;
|
deref : tderef;
|
||||||
procedure reset;
|
procedure reset;
|
||||||
procedure setdef(p:tdef);
|
procedure setdef(p:tdef);
|
||||||
procedure setsym(p:tsym);
|
|
||||||
procedure resolve;
|
procedure resolve;
|
||||||
procedure buildderef;
|
procedure buildderef;
|
||||||
end;
|
end;
|
||||||
@ -543,23 +541,12 @@ implementation
|
|||||||
procedure ttype.reset;
|
procedure ttype.reset;
|
||||||
begin
|
begin
|
||||||
def:=nil;
|
def:=nil;
|
||||||
sym:=nil;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure ttype.setdef(p:tdef);
|
procedure ttype.setdef(p:tdef);
|
||||||
begin
|
begin
|
||||||
def:=p;
|
def:=p;
|
||||||
sym:=nil;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure ttype.setsym(p:tsym);
|
|
||||||
begin
|
|
||||||
sym:=p;
|
|
||||||
def:=p.gettypedef;
|
|
||||||
if not assigned(def) then
|
|
||||||
internalerror(1234005);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -569,18 +556,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
p:=deref.resolve;
|
p:=deref.resolve;
|
||||||
if assigned(p) then
|
if assigned(p) then
|
||||||
begin
|
setdef(tdef(p))
|
||||||
if p is tsym then
|
|
||||||
begin
|
|
||||||
setsym(tsym(p));
|
|
||||||
if not assigned(def) then
|
|
||||||
internalerror(200212272);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
setdef(tdef(p));
|
|
||||||
end;
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
reset;
|
reset;
|
||||||
end;
|
end;
|
||||||
@ -588,20 +564,7 @@ implementation
|
|||||||
|
|
||||||
procedure ttype.buildderef;
|
procedure ttype.buildderef;
|
||||||
begin
|
begin
|
||||||
{ Write symbol references when the symbol is a redefine,
|
deref.build(def);
|
||||||
but don't write symbol references for the current unit
|
|
||||||
and for the system unit }
|
|
||||||
if assigned(sym) and
|
|
||||||
(
|
|
||||||
(sym<>def.typesym) or
|
|
||||||
(
|
|
||||||
not((sym.owner.symtabletype in [globalsymtable,staticsymtable]) and
|
|
||||||
sym.owner.iscurrentunit)
|
|
||||||
)
|
|
||||||
) then
|
|
||||||
deref.build(sym)
|
|
||||||
else
|
|
||||||
deref.build(def);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1013,7 +976,6 @@ implementation
|
|||||||
begin
|
begin
|
||||||
getderef(t.deref);
|
getderef(t.deref);
|
||||||
t.def:=nil;
|
t.def:=nil;
|
||||||
t.sym:=nil;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user