* searchsym_type to search for type definitions. It ignores

records,objects and parameters
This commit is contained in:
peter 2003-10-01 19:05:33 +00:00
parent a63054d3a7
commit 7900a544a3
4 changed files with 59 additions and 34 deletions

View File

@ -736,7 +736,6 @@ implementation
var var
pd : tprocdef; pd : tprocdef;
hs : string; hs : string;
oldst : tsymtable;
isclassmethod : boolean; isclassmethod : boolean;
begin begin
pd:=nil; pd:=nil;
@ -761,12 +760,7 @@ implementation
if try_to_consume(_COLON) then if try_to_consume(_COLON) then
begin begin
inc(testcurobject); inc(testcurobject);
{ Don't look in the objectsymtable for types }
oldst:=symtablestack;
if symtablestack.symtabletype=objectsymtable then
symtablestack:=symtablestack.next;
single_type(pd.rettype,hs,false); single_type(pd.rettype,hs,false);
symtablestack:=oldst;
pd.test_if_fpu_result; pd.test_if_fpu_result;
dec(testcurobject); dec(testcurobject);
end end
@ -2155,7 +2149,11 @@ const
end. end.
{ {
$Log$ $Log$
Revision 1.141 2003-10-01 18:28:55 peter Revision 1.142 2003-10-01 19:05:33 peter
* searchsym_type to search for type definitions. It ignores
records,objects and parameters
Revision 1.141 2003/10/01 18:28:55 peter
* don't look in objectsymtable when parsing the function return type * don't look in objectsymtable when parsing the function return type
Revision 1.140 2003/10/01 16:49:05 florian Revision 1.140 2003/10/01 16:49:05 florian

View File

@ -112,7 +112,6 @@ implementation
var var
sc : tsinglelist; sc : tsinglelist;
old_block_type : tblock_type; old_block_type : tblock_type;
oldsymtablestack : tsymtable;
symdone : boolean; symdone : boolean;
{ to handle absolute } { to handle absolute }
abssym : tabsolutesym; abssym : tabsolutesym;
@ -180,17 +179,7 @@ implementation
{ this is needed for Delphi mode at least { this is needed for Delphi mode at least
but should be OK for all modes !! (PM) } but should be OK for all modes !! (PM) }
ignore_equal:=true; ignore_equal:=true;
if is_record then read_type(tt,'');
begin
{ for records, don't search the recordsymtable for
the symbols of the types }
oldsymtablestack:=symtablestack;
symtablestack:=symtablestack.next;
read_type(tt,'');
symtablestack:=oldsymtablestack;
end
else
read_type(tt,'');
{ types that use init/final are not allowed in variant parts, but { types that use init/final are not allowed in variant parts, but
classes are allowed } classes are allowed }
if (variantrecordlevel>0) and if (variantrecordlevel>0) and
@ -506,12 +495,7 @@ implementation
{ may be only a type: } { may be only a type: }
if assigned(srsym) and (srsym.typ in [typesym,unitsym]) then if assigned(srsym) and (srsym.typ in [typesym,unitsym]) then
begin begin
{ for records, don't search the recordsymtable for
the symbols of the types }
oldsymtablestack:=symtablestack;
symtablestack:=symtablestack.next;
read_type(casetype,''); read_type(casetype,'');
symtablestack:=oldsymtablestack;
end end
else else
begin begin
@ -519,10 +503,7 @@ implementation
consume(_COLON); consume(_COLON);
{ for records, don't search the recordsymtable for { for records, don't search the recordsymtable for
the symbols of the types } the symbols of the types }
oldsymtablestack:=symtablestack;
symtablestack:=symtablestack.next;
read_type(casetype,''); read_type(casetype,'');
symtablestack:=oldsymtablestack;
vs:=tvarsym.create(sorg,vs_value,casetype); vs:=tvarsym.create(sorg,vs_value,casetype);
tabstractrecordsymtable(symtablestack).insertfield(vs,true); tabstractrecordsymtable(symtablestack).insertfield(vs,true);
end; end;
@ -617,7 +598,11 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.51 2003-09-23 17:56:05 peter Revision 1.52 2003-10-01 19:05:33 peter
* searchsym_type to search for type definitions. It ignores
records,objects and parameters
Revision 1.51 2003/09/23 17:56:05 peter
* locals and paras are allocated in the code generation * locals and paras are allocated in the code generation
* tvarsym.localloc contains the location of para/local when * tvarsym.localloc contains the location of para/local when
generating code for the current procedure generating code for the current procedure

View File

@ -100,9 +100,11 @@ implementation
consume(_ID); consume(_ID);
exit; exit;
end; end;
{ try to load the symbol to see if it's a unitsym } { try to load the symbol to see if it's a unitsym. Use the
special searchsym_type that ignores records,objects and
parameters }
is_unit_specific:=false; is_unit_specific:=false;
searchsym(s,srsym,srsymtable); searchsym_type(s,srsym,srsymtable);
consume(_ID); consume(_ID);
if assigned(srsym) and if assigned(srsym) and
(srsym.typ=unitsym) then (srsym.typ=unitsym) then
@ -627,7 +629,11 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.56 2003-09-23 17:56:06 peter Revision 1.57 2003-10-01 19:05:33 peter
* searchsym_type to search for type definitions. It ignores
records,objects and parameters
Revision 1.56 2003/09/23 17:56:06 peter
* locals and paras are allocated in the code generation * locals and paras are allocated in the code generation
* tvarsym.localloc contains the location of para/local when * tvarsym.localloc contains the location of para/local when
generating code for the current procedure generating code for the current procedure

View File

@ -35,7 +35,7 @@ interface
{ ppu } { ppu }
ppu,symppu, ppu,symppu,
{ assembler } { assembler }
aasmbase,aasmtai,aasmcpu aasmtai
; ;
@ -199,6 +199,7 @@ interface
{*** Search ***} {*** Search ***}
function searchsym(const s : stringid;var srsym:tsym;var srsymtable:tsymtable):boolean; function searchsym(const s : stringid;var srsym:tsym;var srsymtable:tsymtable):boolean;
function searchsym_type(const s : stringid;var srsym:tsym;var srsymtable:tsymtable):boolean;
function searchsymonlyin(p : tsymtable;const s : stringid):tsym; function searchsymonlyin(p : tsymtable;const s : stringid):tsym;
function searchsym_in_class(classh:tobjectdef;const s : stringid):tsym; function searchsym_in_class(classh:tobjectdef;const s : stringid):tsym;
function searchsym_in_class_by_msgint(classh:tobjectdef;i:longint):tsym; function searchsym_in_class_by_msgint(classh:tobjectdef;i:longint):tsym;
@ -269,7 +270,7 @@ implementation
gdb, gdb,
{$endif GDB} {$endif GDB}
{ codegen } { codegen }
cgbase,tgobj procinfo
; ;
@ -1794,6 +1795,37 @@ implementation
end; end;
function searchsym_type(const s : stringid;var srsym:tsym;var srsymtable:tsymtable):boolean;
var
speedvalue : cardinal;
begin
speedvalue:=getspeedvalue(s);
srsymtable:=symtablestack;
while assigned(srsymtable) do
begin
{
It is not possible to have type defintions in:
records
objects
parameters
}
if not(srsymtable.symtabletype in [recordsymtable,objectsymtable,parasymtable]) then
begin
srsym:=tsym(srsymtable.speedsearch(s,speedvalue));
if assigned(srsym) and
(not assigned(current_procinfo) or
tstoredsym(srsym).is_visible_for_proc(current_procinfo.procdef)) then
begin
result:=true;
exit;
end
end;
srsymtable:=srsymtable.next;
end;
result:=false;
end;
function searchsymonlyin(p : tsymtable;const s : stringid):tsym; function searchsymonlyin(p : tsymtable;const s : stringid):tsym;
var var
srsym : tsym; srsym : tsym;
@ -2227,7 +2259,11 @@ implementation
end. end.
{ {
$Log$ $Log$
Revision 1.110 2003-09-23 17:56:06 peter Revision 1.111 2003-10-01 19:05:33 peter
* searchsym_type to search for type definitions. It ignores
records,objects and parameters
Revision 1.110 2003/09/23 17:56:06 peter
* locals and paras are allocated in the code generation * locals and paras are allocated in the code generation
* tvarsym.localloc contains the location of para/local when * tvarsym.localloc contains the location of para/local when
generating code for the current procedure generating code for the current procedure