IDE: identifier completion: do not auto add assignment operator for array types

git-svn-id: trunk@25960 -
This commit is contained in:
mattias 2010-06-07 08:07:25 +00:00
parent 886f997841
commit f4e38dd872
2 changed files with 28 additions and 1 deletions

View File

@ -88,7 +88,9 @@ type
iliIsDestructor, iliIsDestructor,
iliIsDestructorValid, iliIsDestructorValid,
iliKeyword, iliKeyword,
iliResultTypeValid iliResultTypeValid,
iliHasIndexValid,
iliHasIndex
); );
TIdentListItemFlags = set of TIdentListItemFlag; TIdentListItemFlags = set of TIdentListItemFlag;
@ -143,6 +145,7 @@ type
function CanBeAssigned: boolean; function CanBeAssigned: boolean;
procedure UpdateBaseContext; procedure UpdateBaseContext;
function HasChilds: boolean; function HasChilds: boolean;
function HasIndex: boolean;
function IsFunction: boolean; function IsFunction: boolean;
function IsContructor: boolean; function IsContructor: boolean;
function IsDestructor: boolean; function IsDestructor: boolean;
@ -2723,6 +2726,29 @@ begin
Result:=iliHasChilds in Flags; Result:=iliHasChilds in Flags;
end; end;
function TIdentifierListItem.HasIndex: boolean;
// check if edged bracket can be used []
var
ANode: TCodeTreeNode;
begin
if not (iliHasIndexValid in Flags) then begin
UpdateBaseContext;
if BaseExprType.Desc in (xtAllStringConvertibles+xtAllWideStringConvertibles)
then begin
// strings, widestrings and PChar
Include(Flags,iliHasIndex);
end else if (BaseExprType.Desc=xtContext) and (BaseExprType.Context.Node<>nil)
then begin
//debugln(['TIdentifierListItem.HasIndex ',BaseExprType.Context.Node.DescAsString]);
ANode:=BaseExprType.Context.Node;
case ANode.Desc of
ctnRangedArrayType,ctnOpenArrayType: Include(Flags,iliHasIndex);
end;
end;
end;
Result:=iliHasIndex in Flags;
end;
function TIdentifierListItem.IsFunction: boolean; function TIdentifierListItem.IsFunction: boolean;
var var
ANode: TCodeTreeNode; ANode: TCodeTreeNode;

View File

@ -622,6 +622,7 @@ begin
and (ilcfStartOfStatement in IdentList.ContextFlags) and (ilcfStartOfStatement in IdentList.ContextFlags)
and (ilcfEndOfLine in IdentList.ContextFlags) and (ilcfEndOfLine in IdentList.ContextFlags)
and (not IdentItem.HasChilds) and (not IdentItem.HasChilds)
and (not IdentItem.HasIndex)
and (not IdentList.StartUpAtomBehindIs(':=')) and (not IdentList.StartUpAtomBehindIs(':='))
and (not IdentList.StartUpAtomBehindIs('(')) and (not IdentList.StartUpAtomBehindIs('('))
and (IdentItem.CanBeAssigned) and (IdentItem.CanBeAssigned)