mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 12:23:24 +01:00 
			
		
		
		
	symtable.pas, is_visible_for_object:
* correctly handle the case that a generic method specialized in another unit needs to have access to private/protected members as well git-svn-id: trunk@32437 -
This commit is contained in:
		
							parent
							
								
									2eeb59591a
								
							
						
					
					
						commit
						86f1ca2037
					
				@ -2817,6 +2817,8 @@ implementation
 | 
			
		||||
      var
 | 
			
		||||
        symownerdef : tabstractrecorddef;
 | 
			
		||||
        nonlocalst : tsymtable;
 | 
			
		||||
        isspezproc : boolean;
 | 
			
		||||
        def : tstoreddef;
 | 
			
		||||
      begin
 | 
			
		||||
        result:=false;
 | 
			
		||||
 | 
			
		||||
@ -2830,6 +2832,13 @@ implementation
 | 
			
		||||
        if tstoreddef(symst.defowner).is_specialization then
 | 
			
		||||
          while nonlocalst.symtabletype in [localsymtable,parasymtable] do
 | 
			
		||||
            nonlocalst:=nonlocalst.defowner.owner;
 | 
			
		||||
        isspezproc:=false;
 | 
			
		||||
        if assigned(current_procinfo) then
 | 
			
		||||
          begin
 | 
			
		||||
            if current_procinfo.procdef.is_specialization and
 | 
			
		||||
                assigned(current_procinfo.procdef.struct) then
 | 
			
		||||
              isspezproc:=true;
 | 
			
		||||
          end;
 | 
			
		||||
        case symvisibility of
 | 
			
		||||
          vis_private :
 | 
			
		||||
            begin
 | 
			
		||||
@ -2851,6 +2860,12 @@ implementation
 | 
			
		||||
                       (
 | 
			
		||||
                         not assigned(current_structdef) and
 | 
			
		||||
                         (symownerdef.owner.iscurrentunit)
 | 
			
		||||
                       ) or
 | 
			
		||||
                       { access from a generic method that belongs to the class
 | 
			
		||||
                         but that is specialized elsewere }
 | 
			
		||||
                       (
 | 
			
		||||
                         isspezproc and
 | 
			
		||||
                         (current_procinfo.procdef.struct=current_structdef)
 | 
			
		||||
                       )
 | 
			
		||||
                      );
 | 
			
		||||
            end;
 | 
			
		||||
@ -2919,6 +2934,12 @@ implementation
 | 
			
		||||
                          is_objectpascal_helper(contextobjdef) and
 | 
			
		||||
                          def_is_related(tobjectdef(contextobjdef).extendeddef,symownerdef)
 | 
			
		||||
                        )
 | 
			
		||||
                       ) or
 | 
			
		||||
                       { access from a generic method that belongs to the class
 | 
			
		||||
                         but that is specialized elsewere }
 | 
			
		||||
                       (
 | 
			
		||||
                         isspezproc and
 | 
			
		||||
                         (current_procinfo.procdef.struct=current_structdef)
 | 
			
		||||
                       )
 | 
			
		||||
                      );
 | 
			
		||||
            end;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user