mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-31 11:40:33 +02:00
IDE: identifier completion: do not auto add assignment operator for array types
git-svn-id: trunk@25960 -
This commit is contained in:
parent
886f997841
commit
f4e38dd872
@ -88,7 +88,9 @@ type
|
||||
iliIsDestructor,
|
||||
iliIsDestructorValid,
|
||||
iliKeyword,
|
||||
iliResultTypeValid
|
||||
iliResultTypeValid,
|
||||
iliHasIndexValid,
|
||||
iliHasIndex
|
||||
);
|
||||
TIdentListItemFlags = set of TIdentListItemFlag;
|
||||
|
||||
@ -143,6 +145,7 @@ type
|
||||
function CanBeAssigned: boolean;
|
||||
procedure UpdateBaseContext;
|
||||
function HasChilds: boolean;
|
||||
function HasIndex: boolean;
|
||||
function IsFunction: boolean;
|
||||
function IsContructor: boolean;
|
||||
function IsDestructor: boolean;
|
||||
@ -2723,6 +2726,29 @@ begin
|
||||
Result:=iliHasChilds in Flags;
|
||||
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;
|
||||
var
|
||||
ANode: TCodeTreeNode;
|
||||
|
@ -622,6 +622,7 @@ begin
|
||||
and (ilcfStartOfStatement in IdentList.ContextFlags)
|
||||
and (ilcfEndOfLine in IdentList.ContextFlags)
|
||||
and (not IdentItem.HasChilds)
|
||||
and (not IdentItem.HasIndex)
|
||||
and (not IdentList.StartUpAtomBehindIs(':='))
|
||||
and (not IdentList.StartUpAtomBehindIs('('))
|
||||
and (IdentItem.CanBeAssigned)
|
||||
|
Loading…
Reference in New Issue
Block a user