summaryrefslogtreecommitdiff
path: root/compiler/pexpr.pas
diff options
context:
space:
mode:
authornickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2018-06-29 14:16:35 +0000
committernickysn <nickysn@3ad0048d-3df7-0310-abae-a5850022a9f2>2018-06-29 14:16:35 +0000
commit16076691979501d9133fec8573ed00461c94ef00 (patch)
tree1ca2bb66414c82a536665a90f452f9947e0275fe /compiler/pexpr.pas
parent7321ce5221e487781c6007d78aa142caaeb1fe0d (diff)
downloadfpc-16076691979501d9133fec8573ed00461c94ef00.tar.gz
+ support TP7-compatible @proc^ (as in FillChar(@proc^,...))
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@39343 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/pexpr.pas')
-rw-r--r--compiler/pexpr.pas31
1 files changed, 27 insertions, 4 deletions
diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas
index 11f8a65d00..53e92f277b 100644
--- a/compiler/pexpr.pas
+++ b/compiler/pexpr.pas
@@ -2767,7 +2767,7 @@ implementation
wasgenericdummy,
allowspecialize,
isspecialize,
- unit_found : boolean;
+ unit_found, tmpgetaddr: boolean;
dummypos,
tokenpos: tfileposinfo;
spezcontext : tspecializationcontext;
@@ -3182,8 +3182,13 @@ implementation
callflags:=[]
else
callflags:=[cnf_unit_specified];
- do_proc_call(srsym,srsymtable,nil,
- (getaddr and not(token in [_CARET,_POINT,_LECKKLAMMER])),
+ { TP7 uglyness: @proc^ is parsed as (@proc)^,
+ but @notproc^ is parsed as @(notproc^) }
+ if m_tp_procvar in current_settings.modeswitches then
+ tmpgetaddr:=getaddr and not(token in [_POINT,_LECKKLAMMER])
+ else
+ tmpgetaddr:=getaddr and not(token in [_CARET,_POINT,_LECKKLAMMER]);
+ do_proc_call(srsym,srsymtable,nil,tmpgetaddr,
again,p1,callflags,spezcontext);
spezcontext:=nil;
end;
@@ -3416,6 +3421,11 @@ implementation
sub_expr if necessary }
dopostfix:=not could_be_generic(idstr);
end;
+ { TP7 uglyness: @proc^ is parsed as (@proc)^, but @notproc^ is parsed
+ as @(notproc^) }
+ if (m_tp_procvar in current_settings.modeswitches) and (token=_CARET) and
+ getaddr and (p1.nodetype=loadn) and (tloadnode(p1).symtableentry.typ=procsym) then
+ dopostfix:=false;
{ maybe an additional parameter instead of misusing hadspezialize? }
if dopostfix and not (ef_had_specialize in flags) then
updatefpos:=postfixoperators(p1,again,getaddr);
@@ -3770,7 +3780,15 @@ implementation
end
else
p1:=factor(true,[]);
- if token in postfixoperator_tokens then
+ if (token in postfixoperator_tokens) and
+ { TP7 uglyness: @proc^ is parsed as (@proc)^, but @notproc^
+ is parsed as @(notproc^) }
+ not
+ (
+ (m_tp_procvar in current_settings.modeswitches) and
+ (token=_CARET) and (p1.nodetype=loadn) and (tloadnode(p1).symtableentry.typ=procsym)
+ )
+ then
begin
again:=true;
postfixoperators(p1,again,getaddr);
@@ -3786,6 +3804,11 @@ implementation
if assigned(getprocvardef) and
(taddrnode(p1).left.nodetype = loadn) then
taddrnode(p1).getprocvardef:=getprocvardef;
+ if (token in postfixoperator_tokens) then
+ begin
+ again:=true;
+ postfixoperators(p1,again,getaddr);
+ end;
end;
_LKLAMMER :