mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-08 10:36:00 +02:00
Codetools: revert changes in TStandardCodeTool.CheckLFM from r41948 #1182ff0df2. Caused regressions. Issue #24702
git-svn-id: trunk@41984 -
This commit is contained in:
parent
06c4055b7c
commit
4f96dcd578
@ -2100,7 +2100,7 @@ function TStandardCodeTool.CheckLFM(LFMBuf: TCodeBuffer; out LFMTree: TLFMTree;
|
|||||||
ObjectsMustExist: boolean): boolean;
|
ObjectsMustExist: boolean): boolean;
|
||||||
var
|
var
|
||||||
RootContext: TFindContext;
|
RootContext: TFindContext;
|
||||||
|
|
||||||
function CheckLFMObjectValues(LFMObject: TLFMObjectNode;
|
function CheckLFMObjectValues(LFMObject: TLFMObjectNode;
|
||||||
const ClassContext: TFindContext; ContextIsDefault: boolean): boolean; forward;
|
const ClassContext: TFindContext; ContextIsDefault: boolean): boolean; forward;
|
||||||
|
|
||||||
@ -2269,19 +2269,20 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if (not Result) and ErrorOnNotFound then begin
|
if (not Result) and ErrorOnNotFound then begin
|
||||||
if (IdentContext.Node<>nil) and (not IsPublished) then
|
if (IdentContext.Node<>nil) and (not IsPublished) then begin
|
||||||
LFMTree.AddError(lfmeIdentifierNotPublished,LFMNode,
|
LFMTree.AddError(lfmeIdentifierNotPublished,LFMNode,
|
||||||
'identifier '+IdentName+' is not published in class '
|
'identifier '+IdentName+' is not published in class '
|
||||||
+'"'+ClassContext.Tool.ExtractClassName(ClassContext.Node,false,true)+'"',
|
+'"'+ClassContext.Tool.ExtractClassName(ClassContext.Node,false,true)+'"',
|
||||||
DefaultErrorPosition);
|
DefaultErrorPosition);
|
||||||
//else -- CheckLFMChildObject adds lfmeIdentifierMissingInCode error for this.
|
end else begin
|
||||||
// LFMTree.AddError(lfmeIdentifierNotFound,LFMNode,
|
LFMTree.AddError(lfmeIdentifierNotFound,LFMNode,
|
||||||
// 'identifier '+IdentName+' not found in class '
|
'identifier '+IdentName+' not found in class '
|
||||||
// +'"'+ClassContext.Tool.ExtractClassName(ClassContext.Node,false,true)+'"',
|
+'"'+ClassContext.Tool.ExtractClassName(ClassContext.Node,false,true)+'"',
|
||||||
// DefaultErrorPosition);
|
DefaultErrorPosition);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FindClassNodeForLFMObject(LFMNode: TLFMTreeNode;
|
function FindClassNodeForLFMObject(LFMNode: TLFMTreeNode;
|
||||||
DefaultErrorPosition: integer;
|
DefaultErrorPosition: integer;
|
||||||
StartTool: TFindDeclarationTool; DefinitionNode: TCodeTreeNode): TFindContext;
|
StartTool: TFindDeclarationTool; DefinitionNode: TCodeTreeNode): TFindContext;
|
||||||
@ -2356,7 +2357,7 @@ var
|
|||||||
if Context.Tool.CleanPosToCaret(Context.Node.StartPos,Caret) then
|
if Context.Tool.CleanPosToCaret(Context.Node.StartPos,Caret) then
|
||||||
Result:=Result+'('+IntToStr(Caret.Y)+','+IntToStr(Caret.X)+')';
|
Result:=Result+'('+IntToStr(Caret.Y)+','+IntToStr(Caret.X)+')';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FindClassContext(const ClassName: string): TFindContext;
|
function FindClassContext(const ClassName: string): TFindContext;
|
||||||
var
|
var
|
||||||
Params: TFindDeclarationParams;
|
Params: TFindDeclarationParams;
|
||||||
@ -2407,7 +2408,7 @@ var
|
|||||||
IdentifierFound: Boolean;
|
IdentifierFound: Boolean;
|
||||||
begin
|
begin
|
||||||
// find variable for object
|
// find variable for object
|
||||||
|
|
||||||
// find identifier in Lookup Root
|
// find identifier in Lookup Root
|
||||||
LFMObjectName:=LFMObject.Name;
|
LFMObjectName:=LFMObject.Name;
|
||||||
//DebugLn('CheckChildObject A LFMObjectName="',LFMObjectName,'"');
|
//DebugLn('CheckChildObject A LFMObjectName="',LFMObjectName,'"');
|
||||||
@ -2449,7 +2450,7 @@ var
|
|||||||
LFMObject.NamePosition);
|
LFMObject.NamePosition);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// check if variable/property has a compatible type
|
// check if variable/property has a compatible type
|
||||||
if (VariableTypeName<>'') then begin
|
if (VariableTypeName<>'') then begin
|
||||||
if (LFMObject.TypeName<>'')
|
if (LFMObject.TypeName<>'')
|
||||||
@ -2463,9 +2464,9 @@ var
|
|||||||
LFMObject.NamePosition);
|
LFMObject.NamePosition);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// ToDo: check if variable/property type exists
|
// ToDo: check if variable/property type exists
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -2477,16 +2478,11 @@ var
|
|||||||
end else begin
|
end else begin
|
||||||
// try the object type
|
// try the object type
|
||||||
ClassContext:=FindClassContext(LFMObject.TypeName);
|
ClassContext:=FindClassContext(LFMObject.TypeName);
|
||||||
if ClassContext.Node=nil then
|
if ClassContext.Node=nil then begin
|
||||||
// object type not found
|
// object type not found
|
||||||
LFMTree.AddError(lfmeIdentifierNotFound,LFMObject,
|
LFMTree.AddError(lfmeIdentifierNotFound,LFMObject,
|
||||||
'type '+LFMObject.TypeName+' not found',
|
'type '+LFMObject.TypeName+' not found',LFMObject.TypeNamePosition);
|
||||||
LFMObject.TypeNamePosition)
|
end;
|
||||||
else
|
|
||||||
// object type found but has no variable in code
|
|
||||||
LFMTree.AddError(lfmeIdentifierMissingInCode,LFMObject,
|
|
||||||
'no variable in code for '+LFMObjectName+', type '+LFMObject.TypeName,
|
|
||||||
LFMObject.TypeNamePosition);
|
|
||||||
end;
|
end;
|
||||||
// check child LFM nodes
|
// check child LFM nodes
|
||||||
if ClassContext.Node<>nil then
|
if ClassContext.Node<>nil then
|
||||||
@ -2494,7 +2490,7 @@ var
|
|||||||
else
|
else
|
||||||
CheckLFMObjectValues(LFMObject,ParentContext,true);
|
CheckLFMObjectValues(LFMObject,ParentContext,true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FindClassNodeForPropertyType(LFMProperty: TLFMPropertyNode;
|
function FindClassNodeForPropertyType(LFMProperty: TLFMPropertyNode;
|
||||||
DefaultErrorPosition: integer; const PropertyContext: TFindContext): TFindContext;
|
DefaultErrorPosition: integer; const PropertyContext: TFindContext): TFindContext;
|
||||||
var
|
var
|
||||||
@ -2548,7 +2544,7 @@ var
|
|||||||
'property without name',LFMProperty.StartPos);
|
'property without name',LFMProperty.StartPos);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// find every part of the property name
|
// find every part of the property name
|
||||||
SearchContext:=ParentContext;
|
SearchContext:=ParentContext;
|
||||||
for i:=0 to LFMProperty.NameParts.Count-1 do begin
|
for i:=0 to LFMProperty.NameParts.Count-1 do begin
|
||||||
@ -2597,7 +2593,7 @@ var
|
|||||||
end;
|
end;
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CheckLFMRoot(RootLFMNode: TLFMTreeNode): boolean;
|
function CheckLFMRoot(RootLFMNode: TLFMTreeNode): boolean;
|
||||||
var
|
var
|
||||||
LookupRootLFMNode: TLFMObjectNode;
|
LookupRootLFMNode: TLFMObjectNode;
|
||||||
@ -2605,7 +2601,7 @@ var
|
|||||||
RootClassNode: TCodeTreeNode;
|
RootClassNode: TCodeTreeNode;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
|
|
||||||
//DebugLn('TStandardCodeTool.CheckLFM.CheckLFMRoot checking root ...');
|
//DebugLn('TStandardCodeTool.CheckLFM.CheckLFMRoot checking root ...');
|
||||||
// get root object node
|
// get root object node
|
||||||
if (RootLFMNode=nil) or (not (RootLFMNode is TLFMObjectNode)) then begin
|
if (RootLFMNode=nil) or (not (RootLFMNode is TLFMObjectNode)) then begin
|
||||||
@ -2613,14 +2609,14 @@ var
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
LookupRootLFMNode:=TLFMObjectNode(RootLFMNode);
|
LookupRootLFMNode:=TLFMObjectNode(RootLFMNode);
|
||||||
|
|
||||||
// get type name of root object
|
// get type name of root object
|
||||||
LookupRootTypeName:=LookupRootLFMNode.TypeName;
|
LookupRootTypeName:=LookupRootLFMNode.TypeName;
|
||||||
if LookupRootTypeName='' then begin
|
if LookupRootTypeName='' then begin
|
||||||
LFMTree.AddError(lfmeMissingRoot,nil,'missing type of root object',1);
|
LFMTree.AddError(lfmeMissingRoot,nil,'missing type of root object',1);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// find root type
|
// find root type
|
||||||
if RootMustBeClassInIntf then begin
|
if RootMustBeClassInIntf then begin
|
||||||
RootClassNode:=FindClassNodeInInterface(LookupRootTypeName,true,false,false);
|
RootClassNode:=FindClassNodeInInterface(LookupRootTypeName,true,false,false);
|
||||||
@ -2644,7 +2640,7 @@ var
|
|||||||
end;
|
end;
|
||||||
Result:=CheckLFMObjectValues(LookupRootLFMNode,RootContext,false);
|
Result:=CheckLFMObjectValues(LookupRootLFMNode,RootContext,false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
CurRootLFMNode: TLFMTreeNode;
|
CurRootLFMNode: TLFMTreeNode;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user