codetools: GetPossibleInitsForVariable: enum

git-svn-id: trunk@47882 -
This commit is contained in:
mattias 2015-02-18 17:13:58 +00:00
parent 01be30d9d0
commit eaf61a9302
2 changed files with 24 additions and 4 deletions

View File

@ -6026,6 +6026,8 @@ var
ExprType: TExpressionType;
BeginNode: TCodeTreeNode;
InsertPosDesc: TInsertStatementPosDescription;
Node: TCodeTreeNode;
Tool: TFindDeclarationTool;
begin
{$IFDEF VerboseGetPossibleInitsForVariable}
debugln(['TCodeCompletionCodeTool.GetPossibleInitsForVariable ',dbgs(CursorPos)]);
@ -6081,8 +6083,24 @@ begin
end;
case ExprType.Desc of
// ToDo: sets, ranges, records, objects, pointer, class, class of, interface
//xtContext: ;
xtContext:
begin
// ToDo: sets, ranges, records, objects, pointer, class, class of, interface
Node:=ExprType.Context.Node;
Tool:=ExprType.Context.Tool;
case Node.Desc of
ctnEnumerationType:
begin
// enumeration: add first 10 enums
Node:=Node.FirstChild;
while (Node<>nil) and (Statements.Count<10) do begin
if Node.Desc=ctnEnumIdentifier then
AddAssignment(GetIdentifier(@Tool.Src[Node.StartPos]));
Node:=Node.NextBrother;
end;
end;
end;
end;
xtChar,
xtWideChar: begin AddAssignment('#0'); AddAssignment(''' '''); end;
xtReal,

View File

@ -21,7 +21,8 @@ begin
TestInteger(i);
end;
procedure TestLots({%H-}s: string; {%H-}c: char; {%H-}p: pointer);
procedure TestLots({%H-}s: string; {%H-}c: char; {%H-}p: pointer;
{%H-}SignalState: TSignalState);
begin
end;
@ -31,8 +32,9 @@ var
s: string;
c: char;
p: Pointer;
SignalState: TSignalState;
begin
TestLots(s,c,p);
TestLots(s,c,p,SignalState);
end;
end.