mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 05:37:08 +02:00
MG: fixed collect declarations
git-svn-id: trunk@1732 -
This commit is contained in:
parent
87b9c1b7cf
commit
3efe784a25
@ -1246,9 +1246,9 @@ function TCodeToolManager.ListAllCreateFormStatements(
|
|||||||
Code: TCodeBuffer): TStrings;
|
Code: TCodeBuffer): TStrings;
|
||||||
begin
|
begin
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
{$IFDEF CTDEBUG}
|
{$IFDEF CTDEBUG}
|
||||||
writeln('TCodeToolManager.ListAllCreateFormStatements A ',Code.Filename);
|
writeln('TCodeToolManager.ListAllCreateFormStatements A ',Code.Filename);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if not InitCurCodeTool(Code) then exit;
|
if not InitCurCodeTool(Code) then exit;
|
||||||
try
|
try
|
||||||
Result:=FCurCodeTool.ListAllCreateFormStatements;
|
Result:=FCurCodeTool.ListAllCreateFormStatements;
|
||||||
@ -1261,9 +1261,9 @@ function TCodeToolManager.SetAllCreateFromStatements(Code: TCodeBuffer;
|
|||||||
List: TStrings): boolean;
|
List: TStrings): boolean;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
{$IFDEF CTDEBUG}
|
{$IFDEF CTDEBUG}
|
||||||
writeln('TCodeToolManager.SetAllCreateFromStatements A ',Code.Filename);
|
writeln('TCodeToolManager.SetAllCreateFromStatements A ',Code.Filename);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if not InitCurCodeTool(Code) then exit;
|
if not InitCurCodeTool(Code) then exit;
|
||||||
try
|
try
|
||||||
Result:=FCurCodeTool.SetAllCreateFromStatements(List,SourceChangeCache);
|
Result:=FCurCodeTool.SetAllCreateFromStatements(List,SourceChangeCache);
|
||||||
@ -1276,9 +1276,9 @@ function TCodeToolManager.PublishedVariableExists(Code: TCodeBuffer;
|
|||||||
const AClassName, AVarName: string): boolean;
|
const AClassName, AVarName: string): boolean;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
{$IFDEF CTDEBUG}
|
{$IFDEF CTDEBUG}
|
||||||
writeln('TCodeToolManager.PublishedVariableExists A ',Code.Filename,' ',AClassName,':',AVarName);
|
writeln('TCodeToolManager.PublishedVariableExists A ',Code.Filename,' ',AClassName,':',AVarName);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if not InitCurCodeTool(Code) then exit;
|
if not InitCurCodeTool(Code) then exit;
|
||||||
try
|
try
|
||||||
Result:=FCurCodeTool.FindPublishedVariable(UpperCaseStr(AClassName),
|
Result:=FCurCodeTool.FindPublishedVariable(UpperCaseStr(AClassName),
|
||||||
@ -1292,9 +1292,9 @@ function TCodeToolManager.AddPublishedVariable(Code: TCodeBuffer;
|
|||||||
const AClassName, VarName, VarType: string): boolean;
|
const AClassName, VarName, VarType: string): boolean;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
{$IFDEF CTDEBUG}
|
{$IFDEF CTDEBUG}
|
||||||
writeln('TCodeToolManager.AddPublishedVariable A ',Code.Filename,' ',AClassName,':',VarName);
|
writeln('TCodeToolManager.AddPublishedVariable A ',Code.Filename,' ',AClassName,':',VarName);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if not InitCurCodeTool(Code) then exit;
|
if not InitCurCodeTool(Code) then exit;
|
||||||
try
|
try
|
||||||
Result:=FCurCodeTool.AddPublishedVariable(UpperCaseStr(AClassName),
|
Result:=FCurCodeTool.AddPublishedVariable(UpperCaseStr(AClassName),
|
||||||
|
@ -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;
|
||||||
|
@ -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);
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user