--- Recording mergeinfo for merge of r31183 into '.':

U   .
--- Recording mergeinfo for merge of r31184 into '.':
 U   .
--- Recording mergeinfo for merge of r31205 into '.':
 U   .
--- Merging r31259 into '.':
U    packages/fcl-passrc/src/pparser.pp
U    packages/fcl-passrc/tests/tctypeparser.pas
--- Recording mergeinfo for merge of r31259 into '.':
 U   .

# revisions: 31183,31184,31205,21235,31259

git-svn-id: branches/fixes_3_0@31271 -
This commit is contained in:
marco 2015-08-04 08:59:22 +00:00
parent 9da62136a0
commit 0f77f50a7c
2 changed files with 26 additions and 0 deletions

View File

@ -3821,6 +3821,7 @@ begin
ParseExc(SErrRecordConstantsNotAllowed);
ExpectToken(tkIdentifier);
Cons:=ParseConstDecl(ARec);
Cons.Visibility:=v;
ARec.members.Add(Cons);
end;
tkClass:

View File

@ -158,6 +158,7 @@ type
TTestRecordTypeParser= Class(TBaseTestTypeParser)
private
function GetC(AIndex: Integer): TPasConst;
Function GetField(AIndex : Integer; R : TPasRecordType) : TPasVariable;
Function GetField(AIndex : Integer; R : TPasVariant) : TPasVariable;
function GetF(AIndex: Integer): TPasVariable;
@ -167,6 +168,7 @@ type
Protected
Procedure TestFields(Const Fields : Array of string; AHint : String; HaveVariant : Boolean = False);
procedure AssertVariantSelector(AName, AType: string);
procedure AssertConst1(Hints: TPasMemberHints);
procedure AssertField1(Hints: TPasMemberHints);
procedure AssertField2(Hints: TPasMemberHints);
procedure AssertMethod2(Hints: TPasMemberHints; isClass : Boolean = False);
@ -198,6 +200,7 @@ type
procedure DoTestVariantNestedVariantSecondDeprecated(const AHint: string);
procedure DoTestVariantNestedVariantBothDeprecated(const AHint: string);
Property TheRecord : TPasRecordType Read GetR;
Property Const1 : TPasConst Index 0 Read GetC;
Property Field1 : TPasVariable Index 0 Read GetF;
Property Field2 : TPasVariable Index 1 Read GetF;
Property Variant1 : TPasVariant Index 0 Read GetV;
@ -220,6 +223,7 @@ type
Procedure TestOnePlatformField;
Procedure TestOnePlatformFieldDeprecated;
Procedure TestOnePlatformFieldPlatform;
Procedure TestOneConstOneField;
Procedure TestTwoFields;
procedure TestTwoFieldProtected;
procedure TestTwoFieldStrictPrivate;
@ -1110,6 +1114,11 @@ end;
{ TTestRecordTypeParser }
function TTestRecordTypeParser.GetC(AIndex: Integer): TPasConst;
begin
Result:=TObject(GetR.Members[AIndex]) as TPasConst;
end;
function TTestRecordTypeParser.GetField(AIndex: Integer; R: TPasRecordType
): TPasVariable;
begin
@ -1201,6 +1210,13 @@ begin
AssertEquals('Have variant selector type name',AType,TheRecord.VariantType.Name);
end;
procedure TTestRecordTypeParser.AssertConst1(Hints: TPasMemberHints);
begin
AssertEquals('Member 1 type',TPasConst,TObject(TheRecord.Members[0]).ClassType);
AssertEquals('Const 1 name','x',Const1.Name);
AssertNotNull('Have 1 const expr',Const1.Expr);
end;
procedure TTestRecordTypeParser.DoTestEmpty(const AHint: String);
begin
@ -1707,6 +1723,15 @@ begin
AssertOneIntegerField([hplatform]);
end;
procedure TTestRecordTypeParser.TestOneConstOneField;
begin
Scanner.Options:=[po_Delphi];
TestFields(['public','Const x =123;','y : integer'],'',False);
AssertConst1([]);
AssertEquals('Correct visibility',visPublic,TPasConst(TheRecord.Members[0]).Visibility);
AssertField2([]);
end;
procedure TTestRecordTypeParser.TestTwoFields;
begin
TestFields(['x : integer;','y : integer'],'',False);