Codetools: formatting

git-svn-id: trunk@41947 -
This commit is contained in:
juha 2013-06-30 22:05:48 +00:00
parent bdc7156f0f
commit 8ae11e18a5
3 changed files with 18 additions and 31 deletions

View File

@ -682,8 +682,7 @@ type
read FOnFindDefineProperty read FOnFindDefineProperty
write FOnFindDefineProperty; write FOnFindDefineProperty;
function FindLFMFileName(Code: TCodeBuffer): string; function FindLFMFileName(Code: TCodeBuffer): string;
function CheckLFM(UnitCode, LFMBuf: TCodeBuffer; function CheckLFM(UnitCode, LFMBuf: TCodeBuffer; out LFMTree: TLFMTree;
out LFMTree: TLFMTree;
RootMustBeClassInUnit, RootMustBeClassInIntf, RootMustBeClassInUnit, RootMustBeClassInIntf,
ObjectsMustExist: boolean): boolean; ObjectsMustExist: boolean): boolean;
function FindNextResourceFile(Code: TCodeBuffer; function FindNextResourceFile(Code: TCodeBuffer;

View File

@ -1328,19 +1328,16 @@ begin
Result:=ifrProceedSearch; Result:=ifrProceedSearch;
end; end;
function TEventsCodeTool.CompleteComponent(AComponent, function TEventsCodeTool.CompleteComponent(AComponent, AncestorComponent: TComponent;
AncestorComponent: TComponent;
SourceChangeCache: TSourceChangeCache): boolean; SourceChangeCache: TSourceChangeCache): boolean;
{ - Adds all missing published variable declarations to the class definition { - Adds all missing published variable declarations to the class definition
in the source in the source
} }
var var
UpperClassName: String;
i: Integer; i: Integer;
CurComponent: TComponent; CurComponent: TComponent;
VarName: String; VarName, VarType: String;
UpperCurComponentName: String; UpperClassName, UpperCompName: String;
VarType: String;
begin begin
try try
Result:=false; Result:=false;
@ -1361,14 +1358,12 @@ begin
if VarName='' then continue; if VarName='' then continue;
if (AncestorComponent<>nil) if (AncestorComponent<>nil)
and (AncestorComponent.FindComponent(VarName)<>nil) then continue; and (AncestorComponent.FindComponent(VarName)<>nil) then continue;
UpperCurComponentName:=UpperCaseStr(VarName); UpperCompName:=UpperCaseStr(VarName);
VarType:=CurComponent.ClassName; VarType:=CurComponent.ClassName;
// add missing published variable // add missing published variable
if VarExistsInCodeCompleteClass(UpperCurComponentName) then begin if not VarExistsInCodeCompleteClass(UpperCompName) then begin
end else begin
//DebugLn('[TEventsCodeTool.CompleteComponent] ADDING variable ',CurComponent.Name,':',CurComponent.ClassName); //DebugLn('[TEventsCodeTool.CompleteComponent] ADDING variable ',CurComponent.Name,':',CurComponent.ClassName);
AddClassInsertion(UpperCurComponentName, AddClassInsertion(UpperCompName,VarName+':'+VarType+';',VarName,ncpPublishedVars);
VarName+':'+VarType+';',VarName,ncpPublishedVars);
end; end;
end; end;
{$IFDEF CTDEBUG} {$IFDEF CTDEBUG}

View File

@ -2420,9 +2420,8 @@ var
ChildContext:=CleanFindContext; ChildContext:=CleanFindContext;
IdentifierFound:=(not ContextIsDefault) and IdentifierFound:=(not ContextIsDefault) and
FindLFMIdentifier(LFMObject,LFMObject.NamePosition, FindLFMIdentifier(LFMObject,LFMObject.NamePosition,LFMObjectName,RootContext,
LFMObjectName,RootContext,SearchAlsoInDefineProperties,ObjectsMustExist, SearchAlsoInDefineProperties,ObjectsMustExist,ChildContext);
ChildContext);
//debugln(['CheckLFMChildObject LFMObjectName="',LFMObjectName,'" IdentifierFound=',IdentifierFound,' ObjectsMustExist=',ObjectsMustExist,' ',FindContextToString(ChildContext)]); //debugln(['CheckLFMChildObject LFMObjectName="',LFMObjectName,'" IdentifierFound=',IdentifierFound,' ObjectsMustExist=',ObjectsMustExist,' ',FindContextToString(ChildContext)]);
if IdentifierFound and (ObjectsMustExist or (ChildContext.Node<>nil)) then if IdentifierFound and (ObjectsMustExist or (ChildContext.Node<>nil)) then
@ -2436,16 +2435,13 @@ var
// check if identifier is a variable or property // check if identifier is a variable or property
VariableTypeName:=''; VariableTypeName:='';
if (ChildContext.Node.Desc=ctnVarDefinition) then begin if (ChildContext.Node.Desc=ctnVarDefinition) then begin
DefinitionNode:=ChildContext.Tool.FindTypeNodeOfDefinition( DefinitionNode:=ChildContext.Tool.FindTypeNodeOfDefinition(ChildContext.Node);
ChildContext.Node);
if DefinitionNode<>nil then begin if DefinitionNode<>nil then begin
VariableTypeName:=ChildContext.Tool.ExtractDefinitionNodeType( VariableTypeName:=ChildContext.Tool.ExtractDefinitionNodeType(ChildContext.Node);
ChildContext.Node);
end; end;
end else if (ChildContext.Node.Desc=ctnProperty) then begin end else if (ChildContext.Node.Desc=ctnProperty) then begin
DefinitionNode:=ChildContext.Node; DefinitionNode:=ChildContext.Node;
VariableTypeName:= VariableTypeName:=ChildContext.Tool.ExtractPropType(ChildContext.Node,false,false);
ChildContext.Tool.ExtractPropType(ChildContext.Node,false,false);
end; end;
if DefinitionNode=nil then begin if DefinitionNode=nil then begin
LFMTree.AddError(lfmeObjectIncompatible,LFMObject, LFMTree.AddError(lfmeObjectIncompatible,LFMObject,
@ -2588,15 +2584,12 @@ var
while CurLFMNode<>nil do begin while CurLFMNode<>nil do begin
//DebugLn('TStandardCodeTool.CheckLFM.CheckLFMObjectValues B ',CurLFMNode.ClassName); //DebugLn('TStandardCodeTool.CheckLFM.CheckLFMObjectValues B ',CurLFMNode.ClassName);
case CurLFMNode.TheType of case CurLFMNode.TheType of
lfmnObject:
lfmnObject: CheckLFMChildObject(TLFMObjectNode(CurLFMNode),ClassContext,false,
CheckLFMChildObject(TLFMObjectNode(CurLFMNode),ClassContext,false, ContextIsDefault);
ContextIsDefault); lfmnProperty:
if not ContextIsDefault then
lfmnProperty: CheckLFMProperty(TLFMPropertyNode(CurLFMNode),ClassContext);
if not ContextIsDefault then
CheckLFMProperty(TLFMPropertyNode(CurLFMNode),ClassContext);
end; end;
CurLFMNode:=CurLFMNode.NextSibling; CurLFMNode:=CurLFMNode.NextSibling;
end; end;