File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
swift/ql/lib/codeql/swift/elements/expr Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,32 @@ private import codeql.swift.generated.expr.BinaryExpr
2
2
private import codeql.swift.elements.expr.Expr
3
3
private import codeql.swift.elements.decl.AbstractFunctionDecl
4
4
5
+ /**
6
+ * A Swift binary expression, that is, an expression that appears between its
7
+ * two operands. For example:
8
+ * ```
9
+ * x + y
10
+ * ```
11
+ */
5
12
class BinaryExpr extends Generated:: BinaryExpr {
13
+ /**
14
+ * Gets the left operand (left expression) of this binary expression.
15
+ */
6
16
Expr getLeftOperand ( ) { result = this .getArgument ( 0 ) .getExpr ( ) }
7
17
18
+ /**
19
+ * Gets the right operand (right expression) of this binary expression.
20
+ */
8
21
Expr getRightOperand ( ) { result = this .getArgument ( 1 ) .getExpr ( ) }
9
22
23
+ /**
24
+ * Gets the operator of this binary expression (the function that is called).
25
+ */
10
26
AbstractFunctionDecl getOperator ( ) { result = this .getStaticTarget ( ) }
11
27
28
+ /**
29
+ * Gets an operand of this binary expression (left or right).
30
+ */
12
31
Expr getAnOperand ( ) { result = [ this .getLeftOperand ( ) , this .getRightOperand ( ) ] }
13
32
14
33
override string toString ( ) { result = "... " + this .getFunction ( ) .toString ( ) + " ..." }
You can’t perform that action at this time.
0 commit comments