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

@ -1246,9 +1246,9 @@ function TCodeToolManager.ListAllCreateFormStatements(
Code: TCodeBuffer): TStrings;
begin
Result:=nil;
{$IFDEF CTDEBUG}
writeln('TCodeToolManager.ListAllCreateFormStatements A ',Code.Filename);
{$ENDIF}
{$IFDEF CTDEBUG}
writeln('TCodeToolManager.ListAllCreateFormStatements A ',Code.Filename);
{$ENDIF}
if not InitCurCodeTool(Code) then exit;
try
Result:=FCurCodeTool.ListAllCreateFormStatements;
@ -1261,9 +1261,9 @@ function TCodeToolManager.SetAllCreateFromStatements(Code: TCodeBuffer;
List: TStrings): boolean;
begin
Result:=false;
{$IFDEF CTDEBUG}
writeln('TCodeToolManager.SetAllCreateFromStatements A ',Code.Filename);
{$ENDIF}
{$IFDEF CTDEBUG}
writeln('TCodeToolManager.SetAllCreateFromStatements A ',Code.Filename);
{$ENDIF}
if not InitCurCodeTool(Code) then exit;
try
Result:=FCurCodeTool.SetAllCreateFromStatements(List,SourceChangeCache);
@ -1276,9 +1276,9 @@ function TCodeToolManager.PublishedVariableExists(Code: TCodeBuffer;
const AClassName, AVarName: string): boolean;
begin
Result:=false;
{$IFDEF CTDEBUG}
writeln('TCodeToolManager.PublishedVariableExists A ',Code.Filename,' ',AClassName,':',AVarName);
{$ENDIF}
{$IFDEF CTDEBUG}
writeln('TCodeToolManager.PublishedVariableExists A ',Code.Filename,' ',AClassName,':',AVarName);
{$ENDIF}
if not InitCurCodeTool(Code) then exit;
try
Result:=FCurCodeTool.FindPublishedVariable(UpperCaseStr(AClassName),
@ -1292,9 +1292,9 @@ function TCodeToolManager.AddPublishedVariable(Code: TCodeBuffer;
const AClassName, VarName, VarType: string): boolean;
begin
Result:=false;
{$IFDEF CTDEBUG}
writeln('TCodeToolManager.AddPublishedVariable A ',Code.Filename,' ',AClassName,':',VarName);
{$ENDIF}
{$IFDEF CTDEBUG}
writeln('TCodeToolManager.AddPublishedVariable A ',Code.Filename,' ',AClassName,':',VarName);
{$ENDIF}
if not InitCurCodeTool(Code) then exit;
try
Result:=FCurCodeTool.AddPublishedVariable(UpperCaseStr(AClassName),

View File

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

View File

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

View File

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