mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 10:19:36 +02:00
codetools: CheckLFM: variable type with unit name
This commit is contained in:
parent
7dec126e98
commit
a7f2330310
@ -987,9 +987,13 @@ begin
|
||||
PrependStr:=PrependStr+'noTree';
|
||||
end;}
|
||||
if PrependStr<>'' then begin
|
||||
if Result<>'' then
|
||||
Result:='/'+Result;
|
||||
Result:=PrependStr+Result;
|
||||
if Result<>'' then begin
|
||||
if ANode is TLFMObjectNode then
|
||||
Result:='.'+Result
|
||||
else
|
||||
Result:='/'+Result;
|
||||
end;
|
||||
Result:=PrependStr+Result;
|
||||
end;
|
||||
ANode:=ANode.Parent;
|
||||
end;
|
||||
|
@ -2372,8 +2372,6 @@ var
|
||||
const VarPropContext: TFindContext): TFindContext;
|
||||
var
|
||||
Params: TFindDeclarationParams;
|
||||
Identifier: PChar;
|
||||
OldInput: TFindDeclarationInput;
|
||||
TypeNode: TCodeTreeNode;
|
||||
VariableTypeName, AnUnitName, TypeName: String;
|
||||
begin
|
||||
@ -2390,11 +2388,9 @@ var
|
||||
LFMObject.NamePosition);
|
||||
end;
|
||||
VariableTypeName:=VarPropContext.Tool.ExtractDefinitionNodeType(VarPropContext.Node);
|
||||
Identifier:=@VarPropContext.Tool.Src[TypeNode.StartPos]
|
||||
end else if (VarPropContext.Node.Desc=ctnProperty) then begin
|
||||
TypeNode:=VarPropContext.Node;
|
||||
VariableTypeName:=VarPropContext.Tool.ExtractPropType(TypeNode,false,false);
|
||||
Identifier:=VarPropContext.Tool.GetPropertyTypeIdentifier(TypeNode);
|
||||
end else begin
|
||||
LFMTree.AddError(lfmeObjectIncompatible,LFMObject,
|
||||
LFMObject.Name+' is not a variable'
|
||||
@ -2410,13 +2406,8 @@ var
|
||||
fdfExceptionOnPredefinedIdent,fdfIgnoreMissingParams,
|
||||
fdfIgnoreOverloadedProcs,fdfIgnoreCurContextNode];
|
||||
Params.ContextNode:=TypeNode;
|
||||
Params.SetIdentifier(VarPropContext.Tool,Identifier,nil);
|
||||
try
|
||||
Params.Save(OldInput);
|
||||
if VarPropContext.Tool.FindIdentifierInContext(Params) then begin
|
||||
Params.Load(OldInput,true);
|
||||
Result:=Params.NewCodeTool.FindBaseTypeOfNode(Params,Params.NewNode);
|
||||
end;
|
||||
Result:=VarPropContext.Tool.FindBaseTypeOfNode(Params,TypeNode);
|
||||
except
|
||||
// ignore search/parse errors
|
||||
on E: ECodeToolError do begin
|
||||
|
@ -304,7 +304,7 @@ end;
|
||||
procedure TTestLFMTrees.LFMUnitname;
|
||||
begin
|
||||
AddControls;
|
||||
AddFormUnit(['Button1: TButton']);
|
||||
AddFormUnit(['Button1: Controls.TButton']);
|
||||
FLFMCode:=AddSource('unit1.lfm',LinesToStr([
|
||||
'object Form1: unit1/TForm1',
|
||||
' object Button1: Controls/TButton',
|
||||
|
Loading…
Reference in New Issue
Block a user