codetools: find declaration of selfunit.identifier

git-svn-id: trunk@19795 -
This commit is contained in:
mattias 2009-05-04 10:10:07 +00:00
parent 8941c1159c
commit fd88c3a5bd
3 changed files with 14 additions and 6 deletions

View File

@ -26,7 +26,7 @@
<PackageName Value="CodeTools"/>
</Item1>
</RequiredPackages>
<Units Count="2">
<Units Count="3">
<Unit0>
<Filename Value="finddeclaration.lpr"/>
<IsPartOfProject Value="True"/>
@ -37,6 +37,11 @@
<IsPartOfProject Value="True"/>
<UnitName Value="SimpleUnit1"/>
</Unit1>
<Unit2>
<Filename Value="scanexamples/overloadedfunction.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="OverloadedFunction"/>
</Unit2>
</Units>
</ProjectOptions>
<CompilerOptions>

View File

@ -93,8 +93,9 @@ begin
X:=5;
Y:=43;
writeln('FPCSrcDir=',Options.FPCSrcDir);
writeln('FPCDIR=',Options.FPCSrcDir);
writeln('PP=',Options.FPCPath);
writeln('LAZARUSDIR=',Options.LazarusSrcDir);
writeln('TARGET=',Options.TargetOS);
writeln('TARGETCPU=',Options.TargetProcessor);
if (ParamCount>=3) then begin

View File

@ -5927,6 +5927,7 @@ var
Params.Flags:=Params.Flags+[fdfSearchInParentNodes,fdfIgnoreCurContextNode];
end else begin
// only search in special context
Params.Flags:=Params.Flags+[fdfIgnoreUsedUnits];
end;
// check identifier for overloaded procs
@ -5941,7 +5942,7 @@ var
// search ...
Params.SetIdentifier(Self,@Src[CurAtom.StartPos],@CheckSrcIdentifier);
{$IFDEF ShowExprEval}
DebugLn(' ResolveIdentifier Ident="',GetIdentifier(Params.Identifier),'" ',Params.ContextNode.DescAsString,' ',dbgstr(copy(ExprType.Context.Tool.Src,Params.ContextNode.StartPos,15)));
DebugLn(' ResolveIdentifier Ident="',GetIdentifier(Params.Identifier),'" ContextNode=',Params.ContextNode.DescAsString,' ',dbgstr(copy(ExprType.Context.Tool.Src,Params.ContextNode.StartPos,15)));
{$ENDIF}
if ExprType.Context.Tool.FindIdentifierInContext(Params) then begin
if not Params.NewCodeTool.NodeIsConstructor(Params.NewNode) then begin
@ -5979,9 +5980,10 @@ var
end;
if (ExprType.Context.Node.Desc in AllUsableSourceTypes) then begin
// identifier in front of the point is a unit name
if ExprType.Context.Tool<>Self then begin
ExprType.Context.Node:=ExprType.Context.Tool.GetInterfaceNode;
end;
{$IFDEF ShowExprEval}
debugln(['ResolvePoint unit -> interface node']);
{$ENDIF}
ExprType.Context.Node:=ExprType.Context.Tool.GetInterfaceNode;
end
else if (ExprType.Context.Node.Desc=ctnClassOfType) then begin
// 'class of' plus '.' => jump to the class