From 1299e585c951e9b700b35bfc9e29c3ad1f9b519e Mon Sep 17 00:00:00 2001 From: Mattias Gaertner Date: Sun, 18 Oct 2020 16:24:03 +0000 Subject: [PATCH] pastojs: filer: restore original order before checking specializations git-svn-id: trunk@47131 - --- packages/pastojs/tests/tcfiler.pas | 67 ++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 9 deletions(-) diff --git a/packages/pastojs/tests/tcfiler.pas b/packages/pastojs/tests/tcfiler.pas index 99dd31ad7f..a6500c9ae1 100644 --- a/packages/pastojs/tests/tcfiler.pas +++ b/packages/pastojs/tests/tcfiler.pas @@ -639,24 +639,75 @@ end; procedure TCustomTestPrecompile.CheckRestoredDeclarations(const Path: string; Orig, Rest: TPasDeclarations; Flags: TPCCheckFlags); + + function IsSpecialization(El: TPasElement): boolean; + begin + Result:=(El.CustomData is TPasGenericScope) + and (TPasGenericScope(El.CustomData).SpecializedFromItem<>nil); + end; + var - i: Integer; + OrigIndex, RestIndex: Integer; OrigDecl, RestDecl: TPasElement; SubPath: String; begin - for i:=0 to Orig.Declarations.Count-1 do + // check non specializations + RestIndex:=0; + for OrigIndex:=0 to Orig.Declarations.Count-1 do begin - OrigDecl:=TPasElement(Orig.Declarations[i]); - if i>=Rest.Declarations.Count then - AssertEquals(Path+'.Declarations.Count',Orig.Declarations.Count,Rest.Declarations.Count); - RestDecl:=TPasElement(Rest.Declarations[i]); - SubPath:=Path+'['+IntToStr(i)+']'; + OrigDecl:=TPasElement(Orig.Declarations[OrigIndex]); + if IsSpecialization(OrigDecl) then + continue; + SubPath:=Path+'['+IntToStr(OrigIndex)+']'; if OrigDecl.Name<>'' then SubPath:=SubPath+'"'+OrigDecl.Name+'"' else SubPath:=SubPath+'?noname?'; + // skip to next non specializations in restored declarations + while RestIndex'' then + SubPath:=SubPath+'"'+OrigDecl.Name+'"' + else + SubPath:=SubPath+'?noname?'; + // search specialization with same name + RestIndex:=0; + while RestIndex