mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 19:02:05 +02:00
* "Class of" allowed for fields
This commit is contained in:
parent
f4da533440
commit
4820ec0746
@ -1901,7 +1901,7 @@ Type
|
||||
|
||||
Const
|
||||
// These types are allowed only when full type declarations
|
||||
FullTypeTokens = [tkGeneric,{tkSpecialize,}tkClass,tkObjCClass,tkInterface,tkObjcProtocol,tkDispInterface,tkType];
|
||||
FullTypeTokens = [tkGeneric,{tkSpecialize,tkClass,}tkObjCClass,tkInterface,tkObjcProtocol,tkDispInterface,tkType];
|
||||
// Parsing of these types already takes care of hints
|
||||
NoHintTokens = [tkProcedure,tkFunction];
|
||||
InterfaceKindTypes : Array[Boolean] of TPasObjKind = (okInterface,okObjcProtocol);
|
||||
@ -1951,6 +1951,10 @@ begin
|
||||
begin
|
||||
lClassType:=lctClass;
|
||||
NextToken;
|
||||
if not (Full or (CurToken=tkOf)) then
|
||||
ParseExc(nParserTypeNotAllowedHere,SParserTypeNotAllowedHere,[CurtokenText]);
|
||||
// Parser.CurrentModeswitches:=Parser.CurrentModeswitches+[msClass];
|
||||
|
||||
if CurTokenIsIdentifier('Helper') then
|
||||
begin
|
||||
// class helper: atype end;
|
||||
|
@ -77,6 +77,7 @@ type
|
||||
procedure TestOneSpecializedClassInterface;
|
||||
Procedure TestOneField;
|
||||
Procedure TestOneFieldComment;
|
||||
Procedure TestOneClassOfField;
|
||||
procedure TestOneFieldStatic;
|
||||
Procedure TestOneHelperField;
|
||||
Procedure TestOneVarField;
|
||||
@ -675,6 +676,15 @@ begin
|
||||
AssertVisibility;
|
||||
end;
|
||||
|
||||
procedure TTestClassType.TestOneClassOfField;
|
||||
begin
|
||||
AddMember('a : class of MyClass');
|
||||
ParseClass;
|
||||
AssertNotNull('Have 1 field',Field1);
|
||||
AssertMemberName('a');
|
||||
AssertVisibility;
|
||||
end;
|
||||
|
||||
procedure TTestClassType.TestOneVarField;
|
||||
begin
|
||||
StartVisibility(visPublished);
|
||||
|
Loading…
Reference in New Issue
Block a user