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

Submitted by Arnaud Charlet on Oct. 2, 2012, 8:40 a.m.

Details

Message ID 20121002084016.GA15277@adacore.com
State New
Headers show

Commit Message

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 hide | download patch | download mbox

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.