@@ -46,7 +46,8 @@ pub enum AssociatedElement {
46
46
name : String ,
47
47
params : Vec < Param > ,
48
48
invariant : String ,
49
- block : String ,
49
+ filters : Option < String > ,
50
+ block : Option < String > ,
50
51
} ,
51
52
Function {
52
53
name : String ,
@@ -259,11 +260,11 @@ impl AssociatedElement {
259
260
pub fn block ( & self ) -> Option < & str > {
260
261
match self {
261
262
AssociatedElement :: Rule { block, .. }
262
- | AssociatedElement :: Invariant { block, .. }
263
263
| AssociatedElement :: Function { block, .. }
264
264
| AssociatedElement :: Methods { block } => Some ( block. as_str ( ) ) ,
265
265
266
- AssociatedElement :: Ghost { block, .. }
266
+ AssociatedElement :: Invariant { block, .. }
267
+ | AssociatedElement :: Ghost { block, .. }
267
268
| AssociatedElement :: GhostMapping { block, .. } => block. as_ref ( ) . map ( String :: as_str) ,
268
269
269
270
AssociatedElement :: Definition { .. } => None , //TODO: return definition?
@@ -285,4 +286,33 @@ impl AssociatedElement {
285
286
_ => None ,
286
287
}
287
288
}
289
+
290
+ pub fn filters ( & self ) -> Option < & str > {
291
+ match self {
292
+ AssociatedElement :: Rule { filters, .. }
293
+ | AssociatedElement :: Invariant { filters, .. } => filters. as_ref ( ) . map ( String :: as_str) ,
294
+ _ => None ,
295
+ }
296
+ }
297
+
298
+ pub fn invariant ( & self ) -> Option < & str > {
299
+ match self {
300
+ AssociatedElement :: Invariant { invariant, .. } => Some ( invariant. as_str ( ) ) ,
301
+ _ => None ,
302
+ }
303
+ }
304
+
305
+ pub fn mapping ( & self ) -> Option < & str > {
306
+ match self {
307
+ AssociatedElement :: GhostMapping { mapping, .. } => Some ( mapping. as_str ( ) ) ,
308
+ _ => None ,
309
+ }
310
+ }
311
+
312
+ pub fn definition ( & self ) -> Option < & str > {
313
+ match self {
314
+ AssociatedElement :: Definition { definition, .. } => Some ( definition. as_str ( ) ) ,
315
+ _ => None ,
316
+ }
317
+ }
288
318
}
0 commit comments