@@ -20,21 +20,31 @@ private string getLocationFilePath(@location_default loc) {
2020 */
2121overlay [ local]
2222private string getSingleLocationFilePath ( @element e ) {
23- // @var_decl has a direct location in the var_decls relation
24- exists ( @location_default loc | var_decls ( e , _, _, _, loc ) | result = getLocationFilePath ( loc ) )
25- //TODO: add other kinds of elements with single locations
23+ exists ( @location_default loc |
24+ // @var_decl has a direct location in the var_decls relation
25+ var_decls ( e , _, _, _, loc )
26+ or
27+ // @fun_decl has a direct location in the fun_decls relation
28+ fun_decls ( e , _, _, _, loc )
29+ |
30+ result = getLocationFilePath ( loc )
31+ )
2632}
2733
2834/**
2935 * Gets the file path for an element with potentially multiple locations.
3036 */
3137overlay [ local]
3238private string getMultiLocationFilePath ( @element e ) {
33- // @variable gets its location(s) from its @var_decl(s)
34- exists ( @var_decl vd , @location_default loc | var_decls ( vd , e , _, _, loc ) |
39+ exists ( @location_default loc |
40+ // @variable gets its location(s) from its @var_decl(s)
41+ exists ( @var_decl vd | var_decls ( vd , e , _, _, loc ) )
42+ or
43+ // @function gets its location(s) from its @fun_decl(s)
44+ exists ( @fun_decl fd | fun_decls ( fd , e , _, _, loc ) )
45+ |
3546 result = getLocationFilePath ( loc )
3647 )
37- //TODO: add other kinds of elements with multiple locations
3848}
3949
4050/**
0 commit comments