@@ -162,6 +162,13 @@ private predicate sinkModel(string row) { any(SinkModelCsv s).row(row) }
162
162
163
163
private predicate summaryModel ( string row ) { any ( SummaryModelCsv s ) .row ( row ) }
164
164
165
+ bindingset [ input]
166
+ private predicate getKind ( string input , string kind , boolean generated ) {
167
+ input .splitAt ( ":" , 0 ) = "generated" and kind = input .splitAt ( ":" , 1 ) and generated = true
168
+ or
169
+ not input .matches ( "%:%" ) and kind = input and generated = false
170
+ }
171
+
165
172
/** Holds if a source model exists for the given parameters. */
166
173
predicate sourceModel (
167
174
string namespace , string type , boolean subtypes , string name , string signature , string ext ,
@@ -177,8 +184,7 @@ predicate sourceModel(
177
184
row .splitAt ( ";" , 4 ) = signature and
178
185
row .splitAt ( ";" , 5 ) = ext and
179
186
row .splitAt ( ";" , 6 ) = output and
180
- row .splitAt ( ";" , 7 ) = kind and
181
- generated = false
187
+ exists ( string k | row .splitAt ( ";" , 7 ) = k and getKind ( k , kind , generated ) )
182
188
)
183
189
}
184
190
@@ -197,8 +203,7 @@ predicate sinkModel(
197
203
row .splitAt ( ";" , 4 ) = signature and
198
204
row .splitAt ( ";" , 5 ) = ext and
199
205
row .splitAt ( ";" , 6 ) = input and
200
- row .splitAt ( ";" , 7 ) = kind and
201
- generated = false
206
+ exists ( string k | row .splitAt ( ";" , 7 ) = k and getKind ( k , kind , generated ) )
202
207
)
203
208
}
204
209
@@ -218,8 +223,7 @@ predicate summaryModel(
218
223
row .splitAt ( ";" , 5 ) = ext and
219
224
row .splitAt ( ";" , 6 ) = input and
220
225
row .splitAt ( ";" , 7 ) = output and
221
- row .splitAt ( ";" , 8 ) = kind and
222
- generated = false // We need to split the "kind" field on ":".
226
+ exists ( string k | row .splitAt ( ";" , 8 ) = k and getKind ( k , kind , generated ) )
223
227
)
224
228
}
225
229
0 commit comments