Patchwork [Ada] References to the formals of child subprograms without specs

login
register
mail settings
Submitter Arnaud Charlet
Date Oct. 2, 2012, 8:40 a.m.
Message ID <20121002084016.GA15277@adacore.com>
Download mbox | patch
Permalink /patch/188427/
State New
Headers show

Comments

Arnaud Charlet - Oct. 2, 2012, 8:40 a.m.
If a child subprogram has no previous spec, treat a reference to its formals
(such as a parameter association) as coming from source, in order to generate
the proper references and enable gps navigation between reference and
declaration.

Tested on x86_64-pc-linux-gnu, committed on trunk

2012-10-02  Ed Schonberg  <schonberg@adacore.com>

	* lib-xref.adb (Generate_Reference): If a child subprogram
	has no previous spec, treat a reference to its formals (such
	as a parameter association) as coming from source in order to
	generate the proper references and enable gps navigation between
	reference and declaration.

Patch

Index: lib-xref.adb
===================================================================
--- lib-xref.adb	(revision 191888)
+++ lib-xref.adb	(working copy)
@@ -945,6 +945,13 @@ 
          then
             Ent := E;
 
+         --  Ditto for the formals of such a subprogram
+
+         elsif Is_Overloadable (Scope (E))
+           and then Is_Child_Unit (Scope (E))
+         then
+            Ent := E;
+
          --  Record components of discriminated subtypes or derived types must
          --  be treated as references to the original component.