@@ -27,26 +27,66 @@ class Callable extends Declaration, @dotnet_callable {
2727 /** Holds if this callable can return expression `e`. */
2828 predicate canReturn ( Expr e ) { none ( ) }
2929
30- final override string getLabel ( ) {
31- result = getReturnTypeLabel ( ) + " " + getDeclaringType ( ) .getLabel ( ) + "." + getUndecoratedName ( )
32- + getGenericsLabel ( this ) + getMethodParams ( )
30+ pragma [ noinline]
31+ private string getDeclaringTypeLabel ( ) { result = this .getDeclaringType ( ) .getLabel ( ) }
32+
33+ pragma [ noinline]
34+ private string getParameterTypeLabelNonGeneric ( int p ) {
35+ not this instanceof Generic and
36+ result = this .getParameter ( p ) .getType ( ) .getLabel ( )
3337 }
3438
35- private string getReturnTypeLabel ( ) {
36- if exists ( getReturnType ( ) ) then result = getReturnType ( ) .getLabel ( ) else result = "System.Void"
39+ language [ monotonicAggregates]
40+ pragma [ nomagic]
41+ private string getMethodParamListNonGeneric ( ) {
42+ result = concat ( int p |
43+ p in [ 0 .. this .getNumberOfParameters ( ) - 1 ]
44+ |
45+ this .getParameterTypeLabelNonGeneric ( p ) , "," order by p
46+ )
3747 }
3848
39- private string getMethodParams ( ) { result = "(" + getMethodParamList ( ) + ")" }
49+ pragma [ noinline]
50+ private string getParameterTypeLabelGeneric ( int p ) {
51+ this instanceof Generic and
52+ result = this .getParameter ( p ) .getType ( ) .getLabel ( )
53+ }
4054
4155 language [ monotonicAggregates]
42- private string getMethodParamList ( ) {
56+ pragma [ nomagic]
57+ private string getMethodParamListGeneric ( ) {
4358 result = concat ( int p |
44- exists ( getParameter ( p ) )
59+ p in [ 0 .. this . getNumberOfParameters ( ) - 1 ]
4560 |
46- getParameter ( p ) . getType ( ) . getLabel ( ) , "," order by p
61+ this . getParameterTypeLabelGeneric ( p ) , "," order by p
4762 )
4863 }
4964
65+ pragma [ noinline]
66+ private string getLabelNonGeneric ( ) {
67+ not this instanceof Generic and
68+ result = this .getReturnTypeLabel ( ) + " " + this .getDeclaringTypeLabel ( ) + "." +
69+ this .getUndecoratedName ( ) + "(" + this .getMethodParamListNonGeneric ( ) + ")"
70+ }
71+
72+ pragma [ noinline]
73+ private string getLabelGeneric ( ) {
74+ result = this .getReturnTypeLabel ( ) + " " + this .getDeclaringTypeLabel ( ) + "." +
75+ this .getUndecoratedName ( ) + getGenericsLabel ( this ) + "(" + this .getMethodParamListGeneric ( ) +
76+ ")"
77+ }
78+
79+ final override string getLabel ( ) {
80+ result = this .getLabelNonGeneric ( ) or
81+ result = this .getLabelGeneric ( )
82+ }
83+
84+ private string getReturnTypeLabel ( ) {
85+ result = getReturnType ( ) .getLabel ( )
86+ or
87+ not exists ( this .getReturnType ( ) ) and result = "System.Void"
88+ }
89+
5090 override string getUndecoratedName ( ) { result = getName ( ) }
5191
5292 /** Gets the return type of this callable. */
0 commit comments