Prepend_To (Decls, Counter_Typ_Decl);
-- The counter and its associated type must be manually analyzed
- -- since N has already been analyzed. Use the scope of the spec
- -- when inserting in a package.
+ -- since N has already been analyzed.
- if For_Package then
- Push_Scope (Spec_Id);
- Analyze (Counter_Typ_Decl);
- Analyze (Counter_Decl);
- Pop_Scope;
-
- else
- Analyze (Counter_Typ_Decl);
- Analyze (Counter_Decl);
- end if;
+ Analyze (Counter_Typ_Decl);
+ Analyze (Counter_Decl);
Jump_Alts := New_List;
end if;
Append_To (Decls, Fin_Body);
end if;
- -- Push the name of the package
-
- Push_Scope (Spec_Id);
Analyze (Fin_Spec);
Analyze (Fin_Body);
- Pop_Scope;
-- Non-package case
-- Step 2: Object [pre]processing
if For_Package then
+ -- For package specs and bodies, we are invoked from the Standard
+ -- scope, so we need to push the specs onto the scope stack first.
+
+ Push_Scope (Spec_Id);
-- Preprocess the visible declarations now in order to obtain the
-- correct number of controlled object by the time the private
if Acts_As_Clean or Has_Ctrl_Objs or Has_Tagged_Types then
Create_Finalizer;
end if;
+
+ -- Pop the scope that was pushed above for package specs and bodies
+
+ if For_Package then
+ Pop_Scope;
+ end if;
end Build_Finalizer;
--------------------------