* macpas procvars in parameters

This commit is contained in:
peter 2005-01-31 21:27:51 +00:00
parent 34b255d486
commit 371e741a9d

View File

@ -379,21 +379,27 @@ implementation
{ {
handle_procvar needs the same changes handle_procvar needs the same changes
} }
type
tppv = (pv_none,pv_proc,pv_func);
var var
sc : tsinglelist; sc : tsinglelist;
tt : ttype; tt : ttype;
arrayelementtype : ttype; arrayelementtype : ttype;
vs : tparavarsym; vs : tparavarsym;
srsym : tsym; srsym : tsym;
pv : tprocvardef;
hs,
hs1 : string; hs1 : string;
varspez : Tvarspez; varspez : Tvarspez;
defaultvalue : tconstsym; defaultvalue : tconstsym;
defaultrequired : boolean; defaultrequired : boolean;
old_object_option : tsymoptions; old_object_option : tsymoptions;
currparast : tparasymtable; currparast : tparasymtable;
parseprocvar : tppv;
explicit_paraloc : boolean; explicit_paraloc : boolean;
locationstr : string; locationstr : string;
paranr : integer; paranr : integer;
dummytype : ttypesym;
begin begin
explicit_paraloc:=false; explicit_paraloc:=false;
consume(_LKLAMMER); consume(_LKLAMMER);
@ -413,24 +419,37 @@ implementation
current_object_option:=[sp_public]; current_object_option:=[sp_public];
inc(testcurobject); inc(testcurobject);
repeat repeat
parseprocvar:=pv_none;
if try_to_consume(_VAR) then if try_to_consume(_VAR) then
varspez:=vs_var varspez:=vs_var
else else
if try_to_consume(_CONST) then if try_to_consume(_CONST) then
varspez:=vs_const varspez:=vs_const
else else
if (idtoken=_OUT) and (m_out in aktmodeswitches) then if (m_out in aktmodeswitches) and
begin try_to_consume(_OUT) then
consume(_OUT); varspez:=vs_out
varspez:=vs_out
end
else else
if (token=_POINTPOINTPOINT) and (m_mac in aktmodeswitches) then if (m_mac in aktmodeswitches) and
try_to_consume(_POINTPOINTPOINT) then
begin begin
consume(_POINTPOINTPOINT);
include(pd.procoptions,po_varargs); include(pd.procoptions,po_varargs);
break; break;
end end
else
if (m_mac in aktmodeswitches) and
try_to_consume(_PROCEDURE) then
begin
parseprocvar:=pv_proc;
varspez:=vs_const;
end
else
if (m_mac in aktmodeswitches) and
try_to_consume(_FUNCTION) then
begin
parseprocvar:=pv_func;
varspez:=vs_const;
end
else else
varspez:=vs_value; varspez:=vs_value;
defaultvalue:=nil; defaultvalue:=nil;
@ -448,8 +467,40 @@ implementation
consume(_ID); consume(_ID);
until not try_to_consume(_COMMA); until not try_to_consume(_COMMA);
locationstr:=''; locationstr:='';
{ macpas anonymous procvar }
if parseprocvar<>pv_none then
begin
pv:=tprocvardef.create(normal_function_level);
if token=_LKLAMMER then
parse_parameter_dec(pv);
if parseprocvar=pv_func then
begin
consume(_COLON);
single_type(pd.rettype,hs,false);
end;
if token=_OF then
begin
consume(_OF);
consume(_OBJECT);
include(pd.procoptions,po_methodpointer);
end;
tt.def:=pv;
{ possible proc directives }
if check_proc_directive(true) then
begin
dummytype:=ttypesym.create('unnamed',tt);
parse_var_proc_directives(tsym(dummytype));
dummytype.restype.def:=nil;
tt.def.typesym:=nil;
dummytype.free;
end;
{ Add implicit hidden parameters and function result }
handle_calling_convention(pv);
hs1:='procvar';
end
else
{ read type declaration, force reading for value and const paras } { read type declaration, force reading for value and const paras }
if (token=_COLON) or (varspez=vs_value) then if (token=_COLON) or (varspez=vs_value) then
begin begin
consume(_COLON); consume(_COLON);
{ check for an open array } { check for an open array }
@ -2408,7 +2459,10 @@ const
end. end.
{ {
$Log$ $Log$
Revision 1.226 2005-01-19 22:19:41 peter Revision 1.227 2005-01-31 21:27:51 peter
* macpas procvars in parameters
Revision 1.226 2005/01/19 22:19:41 peter
* unit mapping rewrite * unit mapping rewrite
* new derefmap added * new derefmap added