mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 21:51:42 +02:00
* self is not a token anymore. It is handled special when found
in a code block and when parsing an method
This commit is contained in:
parent
8fcfcc6606
commit
56ebcd1249
@ -71,12 +71,12 @@ implementation
|
||||
symconst,symbase,symsym,symtable,defutil,defcmp,
|
||||
{ pass 1 }
|
||||
pass_1,htypechk,
|
||||
nutils,nmat,nadd,ncal,nmem,nset,ncnv,ninl,ncon,nld,nflw,nbas,
|
||||
nmat,nadd,ncal,nmem,nset,ncnv,ninl,ncon,nld,nflw,nbas,
|
||||
{ parser }
|
||||
scanner,
|
||||
pbase,pinline,
|
||||
{ codegen }
|
||||
cgbase,procinfo
|
||||
procinfo
|
||||
;
|
||||
|
||||
{ sub_expr(opmultiply) is need to get -1 ** 4 to be
|
||||
@ -805,7 +805,7 @@ implementation
|
||||
|
||||
|
||||
{ the following procedure handles the access to a property symbol }
|
||||
procedure handle_propertysym(sym : tsym;st : tsymtable;var p1 : tnode; getaddr: boolean);
|
||||
procedure handle_propertysym(sym : tsym;st : tsymtable;var p1 : tnode);
|
||||
|
||||
procedure symlist_to_node(var p1:tnode;pl:tsymlist);
|
||||
var
|
||||
@ -1093,7 +1093,7 @@ implementation
|
||||
begin
|
||||
if isclassref then
|
||||
Message(parser_e_only_class_methods_via_class_ref);
|
||||
handle_propertysym(sym,sym.owner,p1,getaddr);
|
||||
handle_propertysym(sym,sym.owner,p1);
|
||||
end;
|
||||
else internalerror(16);
|
||||
end;
|
||||
@ -1390,7 +1390,7 @@ implementation
|
||||
Message(parser_e_only_class_methods);
|
||||
{ no method pointer }
|
||||
p1:=nil;
|
||||
handle_propertysym(srsym,srsymtable,p1,getaddr);
|
||||
handle_propertysym(srsym,srsymtable,p1);
|
||||
end;
|
||||
|
||||
labelsym :
|
||||
@ -1564,7 +1564,7 @@ implementation
|
||||
begin
|
||||
{ The property symbol is referenced indirect }
|
||||
inc(protsym.refs);
|
||||
handle_propertysym(protsym,protsym.owner,p1,getaddr);
|
||||
handle_propertysym(protsym,protsym.owner,p1);
|
||||
end;
|
||||
end
|
||||
else
|
||||
@ -1817,7 +1817,19 @@ implementation
|
||||
again:=false;
|
||||
if token=_ID then
|
||||
begin
|
||||
factor_read_id(p1,again);
|
||||
again:=true;
|
||||
{ Handle references to self }
|
||||
if (idtoken=_SELF) and
|
||||
not(block_type in [bt_const,bt_type]) and
|
||||
assigned(current_procinfo) and
|
||||
assigned(current_procinfo.procdef._class) then
|
||||
begin
|
||||
p1:=load_self_node;
|
||||
consume(_ID);
|
||||
again:=true;
|
||||
end
|
||||
else
|
||||
factor_read_id(p1,again);
|
||||
if again then
|
||||
begin
|
||||
check_tokenpos;
|
||||
@ -1828,24 +1840,6 @@ implementation
|
||||
end
|
||||
else
|
||||
case token of
|
||||
_SELF :
|
||||
begin
|
||||
again:=true;
|
||||
consume(_SELF);
|
||||
if not(assigned(current_procinfo) and
|
||||
assigned(current_procinfo.procdef._class)) then
|
||||
begin
|
||||
p1:=cerrornode.create;
|
||||
again:=false;
|
||||
Message(parser_e_self_not_in_method);
|
||||
end
|
||||
else
|
||||
begin
|
||||
p1:=load_self_node;
|
||||
postfixoperators(p1,again);
|
||||
end;
|
||||
end;
|
||||
|
||||
_INHERITED :
|
||||
begin
|
||||
again:=true;
|
||||
@ -2418,7 +2412,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.134 2003-10-09 15:00:13 florian
|
||||
Revision 1.135 2003-10-09 15:20:56 peter
|
||||
* self is not a token anymore. It is handled special when found
|
||||
in a code block and when parsing an method
|
||||
|
||||
Revision 1.134 2003/10/09 15:00:13 florian
|
||||
* fixed constructor call in class methods
|
||||
|
||||
Revision 1.133 2003/10/08 19:19:45 peter
|
||||
|
@ -1057,7 +1057,6 @@ implementation
|
||||
var
|
||||
old_current_procinfo : tprocinfo;
|
||||
oldconstsymtable : tsymtable;
|
||||
oldselftokenmode,
|
||||
oldfailtokenmode : tmodeswitch;
|
||||
pdflags : tpdflags;
|
||||
pd : tprocdef;
|
||||
@ -1169,12 +1168,6 @@ implementation
|
||||
oldfailtokenmode:=tokeninfo^[_FAIL].keyword;
|
||||
tokeninfo^[_FAIL].keyword:=m_all;
|
||||
end;
|
||||
{ set _SELF as keyword if methods }
|
||||
if assigned(pd._class) then
|
||||
begin
|
||||
oldselftokenmode:=tokeninfo^[_SELF].keyword;
|
||||
tokeninfo^[_SELF].keyword:=m_all;
|
||||
end;
|
||||
|
||||
tcgprocinfo(current_procinfo).parse_body;
|
||||
|
||||
@ -1192,9 +1185,6 @@ implementation
|
||||
{ reset _FAIL as _SELF normal }
|
||||
if (pd.proctypeoption=potype_constructor) then
|
||||
tokeninfo^[_FAIL].keyword:=oldfailtokenmode;
|
||||
if assigned(pd._class) then
|
||||
tokeninfo^[_SELF].keyword:=oldselftokenmode;
|
||||
consume(_SEMICOLON);
|
||||
|
||||
{ release procinfo }
|
||||
if tprocinfo(current_module.procinfo)<>current_procinfo then
|
||||
@ -1202,6 +1192,8 @@ implementation
|
||||
current_module.procinfo:=current_procinfo.parent;
|
||||
if not isnestedproc then
|
||||
current_procinfo.free;
|
||||
|
||||
consume(_SEMICOLON);
|
||||
end;
|
||||
|
||||
{ Restore old state }
|
||||
@ -1316,7 +1308,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.159 2003-10-07 15:17:07 peter
|
||||
Revision 1.160 2003-10-09 15:20:56 peter
|
||||
* self is not a token anymore. It is handled special when found
|
||||
in a code block and when parsing an method
|
||||
|
||||
Revision 1.159 2003/10/07 15:17:07 peter
|
||||
* inline supported again, LOC_REFERENCEs are used to pass the
|
||||
parameters
|
||||
* inlineparasymtable,inlinelocalsymtable removed
|
||||
|
Loading…
Reference in New Issue
Block a user