mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 02:09:21 +02:00
codetools: fixed class completion for properties with constant index
git-svn-id: trunk@41864 -
This commit is contained in:
parent
039b3e12c9
commit
7d34128f78
@ -6312,7 +6312,7 @@ type
|
|||||||
|
|
||||||
var
|
var
|
||||||
Parts: array[TPropPart] of TAtomPosition;
|
Parts: array[TPropPart] of TAtomPosition;
|
||||||
PartIsAtom: array[TPropPart] of boolean;
|
PartIsAtom: array[TPropPart] of boolean; // is single identifier
|
||||||
|
|
||||||
procedure ReadSimpleSpec(SpecWord, SpecParam: TPropPart);
|
procedure ReadSimpleSpec(SpecWord, SpecParam: TPropPart);
|
||||||
// allowed after simple specifier like 'read':
|
// allowed after simple specifier like 'read':
|
||||||
@ -6428,6 +6428,8 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ReadIndexSpecifier;
|
procedure ReadIndexSpecifier;
|
||||||
|
var
|
||||||
|
Last: TAtomPosition;
|
||||||
begin
|
begin
|
||||||
if UpAtomIs('INDEX') then begin
|
if UpAtomIs('INDEX') then begin
|
||||||
if Parts[ppIndexWord].StartPos>=1 then
|
if Parts[ppIndexWord].StartPos>=1 then
|
||||||
@ -6439,7 +6441,8 @@ var
|
|||||||
RaiseExceptionFmt(ctsIndexParameterExpectedButAtomFound,[GetAtom]);
|
RaiseExceptionFmt(ctsIndexParameterExpectedButAtomFound,[GetAtom]);
|
||||||
Parts[ppIndex].StartPos:=CurPos.StartPos;
|
Parts[ppIndex].StartPos:=CurPos.StartPos;
|
||||||
ReadConstant(true,false,[]);
|
ReadConstant(true,false,[]);
|
||||||
Parts[ppIndex].EndPos:=LastAtoms.GetValueAt(0).EndPos;
|
Last:=LastAtoms.GetValueAt(0);
|
||||||
|
Parts[ppIndex].EndPos:=Last.EndPos;
|
||||||
PartIsAtom[ppIndex]:=false;
|
PartIsAtom[ppIndex]:=false;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -6508,6 +6511,21 @@ var
|
|||||||
RaiseExceptionFmt(ctsStrExpectedButAtomFound,[';',GetAtom]);
|
RaiseExceptionFmt(ctsStrExpectedButAtomFound,[';',GetAtom]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure ResolveIndexType;
|
||||||
|
var
|
||||||
|
ExprType: TExpressionType;
|
||||||
|
Params: TFindDeclarationParams;
|
||||||
|
begin
|
||||||
|
Params:=TFindDeclarationParams.Create;
|
||||||
|
try
|
||||||
|
Params.Flags:=fdfDefaultForExpressions;
|
||||||
|
Params.ContextNode:=PropNode;
|
||||||
|
IndexType:=FindTermTypeAsString(Parts[ppIndex],Params,ExprType);
|
||||||
|
finally
|
||||||
|
Params.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure CompleteReadSpecifier;
|
procedure CompleteReadSpecifier;
|
||||||
var
|
var
|
||||||
@ -6923,6 +6941,8 @@ begin
|
|||||||
// complete property
|
// complete property
|
||||||
BeautifyCodeOpts:=ASourceChangeCache.BeautifyCodeOptions;
|
BeautifyCodeOpts:=ASourceChangeCache.BeautifyCodeOptions;
|
||||||
if CodeCompleteClassNode.Desc <> ctnDispinterface then begin
|
if CodeCompleteClassNode.Desc <> ctnDispinterface then begin
|
||||||
|
if Parts[ppIndex].StartPos>0 then
|
||||||
|
ResolveIndexType;
|
||||||
CompleteReadSpecifier;
|
CompleteReadSpecifier;
|
||||||
CompleteWriteSpecifier;
|
CompleteWriteSpecifier;
|
||||||
CompleteStoredSpecifier;
|
CompleteStoredSpecifier;
|
||||||
|
Loading…
Reference in New Issue
Block a user