* Fix operator as identifier after type

git-svn-id: trunk@37347 -
This commit is contained in:
michael 2017-09-28 11:58:17 +00:00
parent a26ac7dc91
commit 3cc6537345
2 changed files with 21 additions and 1 deletions

View File

@ -2943,7 +2943,7 @@ begin
CurBlock := declNone;
while True do
begin
if CurBlock in [DeclNone,declConst] then
if CurBlock in [DeclNone,declConst,declType] then
Scanner.SetTokenOption(toOperatorToken)
else
Scanner.UnSetTokenOption(toOperatorToken);
@ -3028,6 +3028,7 @@ begin
end;
tkIdentifier:
begin
Scanner.UnSetTokenOption(toOperatorToken);
SaveComments;
case CurBlock of
declConst:

View File

@ -169,6 +169,7 @@ type
Procedure TestFunctionAlias;
Procedure TestOperatorTokens;
procedure TestOperatorNames;
Procedure TestAssignOperatorAfterObject;
Procedure TestFunctionNoResult;
end;
@ -1291,6 +1292,24 @@ begin
end;
end;
procedure TTestProcedureFunction.TestAssignOperatorAfterObject;
begin
Add('unit afile;');
Add('{$mode delphi}');
Add('interface');
Add('type');
Add(' TA =object');
Add(' data:integer;');
Add(' function transpose:integer;');
Add(' end;');
Add('');
Add('operator := (const v:Tvector2_single) result:Tvector2_double;');
Add('implementation');
EndSource;
Parser.Options:=[po_delphi];
ParseModule;
end;
procedure TTestProcedureFunction.TestFunctionNoResult;
begin
Add('unit afile;');