Skip to content

Commit 70075e2

Browse files
committed
Swift: Add qldoc for BinaryExpr.
1 parent 3c46b0c commit 70075e2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

swift/ql/lib/codeql/swift/elements/expr/BinaryExpr.qll

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,32 @@ private import codeql.swift.generated.expr.BinaryExpr
22
private import codeql.swift.elements.expr.Expr
33
private import codeql.swift.elements.decl.AbstractFunctionDecl
44

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+
*/
512
class BinaryExpr extends Generated::BinaryExpr {
13+
/**
14+
* Gets the left operand (left expression) of this binary expression.
15+
*/
616
Expr getLeftOperand() { result = this.getArgument(0).getExpr() }
717

18+
/**
19+
* Gets the right operand (right expression) of this binary expression.
20+
*/
821
Expr getRightOperand() { result = this.getArgument(1).getExpr() }
922

23+
/**
24+
* Gets the operator of this binary expression (the function that is called).
25+
*/
1026
AbstractFunctionDecl getOperator() { result = this.getStaticTarget() }
1127

28+
/**
29+
* Gets an operand of this binary expression (left or right).
30+
*/
1231
Expr getAnOperand() { result = [this.getLeftOperand(), this.getRightOperand()] }
1332

1433
override string toString() { result = "... " + this.getFunction().toString() + " ..." }

0 commit comments

Comments
 (0)