@@ -79,15 +79,10 @@ module SupportMethod {
79
79
80
80
bindingset [ this ]
81
81
abstract class SupportMethod extends string {
82
- abstract predicate appliesTo ( Type t , Content c ) ;
83
-
84
82
string getARequiredImport ( ) { none ( ) }
85
83
86
84
string getDefinition ( ) { none ( ) }
87
85
88
- bindingset [ this , arg]
89
- abstract string getCall ( string arg ) ;
90
-
91
86
/** Gets the priority of this support method. Lower priorities are preferred when multiple support methods apply. */
92
87
bindingset [ this ]
93
88
int getPriority ( ) { result = 50 }
@@ -104,31 +99,28 @@ abstract class SupportMethod extends string {
104
99
class SourceMethod extends SupportMethod {
105
100
SourceMethod ( ) { this = "source" }
106
101
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
-
116
102
override string getDefinition ( ) { result = "Object source() { return null; }" }
117
103
}
118
104
119
105
class SinkMethod extends SupportMethod {
120
106
SinkMethod ( ) { this = "sink" }
121
107
122
- override predicate appliesTo ( Type t , Content c ) { none ( ) }
123
-
124
- bindingset [ arg]
125
- override string getCall ( string arg ) { result = "sink(" + arg + ")" }
126
-
127
108
override string getDefinition ( ) { result = "void sink(Object o) { }" }
128
109
}
129
110
130
111
bindingset [ 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
+ }
132
124
133
125
private class DefaultGetMethod extends GetMethod {
134
126
Content c ;
@@ -254,7 +246,18 @@ private class ArrayGetMethod extends GetMethod {
254
246
}
255
247
256
248
bindingset [ 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
+ }
258
261
259
262
private class DefaultGenMethod extends GenMethod {
260
263
Content c ;
0 commit comments