File tree Expand file tree Collapse file tree 6 files changed +15
-29
lines changed
ql/lib/codeql/swift/elements/expr Expand file tree Collapse file tree 6 files changed +15
-29
lines changed Original file line number Diff line number Diff line change @@ -4,5 +4,5 @@ private import codeql.swift.elements.expr.MethodLookupExpr
4
4
predicate constructArgument ( Raw:: Argument id ) {
5
5
// exclude an argument that will be part of a SelfApplyExpr
6
6
// that will be transformed into a MethodLookupExpr
7
- not exists ( Raw:: SelfApplyExpr e | id . getExpr ( ) = e .getBase ( ) )
7
+ not exists ( Raw:: SelfApplyExpr e | id = e .getArgument ( 0 ) )
8
8
}
Original file line number Diff line number Diff line change
1
+ // generated by codegen/codegen.py, remove this comment if you wish to edit this file
1
2
private import codeql.swift.generated.Raw
2
- private import codeql.swift.elements.expr.MethodLookupExprConstructor
3
3
4
- predicate constructDeclRefExpr ( Raw:: DeclRefExpr id ) {
5
- // exclude an argument that will be part of a SelfApplyExpr
6
- // that will be transformed into a MethodLookupExpr
7
- not exists ( Raw:: SelfApplyExpr e | id .getDecl ( ) = extractDeclFromSelfApplyExpr ( e ) )
8
- }
4
+ predicate constructDeclRefExpr ( Raw:: DeclRefExpr id ) { any ( ) }
Original file line number Diff line number Diff line change 1
1
private import codeql.swift.generated.expr.MethodLookupExpr
2
2
private import codeql.swift.elements.expr.MethodLookupExprConstructor
3
3
private import codeql.swift.elements.expr.Expr
4
+ private import codeql.swift.elements.expr.DeclRefExpr
5
+ private import codeql.swift.elements.expr.OtherConstructorDeclRefExpr
4
6
private import codeql.swift.elements.decl.Decl
5
7
private import codeql.swift.elements.decl.MethodDecl
6
8
private import codeql.swift.generated.Raw
@@ -14,7 +16,13 @@ class MethodLookupExpr extends Generated::MethodLookupExpr {
14
16
}
15
17
16
18
override Decl getImmediateMember ( ) {
17
- result = Synth:: convertDeclFromRaw ( extractDeclFromSelfApplyExpr ( this .getUnderlying ( ) ) )
19
+ result = this .getMethodRef ( ) .( DeclRefExpr ) .getDecl ( )
20
+ or
21
+ result = this .getMethodRef ( ) .( OtherConstructorDeclRefExpr ) .getConstructorDecl ( )
22
+ }
23
+
24
+ override Expr getImmediateMethodRef ( ) {
25
+ result = Synth:: convertExprFromRaw ( this .getUnderlying ( ) .getFunction ( ) )
18
26
}
19
27
20
28
MethodDecl getMethod ( ) { result = this .getMember ( ) }
Original file line number Diff line number Diff line change 1
1
private import codeql.swift.generated.Raw
2
2
3
3
predicate constructMethodLookupExpr ( Raw:: SelfApplyExpr id ) { any ( ) }
4
-
5
- Raw:: Decl extractDeclFromSelfApplyExpr ( Raw:: SelfApplyExpr e ) {
6
- exists ( Raw:: Expr unwrappedFunction | unwrappedFunction = unwrapConversion * ( e .getFunction ( ) ) |
7
- result =
8
- [
9
- unwrappedFunction .( Raw:: DeclRefExpr ) .getDecl ( ) ,
10
- unwrappedFunction .( Raw:: OtherConstructorDeclRefExpr ) .getConstructorDecl ( )
11
- ]
12
- )
13
- }
14
-
15
- private Raw:: Expr unwrapConversion ( Raw:: Expr e ) {
16
- e .( Raw:: ImplicitConversionExpr ) .getSubExpr ( ) = result
17
- }
Original file line number Diff line number Diff line change
1
+ // generated by codegen/codegen.py, remove this comment if you wish to edit this file
1
2
private import codeql.swift.generated.Raw
2
- private import codeql.swift.elements.expr.MethodLookupExprConstructor
3
3
4
- predicate constructOtherConstructorDeclRefExpr ( Raw:: OtherConstructorDeclRefExpr id ) {
5
- // exclude an argument that will be part of a SelfApplyExpr
6
- // that will be transformed into a MethodLookupExpr
7
- not exists ( Raw:: SelfApplyExpr e | id .getConstructorDecl ( ) = extractDeclFromSelfApplyExpr ( e ) )
8
- }
4
+ predicate constructOtherConstructorDeclRefExpr ( Raw:: OtherConstructorDeclRefExpr id ) { any ( ) }
Original file line number Diff line number Diff line change @@ -677,7 +677,7 @@ class DotSyntaxCallExpr(SelfApplyExpr):
677
677
678
678
@synth .from_class (SelfApplyExpr )
679
679
class MethodLookupExpr (LookupExpr ):
680
- pass
680
+ method_ref : Expr | child | doc ( "the underlying method declaration reference expression" )
681
681
682
682
class DynamicMemberRefExpr (DynamicLookupExpr ):
683
683
pass
You can’t perform that action at this time.
0 commit comments