mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-14 22:00:10 +02:00
codetools: find declaration: fixed Result in operator proc, bug #28877
git-svn-id: trunk@50118 -
This commit is contained in:
parent
cedf1cec63
commit
90ec47f43b
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1019,6 +1019,7 @@ components/codetools/tests/laztests/bug28861_unit2.pas svneol=native#text/plain
|
||||
components/codetools/tests/laztests/bug28866_prg.pas svneol=native#text/plain
|
||||
components/codetools/tests/laztests/bug28866_unit1.pas svneol=native#text/plain
|
||||
components/codetools/tests/laztests/bug28876.pas svneol=native#text/plain
|
||||
components/codetools/tests/laztests/bug28877.pas svneol=native#text/plain
|
||||
components/codetools/tests/laztests/delphi_autodereference1.pas svneol=native#text/plain
|
||||
components/codetools/tests/laztests/tdefaultproperty1.pas svneol=native#text/plain
|
||||
components/codetools/tests/parsertbase.pas svneol=native#text/plain
|
||||
|
@ -8021,14 +8021,19 @@ var
|
||||
end;
|
||||
ProcNode:=ProcNode.Parent;
|
||||
end;
|
||||
end else if (cmsResult in FLastCompilerModeSwitches)
|
||||
and CompareSrcIdentifiers(CurAtom.StartPos,'RESULT') then begin
|
||||
end else if CompareSrcIdentifiers(CurAtom.StartPos,'RESULT')
|
||||
and (cmsResult in Scanner.CompilerModeSwitches) then begin
|
||||
// RESULT has a special meaning in a function
|
||||
// -> check if in a function
|
||||
if fdfExtractOperand in Params.Flags then Params.AddOperandPart('Result');
|
||||
if fdfExtractOperand in Params.Flags then
|
||||
Params.AddOperandPart('Result');
|
||||
ProcNode:=StartNode;
|
||||
while (ProcNode<>nil) and not NodeIsFunction(ProcNode) do
|
||||
while (ProcNode<>nil) do begin
|
||||
if (ProcNode.Desc=ctnProcedure)
|
||||
and (NodeIsFunction(ProcNode) or NodeIsOperator(ProcNode)) then
|
||||
break;
|
||||
ProcNode:=ProcNode.Parent;
|
||||
end;
|
||||
if (ProcNode<>nil) then begin
|
||||
if IsEnd and (fdfFindVariable in StartFlags) then begin
|
||||
BuildSubTreeForProcHead(ProcNode);
|
||||
@ -8048,8 +8053,8 @@ var
|
||||
end else begin
|
||||
OldFlags:=Params.Flags;
|
||||
Params.Flags:=Params.Flags+[fdfFunctionResult,fdfFindChildren];
|
||||
ExprType.Desc:=xtContext;
|
||||
ExprType.Context:=FindBaseTypeOfNode(Params,ProcNode);
|
||||
ExprType.Desc:=xtContext;
|
||||
Params.Flags:=OldFlags;
|
||||
exit;
|
||||
end;
|
||||
|
24
components/codetools/tests/laztests/bug28877.pas
Normal file
24
components/codetools/tests/laztests/bug28877.pas
Normal file
@ -0,0 +1,24 @@
|
||||
program bug28877;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Classes
|
||||
{ you can add units after this };
|
||||
|
||||
operator := (AValue : Integer) : TGUID;
|
||||
begin
|
||||
Result.Data1{declaration:system.TGUID.Data1};
|
||||
end;
|
||||
|
||||
function Test : TGUID;
|
||||
begin
|
||||
Result.Data1{declaration:system.TGUID.Data1};
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user