mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 20:19:24 +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_prg.pas svneol=native#text/plain
|
||||||
components/codetools/tests/laztests/bug28866_unit1.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/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/delphi_autodereference1.pas svneol=native#text/plain
|
||||||
components/codetools/tests/laztests/tdefaultproperty1.pas svneol=native#text/plain
|
components/codetools/tests/laztests/tdefaultproperty1.pas svneol=native#text/plain
|
||||||
components/codetools/tests/parsertbase.pas svneol=native#text/plain
|
components/codetools/tests/parsertbase.pas svneol=native#text/plain
|
||||||
|
@ -8021,14 +8021,19 @@ var
|
|||||||
end;
|
end;
|
||||||
ProcNode:=ProcNode.Parent;
|
ProcNode:=ProcNode.Parent;
|
||||||
end;
|
end;
|
||||||
end else if (cmsResult in FLastCompilerModeSwitches)
|
end else if CompareSrcIdentifiers(CurAtom.StartPos,'RESULT')
|
||||||
and CompareSrcIdentifiers(CurAtom.StartPos,'RESULT') then begin
|
and (cmsResult in Scanner.CompilerModeSwitches) then begin
|
||||||
// RESULT has a special meaning in a function
|
// RESULT has a special meaning in a function
|
||||||
// -> check if 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;
|
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;
|
ProcNode:=ProcNode.Parent;
|
||||||
|
end;
|
||||||
if (ProcNode<>nil) then begin
|
if (ProcNode<>nil) then begin
|
||||||
if IsEnd and (fdfFindVariable in StartFlags) then begin
|
if IsEnd and (fdfFindVariable in StartFlags) then begin
|
||||||
BuildSubTreeForProcHead(ProcNode);
|
BuildSubTreeForProcHead(ProcNode);
|
||||||
@ -8048,8 +8053,8 @@ var
|
|||||||
end else begin
|
end else begin
|
||||||
OldFlags:=Params.Flags;
|
OldFlags:=Params.Flags;
|
||||||
Params.Flags:=Params.Flags+[fdfFunctionResult,fdfFindChildren];
|
Params.Flags:=Params.Flags+[fdfFunctionResult,fdfFindChildren];
|
||||||
ExprType.Desc:=xtContext;
|
|
||||||
ExprType.Context:=FindBaseTypeOfNode(Params,ProcNode);
|
ExprType.Context:=FindBaseTypeOfNode(Params,ProcNode);
|
||||||
|
ExprType.Desc:=xtContext;
|
||||||
Params.Flags:=OldFlags;
|
Params.Flags:=OldFlags;
|
||||||
exit;
|
exit;
|
||||||
end;
|
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