mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-07 16:10:41 +02:00
* searchsym_type to search for type definitions. It ignores
records,objects and parameters
This commit is contained in:
parent
a63054d3a7
commit
7900a544a3
@ -736,7 +736,6 @@ implementation
|
||||
var
|
||||
pd : tprocdef;
|
||||
hs : string;
|
||||
oldst : tsymtable;
|
||||
isclassmethod : boolean;
|
||||
begin
|
||||
pd:=nil;
|
||||
@ -761,12 +760,7 @@ implementation
|
||||
if try_to_consume(_COLON) then
|
||||
begin
|
||||
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);
|
||||
symtablestack:=oldst;
|
||||
pd.test_if_fpu_result;
|
||||
dec(testcurobject);
|
||||
end
|
||||
@ -2155,7 +2149,11 @@ const
|
||||
end.
|
||||
{
|
||||
$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
|
||||
|
||||
Revision 1.140 2003/10/01 16:49:05 florian
|
||||
|
@ -112,7 +112,6 @@ implementation
|
||||
var
|
||||
sc : tsinglelist;
|
||||
old_block_type : tblock_type;
|
||||
oldsymtablestack : tsymtable;
|
||||
symdone : boolean;
|
||||
{ to handle absolute }
|
||||
abssym : tabsolutesym;
|
||||
@ -180,17 +179,7 @@ implementation
|
||||
{ this is needed for Delphi mode at least
|
||||
but should be OK for all modes !! (PM) }
|
||||
ignore_equal:=true;
|
||||
if is_record then
|
||||
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,'');
|
||||
read_type(tt,'');
|
||||
{ types that use init/final are not allowed in variant parts, but
|
||||
classes are allowed }
|
||||
if (variantrecordlevel>0) and
|
||||
@ -506,12 +495,7 @@ implementation
|
||||
{ may be only a type: }
|
||||
if assigned(srsym) and (srsym.typ in [typesym,unitsym]) then
|
||||
begin
|
||||
{ for records, don't search the recordsymtable for
|
||||
the symbols of the types }
|
||||
oldsymtablestack:=symtablestack;
|
||||
symtablestack:=symtablestack.next;
|
||||
read_type(casetype,'');
|
||||
symtablestack:=oldsymtablestack;
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -519,10 +503,7 @@ implementation
|
||||
consume(_COLON);
|
||||
{ for records, don't search the recordsymtable for
|
||||
the symbols of the types }
|
||||
oldsymtablestack:=symtablestack;
|
||||
symtablestack:=symtablestack.next;
|
||||
read_type(casetype,'');
|
||||
symtablestack:=oldsymtablestack;
|
||||
vs:=tvarsym.create(sorg,vs_value,casetype);
|
||||
tabstractrecordsymtable(symtablestack).insertfield(vs,true);
|
||||
end;
|
||||
@ -617,7 +598,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$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
|
||||
* tvarsym.localloc contains the location of para/local when
|
||||
generating code for the current procedure
|
||||
|
@ -100,9 +100,11 @@ implementation
|
||||
consume(_ID);
|
||||
exit;
|
||||
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;
|
||||
searchsym(s,srsym,srsymtable);
|
||||
searchsym_type(s,srsym,srsymtable);
|
||||
consume(_ID);
|
||||
if assigned(srsym) and
|
||||
(srsym.typ=unitsym) then
|
||||
@ -627,7 +629,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$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
|
||||
* tvarsym.localloc contains the location of para/local when
|
||||
generating code for the current procedure
|
||||
|
@ -35,7 +35,7 @@ interface
|
||||
{ ppu }
|
||||
ppu,symppu,
|
||||
{ assembler }
|
||||
aasmbase,aasmtai,aasmcpu
|
||||
aasmtai
|
||||
;
|
||||
|
||||
|
||||
@ -199,6 +199,7 @@ interface
|
||||
|
||||
{*** Search ***}
|
||||
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 searchsym_in_class(classh:tobjectdef;const s : stringid):tsym;
|
||||
function searchsym_in_class_by_msgint(classh:tobjectdef;i:longint):tsym;
|
||||
@ -269,7 +270,7 @@ implementation
|
||||
gdb,
|
||||
{$endif GDB}
|
||||
{ codegen }
|
||||
cgbase,tgobj
|
||||
procinfo
|
||||
;
|
||||
|
||||
|
||||
@ -1794,6 +1795,37 @@ implementation
|
||||
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;
|
||||
var
|
||||
srsym : tsym;
|
||||
@ -2227,7 +2259,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$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
|
||||
* tvarsym.localloc contains the location of para/local when
|
||||
generating code for the current procedure
|
||||
|
Loading…
Reference in New Issue
Block a user