* tsymlist.def renamed to tsymlist.procdef

* tsymlist.procdef is now only used to store the procdef
This commit is contained in:
peter 2003-10-07 16:06:30 +00:00
parent e27d6f67da
commit 625de786dc
4 changed files with 68 additions and 54 deletions

View File

@ -38,7 +38,6 @@ implementation
cutils,cclasses,
globals,verbose,systems,tokens,
symconst,symbase,symsym,symtable,defutil,defcmp,
cgbase,
node,nld,nmem,ncon,ncnv,ncal,pass_1,
scanner,
pbase,pexpr,pdecsub,pdecvar,ptype
@ -89,14 +88,13 @@ implementation
{ convert a node tree to symlist and return the last
symbol }
function parse_symlist(pl:tsymlist):boolean;
function parse_symlist(pl:tsymlist;var def:tdef):boolean;
var
idx : longint;
sym : tsym;
def : tdef;
st : tsymtable;
begin
parse_symlist:=true;
result:=true;
def:=nil;
if token=_ID then
begin
@ -118,7 +116,7 @@ implementation
else
begin
Message1(parser_e_illegal_field_or_method,pattern);
parse_symlist:=false;
result:=false;
end;
consume(_ID);
repeat
@ -146,21 +144,26 @@ implementation
else
begin
Message1(sym_e_illegal_field,pattern);
parse_symlist:=false;
result:=false;
end;
end;
end
else
begin
Message1(sym_e_illegal_field,pattern);
parse_symlist:=false;
result:=false;
end;
end
else
begin
Message(cg_e_invalid_qualifier);
parse_symlist:=false;
result:=false;
end;
end
else
begin
Message(cg_e_invalid_qualifier);
result:=false;
end;
consume(_ID);
end;
@ -177,7 +180,7 @@ implementation
else
begin
Message(cg_e_invalid_qualifier);
parse_symlist:=false;
result:=false;
end;
until not try_to_consume(_COMMA);
consume(_RECKKLAMMER);
@ -185,7 +188,7 @@ implementation
else
begin
Message(parser_e_ill_property_access_sym);
parse_symlist:=false;
result:=false;
break;
end;
end;
@ -194,9 +197,8 @@ implementation
else
begin
Message(parser_e_ill_property_access_sym);
parse_symlist:=false;
result:=false;
end;
pl.def:=def;
end;
var
@ -208,8 +210,7 @@ implementation
s : string;
tt : ttype;
arraytype : ttype;
pp : Tprocdef;
pd : tprocdef;
def : tdef;
pt : tnode;
propname : stringid;
sc : tsinglelist;
@ -375,7 +376,7 @@ implementation
if try_to_consume(_READ) then
begin
p.readaccess.clear;
if parse_symlist(p.readaccess) then
if parse_symlist(p.readaccess,def) then
begin
sym:=p.readaccess.firstsym^.sym;
case sym.typ of
@ -386,14 +387,15 @@ implementation
{ Insert hidden parameters }
calc_parast(readprocdef);
{ search procdefs matching readprocdef }
pd:=Tprocsym(sym).search_procdef_bypara(readprocdef.para,p.proptype.def,true,false);
if not(assigned(pd)) then
p.readaccess.procdef:=Tprocsym(sym).search_procdef_bypara(readprocdef.para,p.proptype.def,true,false);
if not assigned(p.readaccess.procdef) then
Message(parser_e_ill_property_access_sym);
p.readaccess.setdef(pd);
end;
varsym :
begin
if compare_defs(p.readaccess.def,p.proptype.def,nothingn)>=te_equal then
if not assigned(def) then
internalerror(200310071);
if compare_defs(def,p.proptype.def,nothingn)>=te_equal then
begin
{ property parameters are allowed if this is
an indexed property, because the index is then
@ -404,7 +406,7 @@ implementation
Message(parser_e_ill_property_access_sym);
end
else
CGMessage2(type_e_incompatible_types,p.readaccess.def.typename,p.proptype.def.typename);
CGMessage2(type_e_incompatible_types,def.typename,p.proptype.def.typename);
end;
else
Message(parser_e_ill_property_access_sym);
@ -414,7 +416,7 @@ implementation
if try_to_consume(_WRITE) then
begin
p.writeaccess.clear;
if parse_symlist(p.writeaccess) then
if parse_symlist(p.writeaccess,def) then
begin
sym:=p.writeaccess.firstsym^.sym;
case sym.typ of
@ -429,14 +431,15 @@ implementation
{ Insert hidden parameters }
calc_parast(writeprocdef);
{ search procdefs matching writeprocdef }
pd:=Tprocsym(sym).search_procdef_bypara(writeprocdef.para,writeprocdef.rettype.def,true,false);
if not(assigned(pd)) then
p.writeaccess.procdef:=Tprocsym(sym).search_procdef_bypara(writeprocdef.para,writeprocdef.rettype.def,true,false);
if not assigned(p.writeaccess.procdef) then
Message(parser_e_ill_property_access_sym);
p.writeaccess.setdef(pd);
end;
varsym :
begin
if compare_defs(p.writeaccess.def,p.proptype.def,nothingn)>=te_equal then
if not assigned(def) then
internalerror(200310072);
if compare_defs(def,p.proptype.def,nothingn)>=te_equal then
begin
{ property parameters are allowed if this is
an indexed property, because the index is then
@ -447,7 +450,7 @@ implementation
Message(parser_e_ill_property_access_sym);
end
else
CGMessage2(type_e_incompatible_types,p.readaccess.def.typename,p.proptype.def.typename);
CGMessage2(type_e_incompatible_types,def.typename,p.proptype.def.typename);
end;
else
Message(parser_e_ill_property_access_sym);
@ -467,22 +470,22 @@ implementation
{ as stored true }
if idtoken<>_DEFAULT then
begin
if parse_symlist(p.storedaccess) then
if parse_symlist(p.storedaccess,def) then
begin
sym:=p.storedaccess.firstsym^.sym;
case sym.typ of
procsym :
begin
pp:=Tprocsym(sym).search_procdef_nopara_boolret;
if assigned(pp) then
p.storedaccess.setdef(pp)
else
p.storedaccess.procdef:=Tprocsym(sym).search_procdef_nopara_boolret;
if not assigned(p.storedaccess.procdef) then
message(parser_e_ill_property_storage_sym);
end;
varsym :
begin
if not assigned(def) then
internalerror(200310073);
if (ppo_hasparameters in p.propoptions) or
not(is_boolean(p.storedaccess.def)) then
not(is_boolean(def)) then
Message(parser_e_stored_property_must_be_boolean);
end;
else
@ -1155,7 +1158,11 @@ implementation
end.
{
$Log$
Revision 1.68 2003-10-02 21:15:12 peter
Revision 1.69 2003-10-07 16:06:30 peter
* tsymlist.def renamed to tsymlist.procdef
* tsymlist.procdef is now only used to store the procdef
Revision 1.68 2003/10/02 21:15:12 peter
* support nil as default value
* when no default property is allowed don't check default value

View File

@ -5118,16 +5118,18 @@ implementation
end
else
begin
if not(po_virtualmethod in tprocdef(proc.def).procoptions) then
if not assigned(proc.procdef) then
internalerror(200310074);
if not(po_virtualmethod in tprocdef(proc.procdef).procoptions) then
begin
rttiList.concat(Tai_const_symbol.Createname(tprocdef(proc.def).mangledname));
rttiList.concat(Tai_const_symbol.Createname(tprocdef(proc.procdef).mangledname));
typvalue:=1;
end
else
begin
{ virtual method, write vmt offset }
rttiList.concat(Tai_const.Create_32bit(
tprocdef(proc.def)._class.vmtmethodoffset(tprocdef(proc.def).extnumber)));
tprocdef(proc.procdef)._class.vmtmethodoffset(tprocdef(proc.procdef).extnumber)));
typvalue:=2;
end;
end;
@ -5913,7 +5915,11 @@ implementation
end.
{
$Log$
Revision 1.173 2003-10-06 22:23:41 florian
Revision 1.174 2003-10-07 16:06:30 peter
* tsymlist.def renamed to tsymlist.procdef
* tsymlist.procdef is now only used to store the procdef
Revision 1.173 2003/10/06 22:23:41 florian
+ added basic olevariant support
Revision 1.172 2003/10/05 21:21:52 peter

View File

@ -179,7 +179,7 @@ implementation
p : tsymlist;
begin
p:=tsymlist.create;
getderef(p.defderef);
getderef(p.procdefderef);
repeat
slt:=tsltype(getbyte);
case slt of
@ -344,7 +344,7 @@ implementation
var
hp : psymlistitem;
begin
putderef(p.def,p.defderef);
putderef(p.procdef,p.procdefderef);
hp:=p.firstsym;
while assigned(hp) do
begin
@ -405,7 +405,11 @@ implementation
end.
{
$Log$
Revision 1.19 2003-06-07 20:26:32 peter
Revision 1.20 2003-10-07 16:06:30 peter
* tsymlist.def renamed to tsymlist.procdef
* tsymlist.procdef is now only used to store the procdef
Revision 1.19 2003/06/07 20:26:32 peter
* re-resolving added instead of reloading from ppu
* tderef object added to store deref info for resolving

View File

@ -143,14 +143,13 @@ interface
end;
tsymlist = class
def : tdef;
defderef : tderef;
procdef : tdef;
procdefderef : tderef;
firstsym,
lastsym : psymlistitem;
constructor create;
destructor destroy;override;
function empty:boolean;
procedure setdef(p:tdef);
procedure addsym(slt:tsltype;p:tsym);
procedure addsymderef(slt:tsltype;const d:tderef);
procedure addconst(slt:tsltype;v:longint);
@ -366,7 +365,7 @@ implementation
constructor tsymlist.create;
begin
def:=nil; { needed for procedures }
procdef:=nil; { needed for procedures }
firstsym:=nil;
lastsym:=nil;
end;
@ -396,13 +395,7 @@ implementation
end;
firstsym:=nil;
lastsym:=nil;
def:=nil;
end;
procedure tsymlist.setdef(p:tdef);
begin
def:=p;
procdef:=nil;
end;
@ -469,7 +462,7 @@ implementation
hpn : psymlistitem;
begin
hp:=tsymlist.create;
hp.def:=def;
hp.procdef:=procdef;
hp2:=firstsym;
while assigned(hp2) do
begin
@ -491,7 +484,7 @@ implementation
var
hp : psymlistitem;
begin
def:=tdef(defderef.resolve);
procdef:=tdef(procdefderef.resolve);
hp:=firstsym;
while assigned(hp) do
begin
@ -865,7 +858,11 @@ finalization
end.
{
$Log$
Revision 1.27 2003-09-14 12:58:29 peter
Revision 1.28 2003-10-07 16:06:30 peter
* tsymlist.def renamed to tsymlist.procdef
* tsymlist.procdef is now only used to store the procdef
Revision 1.27 2003/09/14 12:58:29 peter
* give IE when st is not assigned in deref
Revision 1.26 2003/06/25 18:31:23 peter