@@ -55,19 +55,25 @@ private Content getContent(SummaryComponent component) {
5555
5656module SupportMethod {
5757 GenMethod genMethodForContent ( SummaryComponentStack c ) {
58- result = min ( GenMethod g | g . appliesTo ( any ( VoidType v ) , getContent ( c . head ( ) ) ) )
58+ result = genMethodFor ( any ( VoidType v ) , c )
5959 }
6060
6161 GenMethod genMethodFor ( Type t , SummaryComponentStack c ) {
62- result = min ( GenMethod g | g .appliesTo ( t , getContent ( c .head ( ) ) ) )
62+ result =
63+ min ( GenMethod g |
64+ g = min ( GenMethod g1 | g1 .appliesTo ( t , getContent ( c .head ( ) ) ) | g1 order by g1 .getPriority ( ) )
65+ )
6366 }
6467
6568 GetMethod getMethodForContent ( SummaryComponentStack c ) {
66- result = min ( GetMethod g | g . appliesTo ( any ( VoidType v ) , getContent ( c . head ( ) ) ) )
69+ result = getMethodFor ( any ( VoidType v ) , c )
6770 }
6871
6972 GetMethod getMethodFor ( Type t , SummaryComponentStack c ) {
70- result = min ( GetMethod g | g .appliesTo ( t , getContent ( c .head ( ) ) ) )
73+ result =
74+ min ( GetMethod g |
75+ g = min ( GetMethod g1 | g1 .appliesTo ( t , getContent ( c .head ( ) ) ) | g1 order by g1 .getPriority ( ) )
76+ )
7177 }
7278}
7379
@@ -82,6 +88,10 @@ abstract class SupportMethod extends string {
8288 bindingset [ this , arg]
8389 abstract string getCall ( string arg ) ;
8490
91+ /** Gets the priority of this support method. Lower priorities are preferred when multiple support methods apply. */
92+ bindingset [ this ]
93+ int getPriority ( ) { result = 50 }
94+
8595 /**
8696 * Gets the CSV row describing this support method if it is needed to set up the output for this test.
8797 *
@@ -123,11 +133,12 @@ abstract class GetMethod extends SupportMethod { }
123133private class DefaultGetMethod extends GetMethod {
124134 Content c ;
125135
126- // prefix with zzz so the default getter is always last
127- DefaultGetMethod ( ) { this = "zzzDefaultGet" + contentToken ( c ) }
136+ DefaultGetMethod ( ) { this = "DefaultGet" + contentToken ( c ) }
128137
129138 string getName ( ) { result = "get" + contentToken ( c ) }
130139
140+ override int getPriority ( ) { result = 999 }
141+
131142 override predicate appliesTo ( Type t , Content c1 ) {
132143 c = c1 and
133144 // suppress unused variable warning
@@ -248,11 +259,12 @@ abstract class GenMethod extends SupportMethod { }
248259private class DefaultGenMethod extends GenMethod {
249260 Content c ;
250261
251- // prefix with zzz so the default generator is always last
252- DefaultGenMethod ( ) { this = "zzzDefaultGen" + contentToken ( c ) }
262+ DefaultGenMethod ( ) { this = "DefaultGen" + contentToken ( c ) }
253263
254264 string getName ( ) { result = "newWith" + contentToken ( c ) }
255265
266+ override int getPriority ( ) { result = 999 }
267+
256268 override predicate appliesTo ( Type t , Content c1 ) {
257269 c = c1 and
258270 // suppress unused variable warning
0 commit comments