mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-02 18:20:30 +02:00
codetools: support dispinterface property declaration
git-svn-id: trunk@23504 -
This commit is contained in:
parent
71c345ff51
commit
23177da4f2
@ -5077,6 +5077,7 @@ function TCodeCompletionCodeTool.CompleteProperty(
|
||||
property X: integer index 1 read GetCoords write SetCoords stored IsStored;
|
||||
property C: char read GetC stored False default 'A';
|
||||
property Col8: ICol8 read FCol8 write FCol8 implements ICol8, IColor;
|
||||
property Visible: WordBool readonly dispid 401;
|
||||
|
||||
property specifiers without parameters:
|
||||
;nodefault, ;default
|
||||
@ -5103,7 +5104,9 @@ type
|
||||
ppDefaultWord,// 'default' (the default value keyword,
|
||||
// not the default property)
|
||||
ppDefault, // default constant
|
||||
ppNoDefaultWord// 'nodefault'
|
||||
ppNoDefaultWord,// 'nodefault'
|
||||
ppDispidWord, // 'dispid'
|
||||
ppDispid // dispid constant
|
||||
);
|
||||
|
||||
var
|
||||
@ -5232,6 +5235,23 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
||||
PartIsAtom[ppIndex]:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ReadDispidSpecifier;
|
||||
begin
|
||||
if UpAtomIs('DISPID') then begin
|
||||
if Parts[ppDispidWord].StartPos>=1 then
|
||||
RaiseException(ctsDispidSpecifierRedefined);
|
||||
Parts[ppDispidWord]:=CurPos;
|
||||
ReadNextAtom;
|
||||
if WordIsPropertySpecifier.DoItCaseInsensitive(Src,CurPos.StartPos,
|
||||
CurPos.EndPos-CurPos.StartPos) then
|
||||
RaiseExceptionFmt(ctsDispidParameterExpectedButAtomFound,[GetAtom]);
|
||||
Parts[ppDispid].StartPos:=CurPos.StartPos;
|
||||
ReadConstant(true,false,[]);
|
||||
Parts[ppDispid].EndPos:=LastAtoms.GetValueAt(0).EndPos;
|
||||
PartIsAtom[ppDispid]:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ReadReadSpecifier;
|
||||
begin
|
||||
@ -5242,7 +5262,7 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
||||
begin
|
||||
if UpAtomIs('WRITE') then ReadSimpleSpec(ppWriteWord,ppWrite);
|
||||
end;
|
||||
|
||||
|
||||
procedure ReadOptionalSpecifiers;
|
||||
begin
|
||||
while (CurPos.StartPos<PropNode.EndPos) do begin
|
||||
@ -5276,7 +5296,7 @@ var AccessParam, AccessParamPrefix, CleanAccessFunc, AccessFunc,
|
||||
RaiseExceptionFmt(ctsIndexParameterExpectedButAtomFound,[GetAtom]);
|
||||
ReadNextAtom;
|
||||
end;
|
||||
end else
|
||||
end else
|
||||
RaiseExceptionFmt(ctsStrExpectedButAtomFound,[';',GetAtom]);
|
||||
end;
|
||||
end;
|
||||
@ -5640,10 +5660,16 @@ begin
|
||||
|
||||
ReadPropertyType;
|
||||
// parse specifiers
|
||||
ReadIndexSpecifier;
|
||||
ReadReadSpecifier;
|
||||
ReadWriteSpecifier;
|
||||
ReadOptionalSpecifiers;
|
||||
if CodeCompleteClassNode.Desc <> ctnDispinterface then begin
|
||||
ReadIndexSpecifier;
|
||||
ReadReadSpecifier;
|
||||
ReadWriteSpecifier;
|
||||
ReadOptionalSpecifiers;
|
||||
end else begin
|
||||
if UpAtomIs('READONLY') or UpAtomIs('WRITEONLY') then
|
||||
ReadNextAtom;
|
||||
ReadDispidSpecifier;
|
||||
end;
|
||||
PropType:=copy(Src,Parts[ppType].StartPos,
|
||||
Parts[ppType].EndPos-Parts[ppType].StartPos);
|
||||
if Parts[ppUnitType].StartPos>0 then
|
||||
@ -5652,9 +5678,11 @@ begin
|
||||
|
||||
// complete property
|
||||
BeautifyCodeOpts:=ASourceChangeCache.BeautifyCodeOptions;
|
||||
CompleteReadSpecifier;
|
||||
CompleteWriteSpecifier;
|
||||
CompleteStoredSpecifier;
|
||||
if CodeCompleteClassNode.Desc <> ctnDispinterface then begin
|
||||
CompleteReadSpecifier;
|
||||
CompleteWriteSpecifier;
|
||||
CompleteStoredSpecifier;
|
||||
end;
|
||||
CompleteSemicolon;
|
||||
|
||||
Result:=true;
|
||||
|
@ -151,6 +151,8 @@ ResourceString
|
||||
ctsDefaultParameterExpectedButAtomFound = 'default parameter expected, but %s found';
|
||||
ctsNodefaultSpecifierDefinedTwice = 'nodefault specifier defined twice';
|
||||
ctsImplementationNodeNotFound = 'implementation node not found';
|
||||
ctsDispidSpecifierRedefined = 'dispid specifier redefined';
|
||||
ctsDispidParameterExpectedButAtomFound = 'dispid parameter expected, but %s found';
|
||||
ctsClassNodeWithoutParentNode = 'class node without parent node';
|
||||
ctsTypeSectionOfClassNotFound = 'type section of class not found';
|
||||
ctsUnableToCompleteProperty = 'unable to complete property';
|
||||
|
@ -1113,6 +1113,7 @@ begin
|
||||
Add('IMPLEMENTS',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('DEFAULT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('NODEFAULT',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('DISPID',{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
end;
|
||||
|
||||
WordIsBlockKeyWord:=TKeyWordFunctionList.Create;
|
||||
|
@ -2020,10 +2020,13 @@ function TPascalParserTool.KeyWordFuncClassProperty: boolean;
|
||||
property X: integer index 1 read GetCoords write SetCoords stored IsStored; deprecated;
|
||||
property Col8: ICol8 read FCol8 write FCol8 implements ICol8, IColor;
|
||||
property Value: Integer read FCurrent; enumerator Current;
|
||||
property Visible: WordBool readonly dispid 401;
|
||||
|
||||
property specifiers before semicolon:
|
||||
index <id or number>, read <id>, write <id>, stored <id>, default <constant>,
|
||||
implements <id>[,<id>...], nodefault
|
||||
for dispinterfaces:
|
||||
dispid <number>, readonly, writeonly
|
||||
property modifiers after semicolon:
|
||||
default, deprecated, enumerator <id>
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user