@@ -79,15 +79,10 @@ module SupportMethod {
7979
8080bindingset [ this ]
8181abstract class SupportMethod extends string {
82- abstract predicate appliesTo ( Type t , Content c ) ;
83-
8482 string getARequiredImport ( ) { none ( ) }
8583
8684 string getDefinition ( ) { none ( ) }
8785
88- bindingset [ this , arg]
89- abstract string getCall ( string arg ) ;
90-
9186 /** Gets the priority of this support method. Lower priorities are preferred when multiple support methods apply. */
9287 bindingset [ this ]
9388 int getPriority ( ) { result = 50 }
@@ -104,31 +99,28 @@ abstract class SupportMethod extends string {
10499class SourceMethod extends SupportMethod {
105100 SourceMethod ( ) { this = "source" }
106101
107- override predicate appliesTo ( Type t , Content c ) { none ( ) }
108-
109- bindingset [ arg]
110- override string getCall ( string arg ) {
111- result = "source()" and
112- // suppress unused variable warning
113- arg = arg
114- }
115-
116102 override string getDefinition ( ) { result = "Object source() { return null; }" }
117103}
118104
119105class SinkMethod extends SupportMethod {
120106 SinkMethod ( ) { this = "sink" }
121107
122- override predicate appliesTo ( Type t , Content c ) { none ( ) }
123-
124- bindingset [ arg]
125- override string getCall ( string arg ) { result = "sink(" + arg + ")" }
126-
127108 override string getDefinition ( ) { result = "void sink(Object o) { }" }
128109}
129110
130111bindingset [ this ]
131- abstract class GetMethod extends SupportMethod { }
112+ abstract class GetMethod extends SupportMethod {
113+ /**
114+ * Holds if this get method can be used to get the content `c` from the type `t`.
115+ */
116+ abstract predicate appliesTo ( Type t , Content c ) ;
117+
118+ /**
119+ * Gets the call to get the content from the argument `arg`.
120+ */
121+ bindingset [ this , arg]
122+ abstract string getCall ( string arg ) ;
123+ }
132124
133125private class DefaultGetMethod extends GetMethod {
134126 Content c ;
@@ -254,7 +246,18 @@ private class ArrayGetMethod extends GetMethod {
254246}
255247
256248bindingset [ this ]
257- abstract class GenMethod extends SupportMethod { }
249+ abstract class GenMethod extends SupportMethod {
250+ /**
251+ * Holds if this generator method can be used to generate a new `t` that contains content `c`.
252+ */
253+ abstract predicate appliesTo ( Type t , Content c ) ;
254+
255+ /**
256+ * Gets the call to generate an object with content `arg`.
257+ */
258+ bindingset [ this , arg]
259+ abstract string getCall ( string arg ) ;
260+ }
258261
259262private class DefaultGenMethod extends GenMethod {
260263 Content c ;
0 commit comments