codetools: finddeclaration: implemented using generics parameters as type identifiers

git-svn-id: trunk@12408 -
This commit is contained in:
mattias 2007-10-10 17:07:00 +00:00
parent bf2f4fb951
commit cf3d81df7b

View File

@ -3087,15 +3087,18 @@ begin
TypeFound:=Params.NewCodeTool.FindIdentifierInContext(Params); TypeFound:=Params.NewCodeTool.FindIdentifierInContext(Params);
end; end;
if TypeFound then begin if TypeFound then begin
// only types allowed here, not generics // only types allowed here
if Params.NewNode.Desc in [ctnTypeDefinition] then begin if Params.NewNode.Desc=ctnTypeDefinition then begin
if NodeExistsInStack(@NodeStack,Params.NewNode) then begin if NodeExistsInStack(@NodeStack,Params.NewNode) then begin
// circle detected // circle detected
Params.NewCodeTool.MoveCursorToNodeStart(Params.NewNode); Params.NewCodeTool.MoveCursorToNodeStart(Params.NewNode);
RaiseCircleDefs; RaiseCircleDefs;
end; end;
Result:=Params.NewCodeTool.FindBaseTypeOfNode(Params, Result:=Params.NewCodeTool.FindBaseTypeOfNode(Params,
Params.NewNode) Params.NewNode);
end else if Params.NewNode.Desc=ctnGenericParameter then begin
Result.Tool:=Params.NewCodeTool;
Result.Node:=Params.NewNode;
end else begin end else begin
// not a type // not a type
MoveCursorToNodeStart(DummyNode); MoveCursorToNodeStart(DummyNode);
@ -3132,8 +3135,8 @@ begin
+(fdfGlobals*Params.Flags); +(fdfGlobals*Params.Flags);
Params.ContextNode:=Result.Node.Parent; Params.ContextNode:=Result.Node.Parent;
if FindIdentifierInContext(Params) then begin if FindIdentifierInContext(Params) then begin
// only types allowed, not generics // only types allowed
if Params.NewNode.Desc in [ctnTypeDefinition] then begin if Params.NewNode.Desc=ctnTypeDefinition then begin
if NodeExistsInStack(@NodeStack,Params.NewNode) then begin if NodeExistsInStack(@NodeStack,Params.NewNode) then begin
// circle detected // circle detected
Params.NewCodeTool.MoveCursorToNodeStart(Params.NewNode); Params.NewCodeTool.MoveCursorToNodeStart(Params.NewNode);
@ -3141,6 +3144,9 @@ begin
end; end;
Result:=Params.NewCodeTool.FindBaseTypeOfNode(Params, Result:=Params.NewCodeTool.FindBaseTypeOfNode(Params,
Params.NewNode) Params.NewNode)
end else if Params.NewNode.Desc=ctnGenericParameter then begin
Result.Tool:=Params.NewCodeTool;
Result.Node:=Params.NewNode;
end else begin end else begin
// not a type // not a type
MoveCursorToCleanPos(OldPos); MoveCursorToCleanPos(OldPos);
@ -5596,10 +5602,13 @@ var
+(fdfGlobals*Params.Flags); +(fdfGlobals*Params.Flags);
Params.ContextNode:=ExprType.Context.Node.Parent; Params.ContextNode:=ExprType.Context.Node.Parent;
if ExprType.Context.Tool.FindIdentifierInContext(Params) then begin if ExprType.Context.Tool.FindIdentifierInContext(Params) then begin
// only types allowed, not generics // only types allowed
if Params.NewNode.Desc in [ctnTypeDefinition] then begin if Params.NewNode.Desc=ctnTypeDefinition then begin
ExprType.Context:=Params.NewCodeTool.FindBaseTypeOfNode(Params, ExprType.Context:=Params.NewCodeTool.FindBaseTypeOfNode(Params,
Params.NewNode) Params.NewNode);
end else if Params.NewNode.Desc=ctnGenericParameter then begin
ExprType.Context.Tool:=Params.NewCodeTool;
ExprType.Context.Node:=Params.NewNode;
end else begin end else begin
// not a type // not a type
ExprType.Context.Tool.ReadTilTypeOfProperty(ExprType.Context.Node); ExprType.Context.Tool.ReadTilTypeOfProperty(ExprType.Context.Node);