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
write FOnFindDefineProperty;
function FindLFMFileName(Code: TCodeBuffer): string;
function CheckLFM(UnitCode, LFMBuf: TCodeBuffer;
out LFMTree: TLFMTree;
function CheckLFM(UnitCode, LFMBuf: TCodeBuffer; out LFMTree: TLFMTree;
RootMustBeClassInUnit, RootMustBeClassInIntf,
ObjectsMustExist: boolean): boolean;
function FindNextResourceFile(Code: TCodeBuffer;

View File

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

View File

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