@@ -24,14 +24,8 @@ class Operation extends Expr, TOperation {
2424
2525/** A unary operation. */
2626class UnaryOperation extends Operation , TUnaryOperation {
27- private Generated:: Unary g ;
28-
29- UnaryOperation ( ) { g = toGenerated ( this ) }
30-
3127 /** Gets the operand of this unary operation. */
32- final Expr getOperand ( ) { toGenerated ( result ) = g .getOperand ( ) }
33-
34- final override string getOperator ( ) { result = g .getOperator ( ) }
28+ Expr getOperand ( ) { none ( ) }
3529
3630 final override Expr getAnOperand ( ) { result = this .getOperand ( ) }
3731
@@ -44,8 +38,18 @@ class UnaryOperation extends Operation, TUnaryOperation {
4438 final override string toString ( ) { result = this .getOperator ( ) + " ..." }
4539}
4640
41+ private class UnaryOperationGenerated extends UnaryOperation , TUnaryOperation {
42+ private Generated:: Unary g ;
43+
44+ UnaryOperationGenerated ( ) { g = toGenerated ( this ) }
45+
46+ final override Expr getOperand ( ) { toGenerated ( result ) = g .getOperand ( ) }
47+
48+ final override string getOperator ( ) { result = g .getOperator ( ) }
49+ }
50+
4751/** A unary logical operation. */
48- class UnaryLogicalOperation extends UnaryOperation , TUnaryLogicalOperation { }
52+ class UnaryLogicalOperation extends UnaryOperationGenerated , TUnaryLogicalOperation { }
4953
5054/**
5155 * A logical NOT operation, using either `!` or `not`.
@@ -59,7 +63,7 @@ class NotExpr extends UnaryLogicalOperation, TNotExpr {
5963}
6064
6165/** A unary arithmetic operation. */
62- class UnaryArithmeticOperation extends UnaryOperation , TUnaryArithmeticOperation { }
66+ class UnaryArithmeticOperation extends UnaryOperationGenerated , TUnaryArithmeticOperation { }
6367
6468/**
6569 * A unary plus expression.
@@ -81,6 +85,42 @@ class UnaryMinusExpr extends UnaryArithmeticOperation, TUnaryMinusExpr {
8185 final override string getAPrimaryQlClass ( ) { result = "UnaryMinusExpr" }
8286}
8387
88+ /**
89+ * A splat expression.
90+ * ```rb
91+ * foo(*args)
92+ * ```
93+ */
94+ class SplatExpr extends UnaryOperation , TSplatArgument {
95+ private Generated:: SplatArgument g ;
96+
97+ SplatExpr ( ) { this = TSplatArgument ( g ) }
98+
99+ final override Expr getOperand ( ) { toGenerated ( result ) = g .getChild ( ) }
100+
101+ final override string getOperator ( ) { result = "*" }
102+
103+ final override string getAPrimaryQlClass ( ) { result = "SplatExpr" }
104+ }
105+
106+ /**
107+ * A hash-splat (or 'double-splat') expression.
108+ * ```rb
109+ * foo(**options)
110+ * ```
111+ */
112+ class HashSplatExpr extends UnaryOperation , THashSplatArgument {
113+ private Generated:: HashSplatArgument g ;
114+
115+ HashSplatExpr ( ) { this = THashSplatArgument ( g ) }
116+
117+ final override Expr getOperand ( ) { toGenerated ( result ) = g .getChild ( ) }
118+
119+ final override string getOperator ( ) { result = "**" }
120+
121+ final override string getAPrimaryQlClass ( ) { result = "HashSplatExpr" }
122+ }
123+
84124/** A unary bitwise operation. */
85125class UnaryBitwiseOperation extends UnaryOperation , TUnaryBitwiseOperation { }
86126
0 commit comments