codetools: getsmarthing: class variables

git-svn-id: trunk@37079 -
This commit is contained in:
mattias 2012-04-29 12:41:36 +00:00
parent 3c82a53c6b
commit c5f819c616

View File

@ -2209,13 +2209,13 @@ begin
if ANode.Desc in AllClassSections then begin if ANode.Desc in AllClassSections then begin
case ANode.Desc of case ANode.Desc of
ctnClassPrivate: ctnClassPrivate:
Result:=Result+'private '; Result+='private ';
ctnClassProtected: ctnClassProtected:
Result:=Result+'protected '; Result+='protected ';
ctnClassPublic: ctnClassPublic:
Result:=Result+'public '; Result+='public ';
ctnClassPublished: ctnClassPublished:
Result:=Result+'published '; Result+='published ';
else else
break; break;
end; end;
@ -2225,7 +2225,10 @@ begin
end; end;
end; end;
if Node.Desc = ctnGenericName then Node := Node.Parent; if Node.Parent.Desc = ctnClassClassVar then
Result += 'class ';
if Node.Desc = ctnGenericName then
Node := Node.Parent;
case Node.Desc of case Node.Desc of
ctnIdentifier: ctnIdentifier:
if Assigned(Node.Parent) and (Node.Parent.Desc = ctnProcedureHead) then if Assigned(Node.Parent) and (Node.Parent.Desc = ctnProcedureHead) then
@ -2236,16 +2239,16 @@ begin
ctnEnumIdentifier, ctnGenericType: ctnEnumIdentifier, ctnGenericType:
begin begin
case Node.Desc of case Node.Desc of
ctnVarDefinition: Result:=Result+'var '; ctnVarDefinition: Result+='var ';
ctnTypeDefinition: Result:=Result+'type '; ctnTypeDefinition: Result+='type ';
ctnConstDefinition: Result:=Result+'const '; ctnConstDefinition: Result+='const ';
ctnEnumIdentifier: Result:=Result+'enum '; ctnEnumIdentifier: Result+='enum ';
ctnGenericType: Result:=Result+'generic type '; ctnGenericType: Result+='generic type ';
end; end;
// add class name // add class name
ClassStr := ExtractClassName(Node.Parent, False, true); ClassStr := ExtractClassName(Node.Parent, False, true);
if ClassStr <> '' then Result := Result + ClassStr + '.'; if ClassStr <> '' then Result += ClassStr + '.';
Result:=Result+ExtractDefinitionName(Node); Result:=Result+ExtractDefinitionName(Node);
TypeNode:=FindTypeNodeOfDefinition(Node); TypeNode:=FindTypeNodeOfDefinition(Node);
@ -2254,10 +2257,10 @@ begin
ctnIdentifier, ctnSpecialize, ctnSpecializeType: ctnIdentifier, ctnSpecialize, ctnSpecializeType:
begin begin
if Node.Desc = ctnTypeDefinition then if Node.Desc = ctnTypeDefinition then
Result:=Result+' = ' Result+=' = '
else else
Result:=Result+': '; Result+=': ';
Result := Result + ExtractNode(TypeNode, [phpCommentsToSpace]); Result += ExtractNode(TypeNode, [phpCommentsToSpace]);
end; end;
ctnClass, ctnClassInterface, ctnDispinterface, ctnClass, ctnClassInterface, ctnDispinterface,
ctnObject, ctnRecordType, ctnObject, ctnRecordType,
@ -2265,12 +2268,12 @@ begin
begin begin
MoveCursorToNodeStart(TypeNode); MoveCursorToNodeStart(TypeNode);
ReadNextAtom; ReadNextAtom;
Result:=Result+': '+GetAtom; Result+=': '+GetAtom;
end; end;
ctnConstant: ctnConstant:
begin begin
NodeStr:=' = '+ExtractNode(TypeNode,[phpCommentsToSpace]); NodeStr:=' = '+ExtractNode(TypeNode,[phpCommentsToSpace]);
Result:=Result+copy(NodeStr,1,50); Result+=copy(NodeStr,1,50);
end; end;
end; end;
end else begin end else begin
@ -2281,7 +2284,7 @@ begin
NodeStr:=ExtractCode(Node.StartPos NodeStr:=ExtractCode(Node.StartPos
+GetIdentLen(@Src[Node.StartPos]), +GetIdentLen(@Src[Node.StartPos]),
Node.EndPos,[phpCommentsToSpace]); Node.EndPos,[phpCommentsToSpace]);
Result:=Result+copy(NodeStr,1,50); Result+=copy(NodeStr,1,50);
end; end;
end; end;
end; end;
@ -2292,7 +2295,7 @@ begin
// ToDo: ppu, dcu files // ToDo: ppu, dcu files
Result:=Result+ExtractProcHead(Node, Result+=ExtractProcHead(Node,
[phpAddClassName,phpWithStart,phpWithVarModifiers,phpWithParameterNames, [phpAddClassName,phpWithStart,phpWithVarModifiers,phpWithParameterNames,
phpWithDefaultValues,phpWithResultType,phpWithOfObject,phpCommentsToSpace]); phpWithDefaultValues,phpWithResultType,phpWithOfObject,phpCommentsToSpace]);
end; end;
@ -2310,15 +2313,15 @@ begin
// program without source name // program without source name
Result:='program '+ExtractFileNameOnly(MainFilename)+' '; Result:='program '+ExtractFileNameOnly(MainFilename)+' ';
end else begin end else begin
Result:=Result+GetAtom+' '; Result+=GetAtom+' ';
if Node.Desc = ctnProperty then begin // add class name if Node.Desc = ctnProperty then begin // add class name
ClassStr := ExtractClassName(Node, False, True); ClassStr := ExtractClassName(Node, False, True);
if ClassStr <> '' then Result := Result + ClassStr + '.'; if ClassStr <> '' then Result += ClassStr + '.';
end; end;
ReadNextAtom; ReadNextAtom;
Result:=Result+GetAtom+' '; Result+=GetAtom+' ';
end; end;
end; end;
@ -2329,9 +2332,9 @@ begin
// ToDo: ppu, dcu files // ToDo: ppu, dcu files
MoveCursorToNodeStart(IdentNode); MoveCursorToNodeStart(IdentNode);
Result:=Result+'property '; Result+='property ';
ReadNextAtom; ReadNextAtom;
Result:=Result+GetAtom+' '; Result+=GetAtom+' ';
end; end;
else else
@ -2343,14 +2346,14 @@ begin
if Result<>'' then Result:=Result+LineEnding; if Result<>'' then Result:=Result+LineEnding;
if XYPos.Code=nil then if XYPos.Code=nil then
CleanPosToCaret(Node.StartPos,XYPos); CleanPosToCaret(Node.StartPos,XYPos);
Result:=Result+XYPos.Code.Filename; Result+=XYPos.Code.Filename;
// file position // file position
if XYPos.Y>=1 then begin if XYPos.Y>=1 then begin
Result:=Result+'('+IntToStr(XYPos.Y); Result+='('+IntToStr(XYPos.Y);
if XYPos.X>=1 then begin if XYPos.X>=1 then begin
Result:=Result+','+IntToStr(XYPos.X); Result+=','+IntToStr(XYPos.X);
end; end;
Result:=Result+')'; Result+=')';
end; end;
end; end;
end; end;