mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 08:31:49 +01:00 
			
		
		
		
	* support static fields in nested types in records, by always including
support for nested types when generating an access to a static fied;
    we also always do that when generating the mangled name of a static
    field declaration in symcreat.make_field_static() (mantis #29030)
git-svn-id: trunk@32517 -
			
			
This commit is contained in:
		
							parent
							
								
									9dc5f1acb4
								
							
						
					
					
						commit
						9ea38f4577
					
				
							
								
								
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							| @ -14875,6 +14875,7 @@ tests/webtbs/tw2899.pp svneol=native#text/plain | ||||
| tests/webtbs/tw29010a.pp svneol=native#text/plain | ||||
| tests/webtbs/tw29010b.pp svneol=native#text/plain | ||||
| tests/webtbs/tw29010c.pp svneol=native#text/plain | ||||
| tests/webtbs/tw29030.pp svneol=native#text/plain | ||||
| tests/webtbs/tw2904.pp svneol=native#text/plain | ||||
| tests/webtbs/tw29040.pp svneol=native#text/plain | ||||
| tests/webtbs/tw29053.pp svneol=native#text/pascal | ||||
|  | ||||
| @ -104,7 +104,7 @@ interface | ||||
| 
 | ||||
|     { checks whether sym is a static field and if so, translates the access | ||||
|       to the appropriate node tree } | ||||
|     function handle_staticfield_access(sym: tsym; nested: boolean; var p1: tnode): boolean; | ||||
|     function handle_staticfield_access(sym: tsym; var p1: tnode): boolean; | ||||
| 
 | ||||
|     { returns true if n is an array element access of a bitpacked array with | ||||
|       elements of the which the vitsize mod 8 <> 0, or if is a field access | ||||
| @ -1181,7 +1181,7 @@ implementation | ||||
|       end; | ||||
| 
 | ||||
| 
 | ||||
|     function handle_staticfield_access(sym: tsym; nested: boolean; var p1: tnode): boolean; | ||||
|     function handle_staticfield_access(sym: tsym; var p1: tnode): boolean; | ||||
| 
 | ||||
|       function handle_generic_staticfield_access:boolean; | ||||
|         var | ||||
| @ -1228,10 +1228,7 @@ implementation | ||||
|             result:=true; | ||||
|             if handle_generic_staticfield_access then | ||||
|               exit; | ||||
|             if not nested then | ||||
|               static_name:=lower(sym.owner.name^)+'_'+sym.name | ||||
|             else | ||||
|              static_name:=lower(generate_nested_name(sym.owner,'_'))+'_'+sym.name; | ||||
|             static_name:=lower(generate_nested_name(sym.owner,'_'))+'_'+sym.name; | ||||
|             if sym.owner.defowner.typ=objectdef then | ||||
|               searchsym_in_class(tobjectdef(sym.owner.defowner),tobjectdef(sym.owner.defowner),static_name,sym,srsymtable,[ssf_search_helper]) | ||||
|             else | ||||
|  | ||||
| @ -1194,7 +1194,7 @@ implementation | ||||
|                      fieldvarsym : | ||||
|                        begin | ||||
|                          { generate access code } | ||||
|                          if not handle_staticfield_access(sym,false,p1) then | ||||
|                          if not handle_staticfield_access(sym,p1) then | ||||
|                            propaccesslist_to_node(p1,st,propaccesslist); | ||||
|                          include(p1.flags,nf_isproperty); | ||||
|                          consume(_ASSIGNMENT); | ||||
| @ -1224,7 +1224,7 @@ implementation | ||||
|                      fieldvarsym : | ||||
|                        begin | ||||
|                          { generate access code } | ||||
|                          if not handle_staticfield_access(sym,false,p1) then | ||||
|                          if not handle_staticfield_access(sym,p1) then | ||||
|                            propaccesslist_to_node(p1,st,propaccesslist); | ||||
|                          include(p1.flags,nf_isproperty); | ||||
|                          { catch expressions like "(propx):=1;" } | ||||
| @ -1331,7 +1331,7 @@ implementation | ||||
|                    end; | ||||
|                  fieldvarsym: | ||||
|                    begin | ||||
|                       if not handle_staticfield_access(sym,true,p1) then | ||||
|                       if not handle_staticfield_access(sym,p1) then | ||||
|                         begin | ||||
|                           if isclassref then | ||||
|                             if assigned(p1) and | ||||
|  | ||||
							
								
								
									
										19
									
								
								tests/webtbs/tw29030.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								tests/webtbs/tw29030.pp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,19 @@ | ||||
| program fpc_nestedtype_ice; | ||||
| 
 | ||||
| {$mode delphiunicode} | ||||
| 
 | ||||
| Type | ||||
|  TRec = Record | ||||
|   Type | ||||
|    NestedType = Record | ||||
|     Class Var | ||||
|      FVar : Integer; | ||||
|     Class Property Variable : Integer Read FVar Write FVar; | ||||
|    End; | ||||
|   End; | ||||
| 
 | ||||
| Begin | ||||
|  TRec.NestedType.Variable := 1; | ||||
|  if TRec.NestedType.Variable<>1 then | ||||
|    halt(1); | ||||
| End. | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Jonas Maebe
						Jonas Maebe