diff --git a/components/codetools/examples/getexpandedoperand.pas b/components/codetools/examples/getexpandedoperand.pas index 51ea2ebc47..486850cb10 100644 --- a/components/codetools/examples/getexpandedoperand.pas +++ b/components/codetools/examples/getexpandedoperand.pas @@ -44,7 +44,7 @@ var begin Filename:='scanexamples/getterexample1.pas'; X:=14; - Y:=53; + Y:=56; if (ParamCount>=1) and (Paramcount<3) then begin writeln('Usage:'); writeln(' ',ParamStr(0)); diff --git a/components/codetools/examples/scanexamples/getterexample1.pas b/components/codetools/examples/scanexamples/getterexample1.pas index 64e6205cc4..5cfb858cd2 100644 --- a/components/codetools/examples/scanexamples/getterexample1.pas +++ b/components/codetools/examples/scanexamples/getterexample1.pas @@ -26,6 +26,7 @@ type function GetBar: integer; override; public procedure DoSomething; + function GetOldest(Older: TOlder): TOldest; end; implementation @@ -49,9 +50,15 @@ var Older: TOlder; begin Older:=TOlder.Create; - with TOlder(Older) do begin + with TOlder(Older) do writeln(Bar); - end; + with Older.GetOldest(Self) do + writeln(Bar); +end; + +function TOlder.GetOldest(Older: TOlder): TOldest; +begin + Result:=Older; end; end. diff --git a/components/codetools/finddeclarationtool.pas b/components/codetools/finddeclarationtool.pas index 3efc884656..32b6ba80f5 100644 --- a/components/codetools/finddeclarationtool.pas +++ b/components/codetools/finddeclarationtool.pas @@ -7343,6 +7343,17 @@ var {$IFDEF ShowExprEval} debugln([' FindExpressionTypeOfTerm ResolveRoundBracketOpen skip typecast/paramlist="',dbgstr(Src,CurAtom.StartPos,CurAtomBracketEndPos-CurAtom.StartPos),'"']); {$ENDIF} + if fdfExtractOperand in Params.Flags then begin + if ExprType.Context.Node.Desc=ctnTypeDefinition then begin + // typecast + Params.AddOperandPart(GetIdentifier(@Src[ExprType.Context.Node.StartPos])); + Params.AddOperandPart('('); + // assumption: one term in brakets + FindExpressionTypeOfTerm(CurAtom.StartPos+1,CurAtomBracketEndPos-1, + Params,false); + Params.AddOperandPart(')'); + end; + end; end else begin // expression {$IFDEF ShowExprEval}