@@ -31,15 +31,23 @@ class ArithmeticOperation extends Expr {
31
31
* a + b
32
32
* ```
33
33
*/
34
- abstract class BinaryArithmeticOperation extends BinaryExpr { }
34
+ class BinaryArithmeticOperation extends BinaryExpr {
35
+ BinaryArithmeticOperation ( ) {
36
+ this instanceof AddExpr or
37
+ this instanceof SubExpr or
38
+ this instanceof MulExpr or
39
+ this instanceof DivExpr or
40
+ this instanceof RemExpr
41
+ }
42
+ }
35
43
36
44
/**
37
45
* An add expression.
38
46
* ```
39
47
* a + b
40
48
* ```
41
49
*/
42
- class AddExpr extends BinaryArithmeticOperation {
50
+ class AddExpr extends BinaryExpr {
43
51
AddExpr ( ) { this .getFunction ( ) .( DotSyntaxCallExpr ) .getStaticTarget ( ) .getName ( ) = "+(_:_:)" }
44
52
}
45
53
@@ -49,7 +57,7 @@ class AddExpr extends BinaryArithmeticOperation {
49
57
* a - b
50
58
* ```
51
59
*/
52
- class SubExpr extends BinaryArithmeticOperation {
60
+ class SubExpr extends BinaryExpr {
53
61
SubExpr ( ) { this .getFunction ( ) .( DotSyntaxCallExpr ) .getStaticTarget ( ) .getName ( ) = "-(_:_:)" }
54
62
}
55
63
@@ -59,7 +67,7 @@ class SubExpr extends BinaryArithmeticOperation {
59
67
* a * b
60
68
* ```
61
69
*/
62
- class MulExpr extends BinaryArithmeticOperation {
70
+ class MulExpr extends BinaryExpr {
63
71
MulExpr ( ) { this .getFunction ( ) .( DotSyntaxCallExpr ) .getStaticTarget ( ) .getName ( ) = "*(_:_:)" }
64
72
}
65
73
@@ -69,7 +77,7 @@ class MulExpr extends BinaryArithmeticOperation {
69
77
* a / b
70
78
* ```
71
79
*/
72
- class DivExpr extends BinaryArithmeticOperation {
80
+ class DivExpr extends BinaryExpr {
73
81
DivExpr ( ) { this .getFunction ( ) .( DotSyntaxCallExpr ) .getStaticTarget ( ) .getName ( ) = "/(_:_:)" }
74
82
}
75
83
@@ -79,7 +87,7 @@ class DivExpr extends BinaryArithmeticOperation {
79
87
* a % b
80
88
* ```
81
89
*/
82
- class RemExpr extends BinaryArithmeticOperation {
90
+ class RemExpr extends BinaryExpr {
83
91
RemExpr ( ) { this .getFunction ( ) .( DotSyntaxCallExpr ) .getStaticTarget ( ) .getName ( ) = "%(_:_:)" }
84
92
}
85
93
@@ -89,14 +97,16 @@ class RemExpr extends BinaryArithmeticOperation {
89
97
* -a
90
98
* ```
91
99
*/
92
- abstract class UnaryArithmeticOperation extends PrefixUnaryExpr { }
100
+ class UnaryArithmeticOperation extends PrefixUnaryExpr {
101
+ UnaryArithmeticOperation ( ) { this instanceof UnaryMinusExpr }
102
+ }
93
103
94
104
/**
95
105
* A unary minus expression.
96
106
* ```
97
107
* -a
98
108
* ```
99
109
*/
100
- class UnaryMinusExpr extends UnaryArithmeticOperation {
110
+ class UnaryMinusExpr extends PrefixUnaryExpr {
101
111
UnaryMinusExpr ( ) { this .getFunction ( ) .( DotSyntaxCallExpr ) .getStaticTarget ( ) .getName ( ) = "-(_:)" }
102
112
}
0 commit comments