Skip to content
Snippets Groups Projects
  • Marc Poulhiès's avatar
    cb690aa1
    ada: Also reset scope for some nested declaration · cb690aa1
    Marc Poulhiès authored
    When changing the scope for entities found in the entry body that is
    mutated into a procedure, the compiler needs to look deeper than only
    the top level entities as expansion may produce object declarations
    which scopes are also the entry. For example, the tree after expansion
    may look like:
    
      procedure This_Is_An_Entry_Proc is
         ...
         O1 : Typ := do
           TMP1 : OTyp := ...;
           ...
         in TMP1;
    
    O1's scope needs to be reset to This_Is_An_Entry_Proc, but so does
    TMP1's scope.
    
    This change also fix a small oversight where
    N_Implicit_Label_Declaration scope must be reset and its content
    skipped.
    
    gcc/ada/
    
    	* exp_ch9.adb (Reset_Scopes_To): Adjust comment.
    	(Reset_Scopes_To.Reset_Scope): Adjust the scope reset for object
    	declaration. In particular, visit the children nodes if any. Also
    	extend the handling of other declarations to
    	N_Implicit_Label_Declaration.
    cb690aa1
    History
    ada: Also reset scope for some nested declaration
    Marc Poulhiès authored
    When changing the scope for entities found in the entry body that is
    mutated into a procedure, the compiler needs to look deeper than only
    the top level entities as expansion may produce object declarations
    which scopes are also the entry. For example, the tree after expansion
    may look like:
    
      procedure This_Is_An_Entry_Proc is
         ...
         O1 : Typ := do
           TMP1 : OTyp := ...;
           ...
         in TMP1;
    
    O1's scope needs to be reset to This_Is_An_Entry_Proc, but so does
    TMP1's scope.
    
    This change also fix a small oversight where
    N_Implicit_Label_Declaration scope must be reset and its content
    skipped.
    
    gcc/ada/
    
    	* exp_ch9.adb (Reset_Scopes_To): Adjust comment.
    	(Reset_Scopes_To.Reset_Scope): Adjust the scope reset for object
    	declaration. In particular, visit the children nodes if any. Also
    	extend the handling of other declarations to
    	N_Implicit_Label_Declaration.