MG: fixed collect declarations

git-svn-id: trunk@1732 -
This commit is contained in:
lazarus 2002-06-05 19:46:46 +00:00
parent 87b9c1b7cf
commit 3efe784a25
4 changed files with 32 additions and 23 deletions

View File

@ -227,7 +227,6 @@ begin
Params:=TFindDeclarationParams.Create; Params:=TFindDeclarationParams.Create;
try try
Params.ContextNode:=ClassNode.Parent; Params.ContextNode:=ClassNode.Parent;
writeln('BBB1');
SearchedExprList:=CreateExprListFromMethodTypeData(TypeData,Params); SearchedExprList:=CreateExprListFromMethodTypeData(TypeData,Params);
// create compatibility list // create compatibility list
CompListSize:=SizeOf(TTypeCompatibility)*SearchedExprList.Count; CompListSize:=SizeOf(TTypeCompatibility)*SearchedExprList.Count;
@ -417,7 +416,6 @@ begin
// convert the TypeData to an expression type list // convert the TypeData to an expression type list
Params.ContextNode:=Params.NewNode; Params.ContextNode:=Params.NewNode;
writeln('AAA1');
SearchedExprList:=CreateExprListFromMethodTypeData(TypeData,Params); SearchedExprList:=CreateExprListFromMethodTypeData(TypeData,Params);
// create compatibility list // create compatibility list
CompListSize:=SizeOf(TTypeCompatibility)*SearchedExprList.Count; CompListSize:=SizeOf(TTypeCompatibility)*SearchedExprList.Count;

View File

@ -784,7 +784,7 @@ begin
raise Exception.Create('[TCodeTreeNodeCache.FindNearestAVLNode]' raise Exception.Create('[TCodeTreeNodeCache.FindNearestAVLNode]'
+' internal error: CleanStartPos>CleanEndPos'); +' internal error: CleanStartPos>CleanEndPos');
end; end;
if FItems<>nil then begin if (FItems<>nil) and (Identifier<>nil) then begin
Result:=FItems.Root; Result:=FItems.Root;
while Result<>nil do begin while Result<>nil do begin
Entry:=PCodeTreeNodeCacheEntry(Result.Data); Entry:=PCodeTreeNodeCacheEntry(Result.Data);

View File

@ -1130,6 +1130,9 @@ var
NodeCache: TCodeTreeNodeCache; NodeCache: TCodeTreeNodeCache;
begin begin
Result:=false; Result:=false;
// the node cache is identifier based
if (fdfCollect in Params.Flags) then exit;
NodeCache:=GetNodeCache(ContextNode,false); NodeCache:=GetNodeCache(ContextNode,false);
if (NodeCache<>LastNodeCache) then begin if (NodeCache<>LastNodeCache) then begin
// NodeCache changed -> search nearest cache entry for the identifier // NodeCache changed -> search nearest cache entry for the identifier
@ -1210,7 +1213,8 @@ var
exit; exit;
end; end;
if not (fdfExceptionOnNotFound in Params.Flags) then exit; if not (fdfExceptionOnNotFound in Params.Flags) then exit;
if WordIsPredefinedIdentifier.DoIt(Params.Identifier) if (Params.Identifier<>nil)
and WordIsPredefinedIdentifier.DoIt(Params.Identifier)
and not (fdfExceptionOnPredefinedIdent in Params.Flags) then exit; and not (fdfExceptionOnPredefinedIdent in Params.Flags) then exit;
// identifier was not found and exception is wanted // identifier was not found and exception is wanted
// -> raise exception // -> raise exception
@ -1239,7 +1243,8 @@ var
// false if search should continue // false if search should continue
begin begin
Result:=false; Result:=false;
if CompareSrcIdentifiers(ContextNode.StartPos,Params.Identifier) if (fdfCollect in Params.Flags)
or CompareSrcIdentifiers(ContextNode.StartPos,Params.Identifier)
then begin then begin
{$IFDEF ShowTriedIdentifiers} {$IFDEF ShowTriedIdentifiers}
writeln(' Definition Identifier found="',GetIdentifier(Params.Identifier),'"'); writeln(' Definition Identifier found="',GetIdentifier(Params.Identifier),'"');
@ -1263,7 +1268,8 @@ var
MoveCursorToNodeStart(ContextNode); MoveCursorToNodeStart(ContextNode);
ReadNextAtom; // read keyword ReadNextAtom; // read keyword
ReadNextAtom; // read name ReadNextAtom; // read name
if CompareSrcIdentifiers(CurPos.StartPos,Params.Identifier) then if (fdfCollect in Params.Flags)
or CompareSrcIdentifiers(CurPos.StartPos,Params.Identifier) then
begin begin
// identifier found // identifier found
{$IFDEF ShowTriedIdentifiers} {$IFDEF ShowTriedIdentifiers}
@ -1282,12 +1288,13 @@ var
// false if search should continue // false if search should continue
begin begin
Result:=false; Result:=false;
if (Params.Identifier[0]<>'[') then begin if (fdfCollect in Params.Flags)
or (Params.Identifier[0]<>'[') then begin
MoveCursorToNodeStart(ContextNode); MoveCursorToNodeStart(ContextNode);
ReadNextAtom; // read keyword 'property' ReadNextAtom; // read keyword 'property'
ReadNextAtom; // read name ReadNextAtom; // read name
if CompareSrcIdentifiers(CurPos.StartPos,Params.Identifier) then if (fdfCollect in Params.Flags)
begin or CompareSrcIdentifiers(CurPos.StartPos,Params.Identifier) then begin
// identifier found // identifier found
{$IFDEF ShowTriedIdentifiers} {$IFDEF ShowTriedIdentifiers}
writeln(' Property Identifier found="',GetIdentifier(Params.Identifier),'"'); writeln(' Property Identifier found="',GetIdentifier(Params.Identifier),'"');
@ -1603,9 +1610,13 @@ begin
CurContextNode:=CurContextNode.FirstChild; CurContextNode:=CurContextNode.FirstChild;
while CurContextNode<>nil do begin while CurContextNode<>nil do begin
if (CurContextNode.Desc in [ctnEnumIdentifier]) if (CurContextNode.Desc in [ctnEnumIdentifier])
and CompareSrcIdentifiers(CurContextNode.StartPos,Params.Identifier) and ((fdfCollect in Params.Flags)
or CompareSrcIdentifiers(CurContextNode.StartPos,Params.Identifier))
then begin then begin
// identifier found // identifier found
// ToDo: fdfCollect
Result:=true; Result:=true;
Params.SetResult(Self,CurContextNode); Params.SetResult(Self,CurContextNode);
exit; exit;