File tree Expand file tree Collapse file tree 2 files changed +11
-17
lines changed
lib/codeql/swift/elements/expr
test/library-tests/elements/expr/logicaloperation Expand file tree Collapse file tree 2 files changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -6,31 +6,19 @@ private import codeql.swift.elements.expr.DeclRefExpr
6
6
private import codeql.swift.elements.decl.ConcreteFuncDecl
7
7
8
8
private predicate unaryHasName ( PrefixUnaryExpr e , string name ) {
9
- e .getFunction ( )
10
- .( DotSyntaxCallExpr )
11
- .getFunction ( )
12
- .( DeclRefExpr )
13
- .getDecl ( )
14
- .( ConcreteFuncDecl )
15
- .getName ( ) = name
9
+ e .getFunction ( ) .( DotSyntaxCallExpr ) .getStaticTarget ( ) .getName ( ) = name
16
10
}
17
11
18
12
private predicate binaryHasName ( BinaryExpr e , string name ) {
19
- e .getFunction ( )
20
- .( DotSyntaxCallExpr )
21
- .getFunction ( )
22
- .( DeclRefExpr )
23
- .getDecl ( )
24
- .( ConcreteFuncDecl )
25
- .getName ( ) = name
13
+ e .getFunction ( ) .( DotSyntaxCallExpr ) .getStaticTarget ( ) .getName ( ) = name
26
14
}
27
15
28
16
class LogicalAndExpr extends BinaryExpr {
29
- LogicalAndExpr ( ) { binaryHasName ( this , "&&" ) }
17
+ LogicalAndExpr ( ) { binaryHasName ( this , "&&(_:_:) " ) }
30
18
}
31
19
32
20
class LogicalOrExpr extends BinaryExpr {
33
- LogicalOrExpr ( ) { binaryHasName ( this , "||" ) }
21
+ LogicalOrExpr ( ) { binaryHasName ( this , "||(_:_:) " ) }
34
22
}
35
23
36
24
class BinaryLogicalOperation extends BinaryExpr {
@@ -41,7 +29,7 @@ class BinaryLogicalOperation extends BinaryExpr {
41
29
}
42
30
43
31
class NotExpr extends PrefixUnaryExpr {
44
- NotExpr ( ) { unaryHasName ( this , "!" ) }
32
+ NotExpr ( ) { unaryHasName ( this , "!(_:) " ) }
45
33
}
46
34
47
35
class UnaryLogicalOperation extends PrefixUnaryExpr {
Original file line number Diff line number Diff line change
1
+ | logicaloperation.swift:4:6:4:11 | ... call to &&(_:_:) ... | BinaryLogicalExpr, LogicalAndExpr |
2
+ | logicaloperation.swift:5:6:5:11 | ... call to \|\|(_:_:) ... | BinaryLogicalExpr, LogicalOrExpr |
3
+ | logicaloperation.swift:6:6:6:7 | call to ... | NotExpr, UnaryLogicalOperation |
4
+ | logicaloperation.swift:7:6:7:21 | call to ... | NotExpr, UnaryLogicalOperation |
5
+ | logicaloperation.swift:7:8:7:20 | ... call to \|\|(_:_:) ... | BinaryLogicalExpr, LogicalOrExpr |
6
+ | logicaloperation.swift:7:9:7:14 | ... call to &&(_:_:) ... | BinaryLogicalExpr, LogicalAndExpr |
You can’t perform that action at this time.
0 commit comments