@@ -79,6 +79,27 @@ pub fn create_ast_node_class<'a>(ast_node: &'a str, ast_node_parent: &'a str) ->
7979 Box :: new ( ql:: Expression :: String ( "???" ) ) ,
8080 ) ,
8181 } ;
82+ let get_primary_ql_classes = ql:: Predicate {
83+ qldoc : Some (
84+ "Gets a comma-separated list of the names of the primary CodeQL \
85+ classes to which this element belongs."
86+ . to_owned ( ) ,
87+ ) ,
88+ name : "getPrimaryQlClasses" ,
89+ overridden : false ,
90+ return_type : Some ( ql:: Type :: String ) ,
91+ formal_parameters : vec ! [ ] ,
92+ body : ql:: Expression :: Equals (
93+ Box :: new ( ql:: Expression :: Var ( "result" ) ) ,
94+ Box :: new ( ql:: Expression :: Aggregate {
95+ name : "concat" ,
96+ vars : vec ! [ ] ,
97+ range : None ,
98+ expr : Box :: new ( ql:: Expression :: Pred ( "getAPrimaryQlClass" , vec ! [ ] ) ) ,
99+ second_expr : Some ( Box :: new ( ql:: Expression :: String ( "," ) ) ) ,
100+ } ) ,
101+ ) ,
102+ } ;
82103 ql:: Class {
83104 qldoc : Some ( String :: from ( "The base class for all AST nodes" ) ) ,
84105 name : "AstNode" ,
@@ -92,6 +113,7 @@ pub fn create_ast_node_class<'a>(ast_node: &'a str, ast_node_parent: &'a str) ->
92113 get_parent_index,
93114 get_a_field_or_child,
94115 get_a_primary_ql_class,
116+ get_primary_ql_classes,
95117 ] ,
96118 }
97119}
@@ -410,15 +432,16 @@ fn create_field_getters<'a>(
410432 } )
411433 . collect ( ) ;
412434 (
413- ql:: Expression :: Aggregate (
414- "exists" ,
415- vec ! [ ql:: FormalParameter {
435+ ql:: Expression :: Aggregate {
436+ name : "exists" ,
437+ vars : vec ! [ ql:: FormalParameter {
416438 name: "value" ,
417439 param_type: ql:: Type :: Int ,
418440 } ] ,
419- Box :: new ( get_value) ,
420- Box :: new ( ql:: Expression :: Or ( disjuncts) ) ,
421- ) ,
441+ range : Some ( Box :: new ( get_value) ) ,
442+ expr : Box :: new ( ql:: Expression :: Or ( disjuncts) ) ,
443+ second_expr : None ,
444+ } ,
422445 // Since the getter returns a string and not an AstNode, it won't be part of getAFieldOrChild:
423446 None ,
424447 )
0 commit comments