Skip to content

Commit 13d6deb

Browse files
committed
Swift: Make similar enhancements to unary operations.
1 parent 70075e2 commit 13d6deb

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed
Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
1-
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
21
private import codeql.swift.generated.expr.PostfixUnaryExpr
2+
private import codeql.swift.elements.expr.Expr
3+
private import codeql.swift.elements.decl.AbstractFunctionDecl
34

4-
class PostfixUnaryExpr extends Generated::PostfixUnaryExpr { }
5+
/**
6+
* A Swift postfix unary expression, that is, a unary expression that appears
7+
* after its operand. For example:
8+
* ```
9+
* x!
10+
* ```
11+
*/
12+
class PostfixUnaryExpr extends Generated::PostfixUnaryExpr {
13+
/**
14+
* Gets the operand (expression) of this postfix unary expression.
15+
*/
16+
Expr getOperand() { result = this.getAnArgument().getExpr() }
17+
18+
/**
19+
* Gets the operator of this postfix unary expression (the function that is called).
20+
*/
21+
AbstractFunctionDecl getOperator() { result = this.getStaticTarget() }
22+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
private import codeql.swift.generated.expr.PrefixUnaryExpr
22
private import codeql.swift.elements.expr.Expr
3+
private import codeql.swift.elements.decl.AbstractFunctionDecl
34

5+
/**
6+
* A Swift prefix unary expression, that is, a unary expression that appears
7+
* before its operand. For example:
8+
* ```
9+
* -x
10+
* ```
11+
*/
412
class PrefixUnaryExpr extends Generated::PrefixUnaryExpr {
13+
/**
14+
* Gets the operand (expression) of this prefix unary expression.
15+
*/
516
Expr getOperand() { result = this.getAnArgument().getExpr() }
17+
18+
/**
19+
* Gets the operator of this prefix unary expression (the function that is called).
20+
*/
21+
AbstractFunctionDecl getOperator() { result = this.getStaticTarget() }
622
}

0 commit comments

Comments
 (0)