summaryrefslogtreecommitdiff
path: root/compiler/pdecsub.pas
diff options
context:
space:
mode:
authorsvenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2>2012-05-09 12:32:34 +0000
committersvenbarth <svenbarth@3ad0048d-3df7-0310-abae-a5850022a9f2>2012-05-09 12:32:34 +0000
commitac367fb9b2a701236b10294e2b147fcac30a40a6 (patch)
treec43bd54e9017daf9ea060be0c96a9a6d6c775753 /compiler/pdecsub.pas
parent2587dcdd3eedc445faa03badf5b947afff767610 (diff)
downloadfpc-ac367fb9b2a701236b10294e2b147fcac30a40a6.tar.gz
* pdecsub.pas, parse_proc_dec: always parse operator overload heads as block type bt_body so that operators like ">", "=>" or "<>" are resolved to the correct tokens ("<>" would be a sequence of "_LSHARPBRACKET _RSHARPBRACKET" instead of _NE otherwise). Fixes Mantis #21127
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@21266 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/pdecsub.pas')
-rw-r--r--compiler/pdecsub.pas7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas
index 3206c1e058..f2a7a4b6a7 100644
--- a/compiler/pdecsub.pas
+++ b/compiler/pdecsub.pas
@@ -966,6 +966,7 @@ implementation
locationstr: string;
i: integer;
found: boolean;
+ old_block_type: tblock_type;
procedure read_returndef(pd: tprocdef);
var
@@ -1130,8 +1131,14 @@ implementation
if (token=_OPERATOR) or
(isclassmethod and (idtoken=_OPERATOR)) then
begin
+ { we need to set the block type to bt_body, so that operator names
+ like ">", "=>" or "<>" are parsed correctly instead of e.g.
+ _LSHARPBRACKET and _RSHARPBRACKET for "<>" }
+ old_block_type:=block_type;
+ block_type:=bt_body;
consume(_OPERATOR);
parse_proc_head(astruct,potype_operator,pd);
+ block_type:=old_block_type;
if assigned(pd) then
begin
{ operators always need to be searched in all units }