@@ -121,13 +121,17 @@ impl<'a> AnalyzeContext<'a> {
121121 }
122122
123123 let kind = {
124- if signature. is_some ( ) {
125- NamedEntityKind :: Overloaded
126- } else if subtype_indication. is_some ( ) {
124+ if subtype_indication. is_some ( ) {
127125 NamedEntityKind :: OtherAlias
128126 } else {
129- let named_entity =
130- resolved_name. and_then ( |resolved| resolved. into_non_overloaded ( ) ) ;
127+ let named_entity = if signature. is_some ( ) {
128+ // @TODO use signature to select named entity
129+ resolved_name
130+ . and_then ( |resolved| resolved. into_known ( ) )
131+ . map ( |entities| entities. first ( ) . clone ( ) )
132+ } else {
133+ resolved_name. and_then ( |resolved| resolved. into_non_overloaded ( ) )
134+ } ;
131135
132136 if let Some ( named_entity) = named_entity {
133137 region. add_implicit_declaration_aliases (
@@ -195,7 +199,10 @@ impl<'a> AnalyzeContext<'a> {
195199 Declaration :: SubprogramBody ( ref mut body) => {
196200 region. add (
197201 body. specification . designator ( ) ,
198- NamedEntityKind :: Overloaded ,
202+ match body. specification {
203+ SubprogramDeclaration :: Procedure ( ..) => NamedEntityKind :: Procedure ,
204+ SubprogramDeclaration :: Function ( ..) => NamedEntityKind :: Function ,
205+ } ,
199206 diagnostics,
200207 ) ;
201208 let mut subpgm_region = region. nested ( ) ;
@@ -220,7 +227,10 @@ impl<'a> AnalyzeContext<'a> {
220227 Declaration :: SubprogramDeclaration ( ref mut subdecl) => {
221228 region. add (
222229 subdecl. designator ( ) ,
223- NamedEntityKind :: Overloaded ,
230+ match subdecl {
231+ SubprogramDeclaration :: Procedure ( ..) => NamedEntityKind :: Procedure ,
232+ SubprogramDeclaration :: Function ( ..) => NamedEntityKind :: Function ,
233+ } ,
224234 diagnostics,
225235 ) ;
226236
@@ -266,7 +276,7 @@ impl<'a> AnalyzeContext<'a> {
266276 for literal in enumeration. iter ( ) {
267277 let literal_ent = NamedEntity :: new (
268278 literal. item . clone ( ) . into_designator ( ) ,
269- NamedEntityKind :: Overloaded ,
279+ NamedEntityKind :: EnumLiteral ,
270280 Some ( & literal. pos ) ,
271281 ) ;
272282 let literal_ent = Arc :: new ( literal_ent) ;
@@ -341,7 +351,14 @@ impl<'a> AnalyzeContext<'a> {
341351 ProtectedTypeDeclarativeItem :: Subprogram ( ref mut subprogram) => {
342352 region. add (
343353 subprogram. designator ( ) ,
344- NamedEntityKind :: Overloaded ,
354+ match subprogram {
355+ SubprogramDeclaration :: Procedure ( ..) => {
356+ NamedEntityKind :: Procedure
357+ }
358+ SubprogramDeclaration :: Function ( ..) => {
359+ NamedEntityKind :: Function
360+ }
361+ } ,
345362 diagnostics,
346363 ) ;
347364 let mut subpgm_region = region. nested ( ) ;
@@ -467,7 +484,7 @@ impl<'a> AnalyzeContext<'a> {
467484 for name in names. iter ( ) {
468485 let ent = NamedEntity :: new (
469486 Designator :: Identifier ( self . symbol_utf8 ( name) ) ,
470- NamedEntityKind :: Overloaded ,
487+ NamedEntityKind :: Procedure ,
471488 None ,
472489 ) ;
473490 implicit. push ( Arc :: new ( ent) ) ;
@@ -565,7 +582,10 @@ impl<'a> AnalyzeContext<'a> {
565582 subpgm_region. close ( diagnostics) ;
566583 region. add (
567584 subpgm. designator ( ) ,
568- NamedEntityKind :: Overloaded ,
585+ match subpgm {
586+ SubprogramDeclaration :: Procedure ( ..) => NamedEntityKind :: Procedure ,
587+ SubprogramDeclaration :: Function ( ..) => NamedEntityKind :: Function ,
588+ } ,
569589 diagnostics,
570590 ) ;
571591 }
0 commit comments