@@ -8,48 +8,36 @@ private import internal.Operation
88 *
99 * This is the QL root class for all operations.
1010 */
11- class Operation extends Expr , TOperation {
11+ class Operation extends Expr instanceof OperationImpl {
1212 /** Gets the operator of this operation. */
13- string getOperator ( ) { none ( ) }
13+ final string getOperator ( ) { result = super . getOperatorImpl ( ) }
1414
1515 /** Gets an operand of this operation. */
16- Expr getAnOperand ( ) { none ( ) }
16+ final Expr getAnOperand ( ) { result = super . getAnOperandImpl ( ) }
1717
1818 override AstNode getAChild ( string pred ) {
19- result = super .getAChild ( pred )
19+ result = Expr . super .getAChild ( pred )
2020 or
2121 pred = "getAnOperand" and result = this .getAnOperand ( )
2222 }
2323}
2424
2525/** A unary operation. */
26- class UnaryOperation extends Operation , TUnaryOperation {
26+ class UnaryOperation extends Operation , MethodCall instanceof UnaryOperationImpl {
2727 /** Gets the operand of this unary operation. */
28- Expr getOperand ( ) { none ( ) }
29-
30- final override Expr getAnOperand ( ) { result = this .getOperand ( ) }
28+ final Expr getOperand ( ) { result = super .getOperandImpl ( ) }
3129
3230 final override AstNode getAChild ( string pred ) {
33- result = super .getAChild ( pred )
31+ result = Operation . super .getAChild ( pred )
3432 or
3533 pred = "getOperand" and result = this .getOperand ( )
3634 }
3735
3836 final override string toString ( ) { result = this .getOperator ( ) + " ..." }
3937}
4038
41- private class UnaryOperationGenerated extends UnaryOperation , TUnaryOperation {
42- private Ruby:: 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-
5139/** A unary logical operation. */
52- class UnaryLogicalOperation extends UnaryOperationGenerated , TUnaryLogicalOperation { }
40+ class UnaryLogicalOperation extends UnaryOperation , TUnaryLogicalOperation { }
5341
5442/**
5543 * A logical NOT operation, using either `!` or `not`.
@@ -63,7 +51,7 @@ class NotExpr extends UnaryLogicalOperation, TNotExpr {
6351}
6452
6553/** A unary arithmetic operation. */
66- class UnaryArithmeticOperation extends UnaryOperationGenerated , TUnaryArithmeticOperation { }
54+ class UnaryArithmeticOperation extends UnaryOperation , TUnaryArithmeticOperation { }
6755
6856/**
6957 * A unary plus expression.
@@ -92,10 +80,6 @@ class UnaryMinusExpr extends UnaryArithmeticOperation, TUnaryMinusExpr {
9280 * ```
9381 */
9482class SplatExpr extends UnaryOperation , TSplatExpr {
95- final override Expr getOperand ( ) { result = this .( SplatExprImpl ) .getOperandImpl ( ) }
96-
97- final override string getOperator ( ) { result = "*" }
98-
9983 final override string getAPrimaryQlClass ( ) { result = "SplatExpr" }
10084}
10185
@@ -110,10 +94,6 @@ class HashSplatExpr extends UnaryOperation, THashSplatExpr {
11094
11195 HashSplatExpr ( ) { this = THashSplatExpr ( g ) }
11296
113- final override Expr getOperand ( ) { toGenerated ( result ) = g .getChild ( ) }
114-
115- final override string getOperator ( ) { result = "**" }
116-
11797 final override string getAPrimaryQlClass ( ) { result = "HashSplatExpr" }
11898}
11999
@@ -141,44 +121,22 @@ class DefinedExpr extends UnaryOperation, TDefinedExpr {
141121}
142122
143123/** A binary operation. */
144- class BinaryOperation extends Operation , TBinaryOperation {
145- final override Expr getAnOperand ( ) {
146- result = this .getLeftOperand ( ) or result = this .getRightOperand ( )
147- }
148-
124+ class BinaryOperation extends Operation , MethodCall instanceof BinaryOperationImpl {
149125 final override string toString ( ) { result = "... " + this .getOperator ( ) + " ..." }
150126
151127 override AstNode getAChild ( string pred ) {
152- result = super .getAChild ( pred )
128+ result = Operation . super .getAChild ( pred )
153129 or
154130 pred = "getLeftOperand" and result = this .getLeftOperand ( )
155131 or
156132 pred = "getRightOperand" and result = this .getRightOperand ( )
157133 }
158134
159135 /** Gets the left operand of this binary operation. */
160- Stmt getLeftOperand ( ) { none ( ) }
136+ final Stmt getLeftOperand ( ) { result = super . getLeftOperandImpl ( ) }
161137
162138 /** Gets the right operand of this binary operation. */
163- Stmt getRightOperand ( ) { none ( ) }
164- }
165-
166- private class BinaryOperationReal extends BinaryOperation {
167- private Ruby:: Binary g ;
168-
169- BinaryOperationReal ( ) { g = toGenerated ( this ) }
170-
171- final override string getOperator ( ) { result = g .getOperator ( ) }
172-
173- final override Stmt getLeftOperand ( ) { toGenerated ( result ) = g .getLeft ( ) }
174-
175- final override Stmt getRightOperand ( ) { toGenerated ( result ) = g .getRight ( ) }
176- }
177-
178- abstract private class BinaryOperationSynth extends BinaryOperation {
179- final override Stmt getLeftOperand ( ) { synthChild ( this , 0 , result ) }
180-
181- final override Stmt getRightOperand ( ) { synthChild ( this , 1 , result ) }
139+ final Stmt getRightOperand ( ) { result = super .getRightOperandImpl ( ) }
182140}
183141
184142/**
@@ -196,10 +154,6 @@ class AddExpr extends BinaryArithmeticOperation, TAddExpr {
196154 final override string getAPrimaryQlClass ( ) { result = "AddExpr" }
197155}
198156
199- private class AddExprSynth extends AddExpr , BinaryOperationSynth , TAddExprSynth {
200- final override string getOperator ( ) { result = "+" }
201- }
202-
203157/**
204158 * A subtract expression.
205159 * ```rb
@@ -210,10 +164,6 @@ class SubExpr extends BinaryArithmeticOperation, TSubExpr {
210164 final override string getAPrimaryQlClass ( ) { result = "SubExpr" }
211165}
212166
213- private class SubExprSynth extends SubExpr , BinaryOperationSynth , TSubExprSynth {
214- final override string getOperator ( ) { result = "-" }
215- }
216-
217167/**
218168 * A multiply expression.
219169 * ```rb
@@ -224,10 +174,6 @@ class MulExpr extends BinaryArithmeticOperation, TMulExpr {
224174 final override string getAPrimaryQlClass ( ) { result = "MulExpr" }
225175}
226176
227- private class MulExprSynth extends MulExpr , BinaryOperationSynth , TMulExprSynth {
228- final override string getOperator ( ) { result = "*" }
229- }
230-
231177/**
232178 * A divide expression.
233179 * ```rb
@@ -238,10 +184,6 @@ class DivExpr extends BinaryArithmeticOperation, TDivExpr {
238184 final override string getAPrimaryQlClass ( ) { result = "DivExpr" }
239185}
240186
241- private class DivExprSynth extends DivExpr , BinaryOperationSynth , TDivExprSynth {
242- final override string getOperator ( ) { result = "/" }
243- }
244-
245187/**
246188 * A modulo expression.
247189 * ```rb
@@ -252,10 +194,6 @@ class ModuloExpr extends BinaryArithmeticOperation, TModuloExpr {
252194 final override string getAPrimaryQlClass ( ) { result = "ModuloExpr" }
253195}
254196
255- private class ModuloExprSynth extends ModuloExpr , BinaryOperationSynth , TModuloExprSynth {
256- final override string getOperator ( ) { result = "%" }
257- }
258-
259197/**
260198 * An exponent expression.
261199 * ```rb
@@ -266,10 +204,6 @@ class ExponentExpr extends BinaryArithmeticOperation, TExponentExpr {
266204 final override string getAPrimaryQlClass ( ) { result = "ExponentExpr" }
267205}
268206
269- private class ExponentExprSynth extends ExponentExpr , BinaryOperationSynth , TExponentExprSynth {
270- final override string getOperator ( ) { result = "**" }
271- }
272-
273207/**
274208 * A binary logical operation.
275209 */
@@ -286,10 +220,6 @@ class LogicalAndExpr extends BinaryLogicalOperation, TLogicalAndExpr {
286220 final override string getAPrimaryQlClass ( ) { result = "LogicalAndExpr" }
287221}
288222
289- private class LogicalAndExprSynth extends LogicalAndExpr , BinaryOperationSynth , TLogicalAndExprSynth {
290- final override string getOperator ( ) { result = "&&" }
291- }
292-
293223/**
294224 * A logical OR operation, using either `or` or `||`.
295225 * ```rb
@@ -301,10 +231,6 @@ class LogicalOrExpr extends BinaryLogicalOperation, TLogicalOrExpr {
301231 final override string getAPrimaryQlClass ( ) { result = "LogicalOrExpr" }
302232}
303233
304- private class LogicalOrExprSynth extends LogicalOrExpr , BinaryOperationSynth , TLogicalOrExprSynth {
305- final override string getOperator ( ) { result = "||" }
306- }
307-
308234/**
309235 * A binary bitwise operation.
310236 */
@@ -320,10 +246,6 @@ class LShiftExpr extends BinaryBitwiseOperation, TLShiftExpr {
320246 final override string getAPrimaryQlClass ( ) { result = "LShiftExpr" }
321247}
322248
323- private class LShiftExprSynth extends LShiftExpr , BinaryOperationSynth , TLShiftExprSynth {
324- final override string getOperator ( ) { result = "<<" }
325- }
326-
327249/**
328250 * A right-shift operation.
329251 * ```rb
@@ -334,10 +256,6 @@ class RShiftExpr extends BinaryBitwiseOperation, TRShiftExpr {
334256 final override string getAPrimaryQlClass ( ) { result = "RShiftExpr" }
335257}
336258
337- private class RShiftExprSynth extends RShiftExpr , BinaryOperationSynth , TRShiftExprSynth {
338- final override string getOperator ( ) { result = ">>" }
339- }
340-
341259/**
342260 * A bitwise AND operation.
343261 * ```rb
@@ -348,10 +266,6 @@ class BitwiseAndExpr extends BinaryBitwiseOperation, TBitwiseAndExpr {
348266 final override string getAPrimaryQlClass ( ) { result = "BitwiseAndExpr" }
349267}
350268
351- private class BitwiseAndSynthExpr extends BitwiseAndExpr , BinaryOperationSynth , TBitwiseAndExprSynth {
352- final override string getOperator ( ) { result = "&" }
353- }
354-
355269/**
356270 * A bitwise OR operation.
357271 * ```rb
@@ -362,10 +276,6 @@ class BitwiseOrExpr extends BinaryBitwiseOperation, TBitwiseOrExpr {
362276 final override string getAPrimaryQlClass ( ) { result = "BitwiseOrExpr" }
363277}
364278
365- private class BitwiseOrSynthExpr extends BitwiseOrExpr , BinaryOperationSynth , TBitwiseOrExprSynth {
366- final override string getOperator ( ) { result = "|" }
367- }
368-
369279/**
370280 * An XOR (exclusive OR) operation.
371281 * ```rb
@@ -376,10 +286,6 @@ class BitwiseXorExpr extends BinaryBitwiseOperation, TBitwiseXorExpr {
376286 final override string getAPrimaryQlClass ( ) { result = "BitwiseXorExpr" }
377287}
378288
379- private class BitwiseXorSynthExpr extends BitwiseXorExpr , BinaryOperationSynth , TBitwiseXorExprSynth {
380- final override string getOperator ( ) { result = "^" }
381- }
382-
383289/**
384290 * A comparison operation. That is, either an equality operation or a
385291 * relational operation.
@@ -531,21 +437,17 @@ class NoRegExpMatchExpr extends BinaryOperation, TNoRegExpMatchExpr {
531437 *
532438 * This is a QL base class for all assignments.
533439 */
534- class Assignment extends Operation , TAssignment {
440+ class Assignment extends Operation instanceof AssignmentImpl {
535441 /** Gets the left hand side of this assignment. */
536- final Pattern getLeftOperand ( ) { result = this . ( AssignmentImpl ) .getLeftOperandImpl ( ) }
442+ final Pattern getLeftOperand ( ) { result = super .getLeftOperandImpl ( ) }
537443
538444 /** Gets the right hand side of this assignment. */
539- final Expr getRightOperand ( ) { result = this .( AssignmentImpl ) .getRightOperandImpl ( ) }
540-
541- final override Expr getAnOperand ( ) {
542- result = this .getLeftOperand ( ) or result = this .getRightOperand ( )
543- }
445+ final Expr getRightOperand ( ) { result = super .getRightOperandImpl ( ) }
544446
545447 final override string toString ( ) { result = "... " + this .getOperator ( ) + " ..." }
546448
547449 override AstNode getAChild ( string pred ) {
548- result = super .getAChild ( pred )
450+ result = Operation . super .getAChild ( pred )
549451 or
550452 pred = "getLeftOperand" and result = getLeftOperand ( )
551453 or
@@ -560,21 +462,13 @@ class Assignment extends Operation, TAssignment {
560462 * ```
561463 */
562464class AssignExpr extends Assignment , TAssignExpr {
563- final override string getOperator ( ) { result = "=" }
564-
565465 final override string getAPrimaryQlClass ( ) { result = "AssignExpr" }
566466}
567467
568468/**
569469 * A binary assignment operation other than `=`.
570470 */
571- class AssignOperation extends Assignment , TAssignOperation {
572- Ruby:: OperatorAssignment g ;
573-
574- AssignOperation ( ) { g = toGenerated ( this ) }
575-
576- final override string getOperator ( ) { result = g .getOperator ( ) }
577- }
471+ class AssignOperation extends Assignment instanceof AssignOperationImpl { }
578472
579473/**
580474 * An arithmetic assignment operation: `+=`, `-=`, `*=`, `/=`, `**=`, and `%=`.
0 commit comments