* Fix bug ID #31819, array of procedure using inline def

git-svn-id: trunk@36228 -
This commit is contained in:
michael 2017-05-16 12:00:08 +00:00
parent f7c2ab2e7c
commit 9517fbe7f6
2 changed files with 32 additions and 0 deletions

View File

@ -1659,6 +1659,10 @@ begin
else
ParseExc(nParserArrayTypeSyntaxError,SParserArrayTypeSyntaxError);
end;
// TPasProcedureType parsing has eaten the semicolon;
// We know it was a local definition if the array def (result) is the parent
if (Result.ElType is TPasProcedureType) and (Result.ElType.Parent=Result) then
UnGetToken;
ok:=true;
finally
if not ok then

View File

@ -113,8 +113,12 @@ type
procedure TestStaticArrayPlatform;
Procedure TestStaticArrayPacked;
Procedure TestStaticArrayTypedIndex;
Procedure TestStaticArrayOfMethod;
procedure TestStaticArrayOfProcedure;
Procedure TestDynamicArray;
Procedure TestDynamicArrayComment;
procedure TestDynamicArrayOfMethod;
procedure TestDynamicArrayOfProcedure;
Procedure TestGenericArray;
Procedure TestSimpleEnumerated;
Procedure TestSimpleEnumeratedComment;
@ -2916,6 +2920,30 @@ begin
AssertEquals('Array type','Boolean',TPasArrayType(TheType).IndexRange);
end;
procedure TTestTypeParser.TestStaticArrayOfMethod;
begin
DoParseArray('array[0..127] of procedure of object','',TPasProcedureType);
AssertEquals('Array element type',TPasProcedureType,TPasArrayType(TheType).ElType.ClassType);
end;
procedure TTestTypeParser.TestStaticArrayOfProcedure;
begin
DoParseArray('array[0..127] of procedure','',TPasProcedureType);
AssertEquals('Array element type',TPasProcedureType,TPasArrayType(TheType).ElType.ClassType);
end;
procedure TTestTypeParser.TestDynamicArrayOfMethod;
begin
DoParseArray('array of procedure of object','',TPasProcedureType);
AssertEquals('Array element type',TPasProcedureType,TPasArrayType(TheType).ElType.ClassType);
end;
procedure TTestTypeParser.TestDynamicArrayOfProcedure;
begin
DoParseArray('array of procedure ','',TPasProcedureType);
AssertEquals('Array element type',TPasProcedureType,TPasArrayType(TheType).ElType.ClassType);
end;
procedure TTestTypeParser.TestDynamicArray;
begin
DoParseArray('array of integer','',Nil);