@@ -243,6 +243,8 @@ class TypeExpr extends TType, AstNode {
243243 result .( Class ) .getAliasType ( ) = this
244244 or
245245 result .( Class ) .getUnionMember ( ) = this
246+ or
247+ result .( MemberCall ) .getSuperType ( ) = this
246248 }
247249
248250 Type getResolvedType ( ) { resolveTypeExpr ( this , result ) }
@@ -454,6 +456,15 @@ class MemberCall extends TMemberCall, Call {
454456 result = expr .getChild ( _) .( Generated:: QualifiedRhs ) .getName ( ) .getValue ( )
455457 }
456458
459+ /**
460+ * Gets the supertype referenced in this call, that is the `Foo` in `Foo.super.bar(...)`.
461+ *
462+ * Only yields a result if this is actually a `super` call.
463+ */
464+ TypeExpr getSuperType ( ) {
465+ toGenerated ( result ) = expr .getChild ( _) .( Generated:: SuperRef ) .getChild ( 0 )
466+ }
467+
457468 override Expr getArgument ( int i ) {
458469 result =
459470 rank [ i + 1 ] ( Expr e , int index |
@@ -813,6 +824,39 @@ class HigherOrderFormula extends THigherOrderFormula, Formula {
813824 override string getAPrimaryQlClass ( ) { result = "HigherOrderFormula" }
814825}
815826
827+ class ExprAggregate extends TExprAggregate , Expr {
828+ Generated:: Aggregate agg ;
829+ Generated:: ExprAggregateBody body ;
830+ string kind ;
831+
832+ ExprAggregate ( ) {
833+ this = TExprAggregate ( agg ) and
834+ kind = agg .getChild ( 0 ) .( Generated:: AggId ) .getValue ( ) and
835+ body = agg .getChild ( _)
836+ }
837+
838+ string getKind ( ) { result = kind }
839+
840+ /**
841+ * Gets the ith "as" expression of this aggregate, if any.
842+ */
843+ AsExpr getAsExpr ( int i ) { toGenerated ( result ) = body .getAsExprs ( ) .getChild ( i ) }
844+
845+ /**
846+ * Gets the ith "order by" expression of this aggregate, if any.
847+ */
848+ Expr getOrderBy ( int i ) { toGenerated ( result ) = body .getOrderBys ( ) .getChild ( i ) .getChild ( 0 ) }
849+
850+ /**
851+ * Gets the direction (ascending or descending) of the ith "order by" expression of this aggregate.
852+ */
853+ string getOrderbyDirection ( int i ) {
854+ result = body .getOrderBys ( ) .getChild ( i ) .getChild ( 1 ) .( Generated:: Direction ) .getValue ( )
855+ }
856+
857+ override string getAPrimaryQlClass ( ) { result = "ExprAggregate[" + kind + "]" }
858+ }
859+
816860/** An aggregate expression, such as `count` or `sum`. */
817861class Aggregate extends TAggregate , Expr {
818862 Generated:: Aggregate agg ;
@@ -899,6 +943,8 @@ class AsExpr extends TAsExpr, AstNode {
899943 or
900944 result .( Aggregate ) .getAsExpr ( _) = this
901945 or
946+ result .( ExprAggregate ) .getAsExpr ( _) = this
947+ or
902948 result .( Select ) .getAsExpr ( _) = this
903949 }
904950}
@@ -933,7 +979,9 @@ class Expr extends TExpr, AstNode {
933979 result .( Call ) .getArgument ( _) = this
934980 or
935981 result .( Aggregate ) .getOrderBy ( _) = this
936- or
982+ or
983+ result .( ExprAggregate ) .getOrderBy ( _) = this
984+ or
937985 result .( Select ) .getOrderBy ( _) = this
938986 }
939987}
0 commit comments