mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-24 03:19:17 +02:00
* Parse management operators. Each management operator is special kind of operator without result.
git-svn-id: trunk@35442 -
This commit is contained in:
parent
168e59837a
commit
520bb31fa6
@ -596,6 +596,10 @@ implementation
|
||||
_EXPLICIT:optoken:=_OP_EXPLICIT;
|
||||
_INC:optoken:=_OP_INC;
|
||||
_DEC:optoken:=_OP_DEC;
|
||||
_INITIALIZE:optoken:=_OP_INITIALIZE;
|
||||
_FINALIZE:optoken:=_OP_FINALIZE;
|
||||
_ADDREF:optoken:=_OP_ADDREF;
|
||||
_COPY:optoken:=_OP_COPY;
|
||||
else
|
||||
if (m_delphi in current_settings.modeswitches) then
|
||||
case lastidtoken of
|
||||
@ -1436,6 +1440,33 @@ implementation
|
||||
pd.resultname:=stringdup(orgpattern);
|
||||
consume(_ID);
|
||||
end;
|
||||
{ operators without result (management operators) }
|
||||
if optoken in [_OP_INITIALIZE, _OP_FINALIZE, _OP_ADDREF, _OP_COPY] then
|
||||
begin
|
||||
{ single var parameter to point the record }
|
||||
if (optoken in [_OP_INITIALIZE, _OP_FINALIZE, _OP_ADDREF]) and
|
||||
(
|
||||
(pd.parast.SymList.Count<>1) or
|
||||
(tparavarsym(pd.parast.SymList[0]).vardef<>pd.struct) or
|
||||
(tparavarsym(pd.parast.SymList[0]).varspez<>vs_var)
|
||||
) then
|
||||
Message(parser_e_overload_impossible)
|
||||
{ constref (source) and var (dest) parameter to point the records }
|
||||
else if (optoken=_OP_COPY) and
|
||||
(
|
||||
(pd.parast.SymList.Count<>2) or
|
||||
(tparavarsym(pd.parast.SymList[0]).vardef<>pd.struct) or
|
||||
(tparavarsym(pd.parast.SymList[0]).varspez<>vs_constref) or
|
||||
(tparavarsym(pd.parast.SymList[1]).vardef<>pd.struct) or
|
||||
(tparavarsym(pd.parast.SymList[1]).varspez<>vs_var)
|
||||
) then
|
||||
Message(parser_e_overload_impossible);
|
||||
|
||||
trecordsymtable(pd.procsym.Owner).includemanagementoperator(
|
||||
token2managementoperator(optoken));
|
||||
pd.returndef:=voidtype
|
||||
end
|
||||
else
|
||||
if not try_to_consume(_COLON) then
|
||||
begin
|
||||
consume(_COLON);
|
||||
|
Loading…
Reference in New Issue
Block a user