Browse Source

fcl-passrc: clean up

mattias 1 year ago
parent
commit
79d139d494

+ 23 - 57
packages/fcl-passrc/src/pasresolver.pp

@@ -625,9 +625,6 @@ const
 
 
 const
 const
   ResolverResultVar = 'Result';
   ResolverResultVar = 'Result';
-  {$IFDEF CheckPasTreeRefCount}
-  RefIdInferenceParamsExpr = 'InferenceParamsExpr';
-  {$ENDIF}
 
 
 type
 type
   {$ifdef pas2js}
   {$ifdef pas2js}
@@ -1888,14 +1885,11 @@ type
     procedure SpecializeElImplEl(GenEl, SpecEl: TPasElement;
     procedure SpecializeElImplEl(GenEl, SpecEl: TPasElement;
       GenImplEl: TPasImplElement; var SpecImplEl: TPasImplElement);
       GenImplEl: TPasImplElement; var SpecImplEl: TPasImplElement);
     procedure SpecializeElImplAlias(GenEl, SpecEl: TPasImplBlock;
     procedure SpecializeElImplAlias(GenEl, SpecEl: TPasImplBlock;
-      GenImplAlias: TPasImplElement; var SpecImplAlias: TPasImplElement
-      {$IFDEF CheckPasTreeRefCount}; const RefId: string{$ENDIF});
+      GenImplAlias: TPasImplElement; var SpecImplAlias: TPasImplElement);
     procedure SpecializeElList(GenEl, SpecEl: TPasElement;
     procedure SpecializeElList(GenEl, SpecEl: TPasElement;
-      GenList, SpecList: TFPList; AllowReferences: boolean
-      {$IFDEF CheckPasTreeRefCount}; const RefId: string{$ENDIF});
+      GenList, SpecList: TFPList; AllowReferences: boolean);
     procedure SpecializeElArray(GenEl, SpecEl: TPasElement;
     procedure SpecializeElArray(GenEl, SpecEl: TPasElement;
-      GenList: TPasElementArray; var SpecList: TPasElementArray; AllowReferences: boolean
-      {$IFDEF CheckPasTreeRefCount}; const RefId: string{$ENDIF});
+      GenList: TPasElementArray; var SpecList: TPasElementArray; AllowReferences: boolean);
     procedure SpecializeProcedure(GenEl, SpecEl: TPasProcedure; SpecializedItem: TPRSpecializedItem); virtual;
     procedure SpecializeProcedure(GenEl, SpecEl: TPasProcedure; SpecializedItem: TPRSpecializedItem); virtual;
     procedure SpecializeOperator(GenEl, SpecEl: TPasOperator);
     procedure SpecializeOperator(GenEl, SpecEl: TPasOperator);
     procedure SpecializeProcedureType(GenEl, SpecEl: TPasProcedureType; SpecializedItem: TPRSpecializedItem);
     procedure SpecializeProcedureType(GenEl, SpecEl: TPasProcedureType; SpecializedItem: TPRSpecializedItem);
@@ -6074,8 +6068,7 @@ end;
 procedure TPasResolver.FinishTypeSectionEl(El: TPasType);
 procedure TPasResolver.FinishTypeSectionEl(El: TPasType);
 
 
   function ReplaceDestType(Decl: TPasType; var DestType: TPasType;
   function ReplaceDestType(Decl: TPasType; var DestType: TPasType;
-    const DestName: string; MustExist: boolean; ErrorEl: TPasElement
-    {$IFDEF CheckPasTreeRefCount}; const RefId: string{$ENDIF}): boolean;
+    const DestName: string; MustExist: boolean; ErrorEl: TPasElement): boolean;
   // returns true if replaces
   // returns true if replaces
   var
   var
     Abort: boolean;
     Abort: boolean;
@@ -6136,8 +6129,7 @@ begin
       {$IFDEF VerbosePasResolver}
       {$IFDEF VerbosePasResolver}
       writeln('TPasResolver.FinishTypeSection resolving "',ClassOfEl.Name,'" = class of unresolved "',TypeEl.Name,'"');
       writeln('TPasResolver.FinishTypeSection resolving "',ClassOfEl.Name,'" = class of unresolved "',TypeEl.Name,'"');
       {$ENDIF}
       {$ENDIF}
-      ReplaceDestType(ClassOfEl,ClassOfEl.DestType,TypeEl.Name,true,UnresolvedEl
-        {$IFDEF CheckPasTreeRefCount},'TPasAliasType.DestType'{$ENDIF});
+      ReplaceDestType(ClassOfEl,ClassOfEl.DestType,TypeEl.Name,true,UnresolvedEl);
       end
       end
     else if TypeEl.ClassType=TPasClassType then
     else if TypeEl.ClassType=TPasClassType then
       begin
       begin
@@ -6150,8 +6142,7 @@ begin
       {$IFDEF VerbosePasResolver}
       {$IFDEF VerbosePasResolver}
       writeln('TPasResolver.FinishTypeSection improving "',ClassOfEl.Name,'" = class of resolved "',TypeEl.Name,'"');
       writeln('TPasResolver.FinishTypeSection improving "',ClassOfEl.Name,'" = class of resolved "',TypeEl.Name,'"');
       {$ENDIF}
       {$ENDIF}
-      ReplaceDestType(ClassOfEl,ClassOfEl.DestType,ClassOfEl.DestType.Name,false,ClassOfEl
-        {$IFDEF CheckPasTreeRefCount},'TPasAliasType.DestType'{$ENDIF});
+      ReplaceDestType(ClassOfEl,ClassOfEl.DestType,ClassOfEl.DestType.Name,false,ClassOfEl);
       end;
       end;
     end
     end
   else if C=TPasPointerType then
   else if C=TPasPointerType then
@@ -6165,8 +6156,7 @@ begin
       {$IFDEF VerbosePasResolver}
       {$IFDEF VerbosePasResolver}
       writeln('TPasResolver.FinishTypeSection resolving "',PtrType.Name,'" = pointer of unresolved "',TypeEl.Name,'"');
       writeln('TPasResolver.FinishTypeSection resolving "',PtrType.Name,'" = pointer of unresolved "',TypeEl.Name,'"');
       {$ENDIF}
       {$ENDIF}
-      ReplaceDestType(PtrType,PtrType.DestType,TypeEl.Name,true,UnresolvedEl
-        {$IFDEF CheckPasTreeRefCount},'TPasPointerType.DestType'{$ENDIF});
+      ReplaceDestType(PtrType,PtrType.DestType,TypeEl.Name,true,UnresolvedEl);
       end
       end
     else
     else
       begin
       begin
@@ -6178,8 +6168,7 @@ begin
       {$IFDEF VerbosePasResolver}
       {$IFDEF VerbosePasResolver}
       writeln('TPasResolver.FinishTypeSection improving "',PtrType.Name,'" = pointer of resolved "',TypeEl.Name,'"');
       writeln('TPasResolver.FinishTypeSection improving "',PtrType.Name,'" = pointer of resolved "',TypeEl.Name,'"');
       {$ENDIF}
       {$ENDIF}
-      ReplaceDestType(PtrType,PtrType.DestType,TypeEl.Name,false,PtrType
-        {$IFDEF CheckPasTreeRefCount},'TPasPointerType.DestType'{$ENDIF});
+      ReplaceDestType(PtrType,PtrType.DestType,TypeEl.Name,false,PtrType);
       end;
       end;
     end;
     end;
 end;
 end;
@@ -7539,7 +7528,6 @@ begin
     begin
     begin
     // add 'Self'
     // add 'Self'
     ImplProcScope.SelfArg:=SelfArg;
     ImplProcScope.SelfArg:=SelfArg;
-    {$IFDEF CheckPasTreeRefCount}SelfArg.RefIds.Add('TPasProcedureScope.SelfArg');{$ENDIF}
     AddIdentifier(ImplProcScope,'Self',SelfArg,pikSimple);
     AddIdentifier(ImplProcScope,'Self',SelfArg,pikSimple);
     end;
     end;
 
 
@@ -8922,7 +8910,6 @@ begin
     // create canonical class-of for the "Self" in non static class functions
     // create canonical class-of for the "Self" in non static class functions
     CanonicalSelf:=TPasClassOfType(CreateOwnedElement(TPasClassOfType,'Self',aClass));
     CanonicalSelf:=TPasClassOfType(CreateOwnedElement(TPasClassOfType,'Self',aClass));
     ClassScope.CanonicalClassOf:=CanonicalSelf;
     ClassScope.CanonicalClassOf:=CanonicalSelf;
-    {$IFDEF CheckPasTreeRefCount}CanonicalSelf.RefIds.Add('TPasClassScope.CanonicalClassOf');{$ENDIF}
     CanonicalSelf.DestType:=aClass;
     CanonicalSelf.DestType:=aClass;
     CanonicalSelf.Visibility:=visStrictPrivate;
     CanonicalSelf.Visibility:=visStrictPrivate;
     CanonicalSelf.SourceFilename:=aClass.SourceFilename;
     CanonicalSelf.SourceFilename:=aClass.SourceFilename;
@@ -12007,8 +11994,7 @@ end;
 
 
 procedure TPasResolver.DeanonymizeType(El: TPasType);
 procedure TPasResolver.DeanonymizeType(El: TPasType);
 
 
-  procedure InsertInFront(NewParent: TPasElement; List: TFPList
-    {$IFDEF CheckPasTreeRefCount};const aId: string{$ENDIF});
+  procedure InsertInFront(NewParent: TPasElement; List: TFPList);
   var
   var
     i: Integer;
     i: Integer;
     p, Prev: TPasElement;
     p, Prev: TPasElement;
@@ -12073,13 +12059,13 @@ begin
       if p is TPasDeclarations then
       if p is TPasDeclarations then
         begin
         begin
         Decl:=TPasDeclarations(p);
         Decl:=TPasDeclarations(p);
-        InsertInFront(Decl,Decl.Declarations{$IFDEF CheckPasTreeRefCount},'TPasDeclarations.Declarations'{$ENDIF});
+        InsertInFront(Decl,Decl.Declarations);
         Decl.Types.Add(El);
         Decl.Types.Add(El);
         end
         end
       else if p is TPasMembersType then
       else if p is TPasMembersType then
         begin
         begin
         MembersType:=TPasMembersType(p);
         MembersType:=TPasMembersType(p);
-        InsertInFront(MembersType,MembersType.Members{$IFDEF CheckPasTreeRefCount},'TPasMembersType.Members'{$ENDIF});
+        InsertInFront(MembersType,MembersType.Members);
         end;
         end;
       break;
       break;
       end
       end
@@ -12489,7 +12475,6 @@ begin
   else
   else
     begin
     begin
     CanonicalSet:=TPasSetType(CreateOwnedElement(TPasSetType,'',El));
     CanonicalSet:=TPasSetType(CreateOwnedElement(TPasSetType,'',El));
-    {$IFDEF CheckPasTreeRefCount}CanonicalSet.RefIds.Add('TPasEnumTypeScope.CanonicalSet'){$ENDIF};
     CanonicalSet.EnumType:=El;
     CanonicalSet.EnumType:=El;
     end;
     end;
   EnumScope.CanonicalSet:=CanonicalSet;
   EnumScope.CanonicalSet:=CanonicalSet;
@@ -17022,12 +17007,10 @@ begin
   if NewParent is TPasDeclarations then
   if NewParent is TPasDeclarations then
     begin
     begin
     InsertBehind(TPasDeclarations(NewParent).Declarations);
     InsertBehind(TPasDeclarations(NewParent).Declarations);
-    {$IFDEF CheckPasTreeRefCount}NewEl.RefIds.Add('TPasDeclarations.Children');{$ENDIF}
     end
     end
   else if NewParent is TPasMembersType then
   else if NewParent is TPasMembersType then
     begin
     begin
     InsertBehind(TPasMembersType(NewParent).Members);
     InsertBehind(TPasMembersType(NewParent).Members);
-    {$IFDEF CheckPasTreeRefCount}NewEl.RefIds.Add('TPasMembersType.Members');{$ENDIF}
     end;
     end;
 
 
   if GenScope.GenericStep>=psgsInterfaceParsed then
   if GenScope.GenericStep>=psgsInterfaceParsed then
@@ -17845,8 +17828,7 @@ begin
   SpecEl.DispIDReadOnly:=GenEl.DispIDReadOnly;
   SpecEl.DispIDReadOnly:=GenEl.DispIDReadOnly;
   SpecEl.IsDefault:=GenEl.IsDefault;
   SpecEl.IsDefault:=GenEl.IsDefault;
   SpecEl.IsNodefault:=GenEl.IsNodefault;
   SpecEl.IsNodefault:=GenEl.IsNodefault;
-  SpecializeElList(GenEl,SpecEl,GenEl.Args,SpecEl.Args,false
-    {$IFDEF CheckPasTreeRefCount},'TPasProperty.Args'{$ENDIF});
+  SpecializeElList(GenEl,SpecEl,GenEl.Args,SpecEl.Args,false);
   FinishProperty(SpecEl);
   FinishProperty(SpecEl);
 end;
 end;
 
 
@@ -17918,8 +17900,7 @@ begin
 end;
 end;
 
 
 procedure TPasResolver.SpecializeElImplAlias(GenEl, SpecEl: TPasImplBlock;
 procedure TPasResolver.SpecializeElImplAlias(GenEl, SpecEl: TPasImplBlock;
-  GenImplAlias: TPasImplElement; var SpecImplAlias: TPasImplElement
-  {$IFDEF CheckPasTreeRefCount}; const RefId: string{$ENDIF});
+  GenImplAlias: TPasImplElement; var SpecImplAlias: TPasImplElement);
 var
 var
   i: Integer;
   i: Integer;
 begin
 begin
@@ -17933,8 +17914,7 @@ begin
 end;
 end;
 
 
 procedure TPasResolver.SpecializeElList(GenEl, SpecEl: TPasElement;
 procedure TPasResolver.SpecializeElList(GenEl, SpecEl: TPasElement;
-  GenList, SpecList: TFPList; AllowReferences: boolean
-  {$IFDEF CheckPasTreeRefCount}; const RefId: string{$ENDIF});
+  GenList, SpecList: TFPList; AllowReferences: boolean);
 var
 var
   i: Integer;
   i: Integer;
   GenListItem, SpecListItem, Ref: TPasElement;
   GenListItem, SpecListItem, Ref: TPasElement;
@@ -17965,7 +17945,7 @@ end;
 
 
 procedure TPasResolver.SpecializeElArray(GenEl, SpecEl: TPasElement;
 procedure TPasResolver.SpecializeElArray(GenEl, SpecEl: TPasElement;
   GenList: TPasElementArray; var SpecList: TPasElementArray;
   GenList: TPasElementArray; var SpecList: TPasElementArray;
-  AllowReferences: boolean{$IFDEF CheckPasTreeRefCount}; const RefId: string{$ENDIF});
+  AllowReferences: boolean);
 var
 var
   l, i: Integer;
   l, i: Integer;
   GenListItem, Ref, SpecListItem: TPasElement;
   GenListItem, Ref, SpecListItem: TPasElement;
@@ -18163,8 +18143,7 @@ begin
       end;
       end;
     end;
     end;
   // Args
   // Args
-  SpecializeElList(GenEl,SpecEl,GenEl.Args,SpecEl.Args,false
-    {$IFDEF CheckPasTreeRefCount},'TPasProcedureType.Args'{$ENDIF});
+  SpecializeElList(GenEl,SpecEl,GenEl.Args,SpecEl.Args,false);
   for i:=0 to SpecEl.Args.Count-1 do
   for i:=0 to SpecEl.Args.Count-1 do
     FinishArgument(TPasArgument(SpecEl.Args[i]));
     FinishArgument(TPasArgument(SpecEl.Args[i]));
   // varargs
   // varargs
@@ -18272,8 +18251,7 @@ begin
   SpecEl.DestType:=TPasGenericType(Ref);
   SpecEl.DestType:=TPasGenericType(Ref);
 
 
   SpecializeElExpr(GenEl,SpecEl,GenEl.Expr,SpecEl.Expr);
   SpecializeElExpr(GenEl,SpecEl,GenEl.Expr,SpecEl.Expr);
-  SpecializeElList(GenEl,SpecEl,GenEl.Params,SpecEl.Params,true
-    {$IFDEF CheckPasTreeRefCount},'TPasSpecializeType.Params'{$ENDIF});
+  SpecializeElList(GenEl,SpecEl,GenEl.Params,SpecEl.Params,true);
 
 
   if GenEl.SubType<>nil then
   if GenEl.SubType<>nil then
     begin
     begin
@@ -18402,15 +18380,13 @@ begin
   SpecializeElExpr(GenEl,SpecEl,GenEl.CaseExpr,SpecEl.CaseExpr);
   SpecializeElExpr(GenEl,SpecEl,GenEl.CaseExpr,SpecEl.CaseExpr);
   SpecializeImplBlock(GenEl,SpecEl); // Elements
   SpecializeImplBlock(GenEl,SpecEl); // Elements
   if GenEl.ElseBranch<>nil then
   if GenEl.ElseBranch<>nil then
-    SpecializeElImplAlias(GenEl,SpecEl,GenEl.ElseBranch,TPasImplElement(SpecEl.ElseBranch)
-      {$IFDEF CheckPasTreeRefCount},'TPasImplCaseOf.ElseBranch'{$ENDIF});
+    SpecializeElImplAlias(GenEl,SpecEl,GenEl.ElseBranch,TPasImplElement(SpecEl.ElseBranch));
 end;
 end;
 
 
 procedure TPasResolver.SpecializeImplCaseStatement(GenEl,
 procedure TPasResolver.SpecializeImplCaseStatement(GenEl,
   SpecEl: TPasImplCaseStatement);
   SpecEl: TPasImplCaseStatement);
 begin
 begin
-  SpecializeElList(GenEl,SpecEl,GenEl.Expressions,SpecEl.Expressions,false
-    {$IFDEF CheckPasTreeRefCount},'TPasImplCaseStatement.CaseExpr'{$ENDIF});
+  SpecializeElList(GenEl,SpecEl,GenEl.Expressions,SpecEl.Expressions,false);
   SpecializeElImplEl(GenEl,SpecEl,GenEl.Body,SpecEl.Body);
   SpecializeElImplEl(GenEl,SpecEl,GenEl.Body,SpecEl.Body);
 end;
 end;
 
 
@@ -18594,7 +18570,7 @@ begin
   SpecializeExpr(GenEl,SpecEl);
   SpecializeExpr(GenEl,SpecEl);
   SpecializeElExpr(GenEl,SpecEl,GenEl.NameExpr,SpecEl.NameExpr);
   SpecializeElExpr(GenEl,SpecEl,GenEl.NameExpr,SpecEl.NameExpr);
   SpecializeElList(GenEl,SpecEl,GenEl.Params,SpecEl.Params,
   SpecializeElList(GenEl,SpecEl,GenEl.Params,SpecEl.Params,
-    true{$IFDEF CheckPasTreeRefCount},'TInlineSpecializeExpr.Params'{$ENDIF});
+    true);
 end;
 end;
 
 
 procedure TPasResolver.SpecializeProcedureExpr(GenEl, SpecEl: TProcedureExpr);
 procedure TPasResolver.SpecializeProcedureExpr(GenEl, SpecEl: TProcedureExpr);
@@ -18750,8 +18726,7 @@ begin
   SpecializeElType(GenEl,SpecEl,
   SpecializeElType(GenEl,SpecEl,
                    GenEl.AncestorType,SpecEl.AncestorType);
                    GenEl.AncestorType,SpecEl.AncestorType);
   SpecializeElList(GenEl,SpecEl,
   SpecializeElList(GenEl,SpecEl,
-                   GenEl.Interfaces,SpecEl.Interfaces,true
-                   {$IFDEF CheckPasTreeRefCount},'TPasClassType.Interfaces'{$ENDIF});
+                   GenEl.Interfaces,SpecEl.Interfaces,true);
   if HeaderScope<>nil then
   if HeaderScope<>nil then
     begin
     begin
     if TopScope<>HeaderScope then
     if TopScope<>HeaderScope then
@@ -18796,8 +18771,7 @@ end;
 
 
 procedure TPasResolver.SpecializeEnumType(GenEl, SpecEl: TPasEnumType);
 procedure TPasResolver.SpecializeEnumType(GenEl, SpecEl: TPasEnumType);
 begin
 begin
-  SpecializeElList(GenEl,SpecEl,GenEl.Values,SpecEl.Values,false
-    {$IFDEF CheckPasTreeRefCount},'TPasEnumType.Values'{$ENDIF});
+  SpecializeElList(GenEl,SpecEl,GenEl.Values,SpecEl.Values,false);
   FinishEnumType(SpecEl);
   FinishEnumType(SpecEl);
 end;
 end;
 
 
@@ -18810,8 +18784,7 @@ end;
 
 
 procedure TPasResolver.SpecializeVariant(GenEl, SpecEl: TPasVariant);
 procedure TPasResolver.SpecializeVariant(GenEl, SpecEl: TPasVariant);
 begin
 begin
-  SpecializeElList(GenEl,SpecEl,GenEl.Values,SpecEl.Values,false
-    {$IFDEF CheckPasTreeRefCount},'TPasVariant.Values'{$ENDIF});
+  SpecializeElList(GenEl,SpecEl,GenEl.Values,SpecEl.Values,false);
   RaiseNotYetImplemented(20190808214218,GenEl)
   RaiseNotYetImplemented(20190808214218,GenEl)
   //ToDo: Members: TPasRecordType;
   //ToDo: Members: TPasRecordType;
 end;
 end;
@@ -21140,7 +21113,6 @@ begin
 
 
   // create element
   // create element
   El:=CreateOwnedElement(AClass,AName,AParent);
   El:=CreateOwnedElement(AClass,AName,AParent);
-  {$IFDEF CheckPasTreeRefCount}El.RefIds.Add('CreateElement');{$ENDIF}
   FLastElement:=El;
   FLastElement:=El;
   El.Visibility:=AVisibility;
   El.Visibility:=AVisibility;
   El.SourceFilename:=ASrcPos.FileName;
   El.SourceFilename:=ASrcPos.FileName;
@@ -22080,7 +22052,6 @@ begin
 
 
     // set ancestor
     // set ancestor
     aClass.AncestorType := DestType;
     aClass.AncestorType := DestType;
-    {$IFDEF CheckPasTreeRefCount}DestType.ChangeRefId('ResolveTypeReference','TPasClassType.AncestorType');{$ENDIF}
     FinishScope(stAncestors,aClass);
     FinishScope(stAncestors,aClass);
     end;
     end;
 end;
 end;
@@ -22479,7 +22450,6 @@ var
   El: TPasUnresolvedSymbolRef;
   El: TPasUnresolvedSymbolRef;
 begin
 begin
   El:=TPasUnresolvedSymbolRef(CreateOwnedElement(TPasUnresolvedSymbolRef,aName,nil));
   El:=TPasUnresolvedSymbolRef(CreateOwnedElement(TPasUnresolvedSymbolRef,aName,nil));
-  {$IFDEF CheckPasTreeRefCount}El.RefIds.Add('TPasResolver.AddBaseType');{$ENDIF}
   if not (Typ in [btNone,btCustom]) then
   if not (Typ in [btNone,btCustom]) then
     FBaseTypes[Typ]:=El;
     FBaseTypes[Typ]:=El;
   Result:=TResElDataBaseType.Create;
   Result:=TResElDataBaseType.Create;
@@ -22494,7 +22464,6 @@ var
   CustomData: TResElDataBaseType;
   CustomData: TResElDataBaseType;
 begin
 begin
   Result:=TPasUnresolvedSymbolRef(CreateOwnedElement(TPasUnresolvedSymbolRef,aName,nil));
   Result:=TPasUnresolvedSymbolRef(CreateOwnedElement(TPasUnresolvedSymbolRef,aName,nil));
-  {$IFDEF CheckPasTreeRefCount}Result.RefIds.Add('TPasResolver.AddCustomBaseType');{$ENDIF}
   CustomData:=aClass.Create;
   CustomData:=aClass.Create;
   CustomData.BaseType:=btCustom;
   CustomData.BaseType:=btCustom;
   AddResolveData(Result,CustomData,lkBuiltIn);
   AddResolveData(Result,CustomData,lkBuiltIn);
@@ -22524,7 +22493,6 @@ begin
   El:=TPasUnresolvedSymbolRef(CreateOwnedElement(TPasUnresolvedSymbolRef,aName,nil));
   El:=TPasUnresolvedSymbolRef(CreateOwnedElement(TPasUnresolvedSymbolRef,aName,nil));
   Result:=TResElDataBuiltInProc.Create;
   Result:=TResElDataBuiltInProc.Create;
   Result.Proc:=El;
   Result.Proc:=El;
-  {$IFDEF CheckPasTreeRefCount}El.RefIds.Add('TResElDataBuiltInProc.Proc');{$ENDIF}
   Result.Signature:=Signature;
   Result.Signature:=Signature;
   Result.BuiltIn:=BuiltIn;
   Result.BuiltIn:=BuiltIn;
   Result.GetCallCompatibility:=GetCallCompatibility;
   Result.GetCallCompatibility:=GetCallCompatibility;
@@ -29694,7 +29662,6 @@ begin
       // Note: this is true in classes, adv records and helpers
       // Note: this is true in classes, adv records and helpers
       SelfArg:=TPasArgument(CreateOwnedElement(TPasArgument,'Self',Proc));
       SelfArg:=TPasArgument(CreateOwnedElement(TPasArgument,'Self',Proc));
       ProcScope.SelfArg:=SelfArg;
       ProcScope.SelfArg:=SelfArg;
-      {$IFDEF CheckPasTreeRefCount}SelfArg.RefIds.Add('TPasProcedureScope.SelfArg');{$ENDIF}
       SelfArg.Access:=argConst;
       SelfArg.Access:=argConst;
       SelfArg.ArgType:=TPasClassScope(ClassOrRecScope).CanonicalClassOf;
       SelfArg.ArgType:=TPasClassScope(ClassOrRecScope).CanonicalClassOf;
       end
       end
@@ -29706,7 +29673,6 @@ begin
     // 'Self' in a method is the hidden instance argument
     // 'Self' in a method is the hidden instance argument
     SelfArg:=TPasArgument(CreateOwnedElement(TPasArgument,'Self',Proc));
     SelfArg:=TPasArgument(CreateOwnedElement(TPasArgument,'Self',Proc));
     ProcScope.SelfArg:=SelfArg;
     ProcScope.SelfArg:=SelfArg;
-    {$IFDEF CheckPasTreeRefCount}SelfArg.RefIds.Add('TPasProcedureScope.SelfArg');{$ENDIF}
     SelfType:=ClassRecType;
     SelfType:=ClassRecType;
     if (SelfType.ClassType=TPasClassType)
     if (SelfType.ClassType=TPasClassType)
         and (TPasClassType(SelfType).HelperForType<>nil) then
         and (TPasClassType(SelfType).HelperForType<>nil) then

+ 0 - 44
packages/fcl-passrc/src/pastree.pp

@@ -151,9 +151,6 @@ type
     FPasElementId: NativeInt;
     FPasElementId: NativeInt;
     class var FLastPasElementId: NativeInt;
     class var FLastPasElementId: NativeInt;
     {$endif}
     {$endif}
-    {$ifdef EnablePasTreeGlobalRefCount}
-    class var FGlobalRefCount: NativeInt;
-    {$endif}
   protected
   protected
     procedure ProcessHints(const ASemiColonPrefix: boolean; var AResult: TPasTreeString); virtual;
     procedure ProcessHints(const ASemiColonPrefix: boolean; var AResult: TPasTreeString); virtual;
     procedure SetParent(const AValue: TPasElement); virtual;
     procedure SetParent(const AValue: TPasElement); virtual;
@@ -162,13 +159,6 @@ type
     SourceLinenumber: Integer;
     SourceLinenumber: Integer;
     SourceEndLinenumber: Integer;
     SourceEndLinenumber: Integer;
     Visibility: TPasMemberVisibility;
     Visibility: TPasMemberVisibility;
-    {$IFDEF CheckPasTreeRefCount}
-  public
-    RefIds: TStringList;
-    NextRefEl, PrevRefEl: TPasElement;
-    class var FirstRefEl, LastRefEl: TPasElement;
-    procedure ChangeRefId(const OldId, NewId: TPasTreeString);
-    {$ENDIF}
     constructor Create(const AName: TPasTreeString; AParent: TPasElement); virtual;
     constructor Create(const AName: TPasTreeString; AParent: TPasElement); virtual;
     destructor Destroy; override;
     destructor Destroy; override;
     Class Function IsKeyWord(Const S : TPasTreeString) : Boolean;
     Class Function IsKeyWord(Const S : TPasTreeString) : Boolean;
@@ -201,9 +191,6 @@ type
     {$ifdef pas2js}
     {$ifdef pas2js}
     property PasElementId: NativeInt read FPasElementId; // global unique id
     property PasElementId: NativeInt read FPasElementId; // global unique id
     {$endif}
     {$endif}
-    {$ifdef EnablePasTreeGlobalRefCount}
-    class property GlobalRefCount: NativeInt read FGlobalRefCount write FGlobalRefCount;
-    {$endif}
   end;
   end;
 
 
   TPasExprKind = (pekIdent, pekNumber, pekString, pekSet, pekNil, pekBoolConst,
   TPasExprKind = (pekIdent, pekNumber, pekString, pekSet, pekNil, pekBoolConst,
@@ -2925,25 +2912,6 @@ begin
   FParent:=AValue;
   FParent:=AValue;
 end;
 end;
 
 
-{$IFDEF CheckPasTreeRefCount}
-procedure TPasElement.ChangeRefId(const OldId, NewId: TPasTreeString);
-var
-  i: Integer;
-begin
-  i:=RefIds.IndexOf(OldId);
-  if i<0 then
-    begin
-    {AllowWriteln}
-    writeln('ERROR: TPasElement.ChangeRefId ',Name,':',ClassName,' Old="'+OldId+'" New="'+NewId+'" Old not found');
-    writeln(RefIds.Text);
-    {AllowWriteln-}
-    raise EPasTree.Create('');
-    end;
-  RefIds.Delete(i);
-  RefIds.Add(NewId);
-end;
-{$ENDIF}
-
 constructor TPasElement.Create(const AName: TPasTreeString; AParent: TPasElement);
 constructor TPasElement.Create(const AName: TPasTreeString; AParent: TPasElement);
 begin
 begin
   inherited Create;
   inherited Create;
@@ -2954,18 +2922,6 @@ begin
   FPasElementId:=FLastPasElementId;
   FPasElementId:=FLastPasElementId;
   //writeln('TPasElement.Create ',Name,':',ClassName,' ID=[',FPasElementId,']');
   //writeln('TPasElement.Create ',Name,':',ClassName,' ID=[',FPasElementId,']');
   {$endif}
   {$endif}
-  {$ifdef EnablePasTreeGlobalRefCount}
-  Inc(FGlobalRefCount);
-  {$endif}
-  {$IFDEF CheckPasTreeRefCount}
-  RefIds:=TStringList.Create;
-  PrevRefEl:=LastRefEl;
-  if LastRefEl<>nil then
-    LastRefEl.NextRefEl:=Self
-  else
-    FirstRefEl:=Self;
-  LastRefEl:=Self;
-  {$ENDIF}
 end;
 end;
 
 
 destructor TPasElement.Destroy;
 destructor TPasElement.Destroy;

+ 1 - 10
packages/fcl-passrc/src/pparser.pp

@@ -3897,7 +3897,6 @@ begin
           if Assigned(TypeEl) then        // !!!
           if Assigned(TypeEl) then        // !!!
             begin
             begin
             Declarations.Declarations.Add(TypeEl);
             Declarations.Declarations.Add(TypeEl);
-            {$IFDEF CheckPasTreeRefCount}if TypeEl.RefIds.IndexOf('CreateElement')>=0 then TypeEl.ChangeRefId('CreateElement','TPasDeclarations.Children');{$ENDIF}
             if (TypeEl.ClassType = TPasClassType)
             if (TypeEl.ClassType = TPasClassType)
                 and (not (po_keepclassforward in Options)) then
                 and (not (po_keepclassforward in Options)) then
             begin
             begin
@@ -3933,7 +3932,6 @@ begin
             begin
             begin
               ExpEl := TPasExportSymbol(List[i]);
               ExpEl := TPasExportSymbol(List[i]);
               Declarations.Declarations.Add(ExpEl);
               Declarations.Declarations.Add(ExpEl);
-              {$IFDEF CheckPasTreeRefCount}ExpEl.ChangeRefId('CreateElement','TPasDeclarations.Children');{$ENDIF}
               Declarations.ExportSymbols.Add(ExpEl);
               Declarations.ExportSymbols.Add(ExpEl);
             end;
             end;
           finally
           finally
@@ -3971,7 +3969,6 @@ begin
           begin
           begin
           PropEl:=ParseProperty(Declarations,CurtokenString,visDefault,false);
           PropEl:=ParseProperty(Declarations,CurtokenString,visDefault,false);
           Declarations.Declarations.Add(PropEl);
           Declarations.Declarations.Add(PropEl);
-          {$IFDEF CheckPasTreeRefCount}PropEl.ChangeRefId('CreateElement','TPasDeclarations.Children');{$ENDIF}
           Declarations.Properties.Add(PropEl);
           Declarations.Properties.Add(PropEl);
           Engine.FinishScope(stDeclaration,PropEl);
           Engine.FinishScope(stDeclaration,PropEl);
           end;
           end;
@@ -4228,7 +4225,6 @@ begin
       OldForceCaret:=Scanner.SetForceCaret(True);
       OldForceCaret:=Scanner.SetForceCaret(True);
       try
       try
         Result.VarType := ParseType(Result,CurSourcePos);
         Result.VarType := ParseType(Result,CurSourcePos);
-        {$IFDEF CheckPasTreeRefCount}if Result.VarType.RefIds.IndexOf('CreateElement')>=0 then Result.VarType.ChangeRefId('CreateElement','TPasVariable.VarType'){$ENDIF};
       finally
       finally
         Scanner.SetForceCaret(OldForceCaret);
         Scanner.SetForceCaret(OldForceCaret);
       end;
       end;
@@ -4599,12 +4595,10 @@ function TPasParser.ParseGenericTypeDecl(Parent: TPasElement;
       if Parent is TPasDeclarations then
       if Parent is TPasDeclarations then
         begin
         begin
         TPasDeclarations(Parent).Declarations.Add(NewEl);
         TPasDeclarations(Parent).Declarations.Add(NewEl);
-        {$IFDEF CheckPasTreeRefCount}NewEl.ChangeRefId('CreateElement','TPasDeclarations.Children');{$ENDIF}
         end
         end
       else if Parent is TPasMembersType then
       else if Parent is TPasMembersType then
         begin
         begin
         TPasMembersType(Parent).Members.Add(NewEl);
         TPasMembersType(Parent).Members.Add(NewEl);
-        {$IFDEF CheckPasTreeRefCount}NewEl.ChangeRefId('CreateElement','TPasMembersType.Members');{$ENDIF}
         end;
         end;
       end;
       end;
     if GenericTemplateTypes.Count>0 then
     if GenericTemplateTypes.Count>0 then
@@ -4918,7 +4912,6 @@ begin
       OldForceCaret:=Scanner.SetForceCaret(True);
       OldForceCaret:=Scanner.SetForceCaret(True);
       try
       try
         VarType := ParseVarType(VarEl); // Note: this can insert elements into VarList!
         VarType := ParseVarType(VarEl); // Note: this can insert elements into VarList!
-        {$IFDEF CheckPasTreeRefCount}if VarType.RefIds.IndexOf('CreateElement')>=0 then VarType.ChangeRefId('CreateElement','TPasVariable.VarType'){$ENDIF};
       finally
       finally
         Scanner.SetForceCaret(OldForceCaret);
         Scanner.SetForceCaret(OldForceCaret);
       end;
       end;
@@ -6011,7 +6004,6 @@ begin
   if CurToken = tkColon then
   if CurToken = tkColon then
     begin
     begin
     Result.VarType := ParseType(Result,CurSourcePos);
     Result.VarType := ParseType(Result,CurSourcePos);
-    {$IFDEF CheckPasTreeRefCount}if Result.VarType.RefIds.IndexOf('CreateElement')>=0 then Result.VarType.ChangeRefId('CreateElement','TPasVariable.VarType'){$ENDIF};
     NextToken;
     NextToken;
     end
     end
   else if not IsClass then
   else if not IsClass then
@@ -6422,12 +6414,11 @@ begin
       tkVar:
       tkVar:
         begin
         begin
         if not (msInlineVars in CurrentModeswitches) then
         if not (msInlineVars in CurrentModeswitches) then
-           ParseExcSyntaxError;
+          ParseExcSyntaxError;
         CheckStatementCanStart;
         CheckStatementCanStart;
         NextToken;
         NextToken;
         Params.ParseVarStatement;
         Params.ParseVarStatement;
         Params.CloseStatement(true);
         Params.CloseStatement(true);
-
         end;
         end;
       tkAt,tkAtAt,
       tkAt,tkAtAt,
       tkIdentifier,tkspecialize,
       tkIdentifier,tkspecialize,