Kotlin: extract suspend modifier and handle suspend SAM conversions

This commit is contained in:
Tamas Vajk
2022-09-19 13:11:49 +02:00
parent 3e58605e8e
commit a6e44ed1cf
7 changed files with 103 additions and 9 deletions

View File

@@ -67,6 +67,9 @@ abstract class Modifiable extends Element {
/** Holds if this element has an `inline` modifier. */
predicate isInline() { this.hasModifier("inline") }
/** Holds if this element has a `suspend` modifier. */
predicate isSuspend() { this.hasModifier("suspend") }
/** Holds if this element has a `volatile` modifier. */
predicate isVolatile() { this.hasModifier("volatile") }

View File

@@ -18,3 +18,5 @@
| localFunction.kt:13:32:13:38 | taint(...) | localFunction.kt:13:21:13:39 | fn4(...) |
| samConversion.kt:11:37:11:43 | taint(...) | samConversion.kt:14:24:14:29 | go(...) |
| samConversion.kt:15:34:15:40 | taint(...) | samConversion.kt:15:24:15:41 | go(...) |
| samConversion.kt:17:41:17:47 | taint(...) | samConversion.kt:20:24:20:29 | go(...) |
| samConversion.kt:21:34:21:40 | taint(...) | samConversion.kt:21:24:21:41 | go(...) |

View File

@@ -6265,6 +6265,58 @@ samConversion.kt:
# 57| 5: [BlockStmt] { ... }
# 58| 0: [LocalVariableDeclStmt] var ...;
# 58| 1: [LocalVariableDeclExpr] i0
# 58| 0: [CastExpr] (...)...
# 58| 0: [TypeAccess] InterfaceFn1Sus
# 58| 1: [ClassInstanceExpr] new (...)
# 58| -4: [AnonymousClass] new InterfaceFn1Sus(...) { ... }
# 58| 1: [Constructor]
#-----| 4: (Parameters)
# 58| 0: [Parameter] <fn>
# 58| 5: [BlockStmt] { ... }
# 58| 0: [SuperConstructorInvocationStmt] super(...)
# 58| 1: [ExprStmt] <Expr>;
# 58| 0: [AssignExpr] ...=...
# 58| 0: [VarAccess] this.<fn>
# 58| -1: [ThisAccess] this
# 58| 1: [VarAccess] <fn>
# 58| 2: [FieldDeclaration] Function2<Integer,Integer,Unit> <fn>;
# 58| -1: [TypeAccess] Function2<Integer,Integer,Unit>
# 58| 0: [TypeAccess] Integer
# 58| 1: [TypeAccess] Integer
# 58| 2: [TypeAccess] Unit
# 58| 3: [Method] fn1
# 58| 3: [TypeAccess] Unit
#-----| 4: (Parameters)
# 58| 0: [Parameter] i
# 58| 0: [TypeAccess] int
# 58| 1: [Parameter] j
# 58| 0: [TypeAccess] int
# 58| 5: [BlockStmt] { ... }
# 58| 0: [ReturnStmt] return ...
# 58| 0: [MethodAccess] invoke(...)
# 58| -1: [VarAccess] <fn>
# 58| 0: [VarAccess] i
# 58| 1: [VarAccess] j
# 58| -3: [TypeAccess] InterfaceFn1Sus
# 58| 0: [LambdaExpr] ...->...
# 58| -4: [AnonymousClass] new Function2<Integer,Integer,Unit>(...) { ... }
# 58| 1: [Constructor]
# 58| 5: [BlockStmt] { ... }
# 58| 0: [SuperConstructorInvocationStmt] super(...)
# 58| 2: [Method] invoke
# 58| 3: [TypeAccess] Unit
#-----| 4: (Parameters)
# 58| 0: [Parameter] a
# 58| 0: [TypeAccess] int
# 58| 1: [Parameter] b
# 58| 0: [TypeAccess] int
# 58| 5: [BlockStmt] { ... }
# 58| 0: [ExprStmt] <Expr>;
# 58| 0: [VarAccess] INSTANCE
# 58| -3: [TypeAccess] Function2<Integer,Integer,Unit>
# 58| 0: [TypeAccess] Integer
# 58| 1: [TypeAccess] Integer
# 58| 2: [TypeAccess] Unit
# 59| 1: [ExprStmt] <Expr>;
# 59| 0: [MethodAccess] fn1(...)
# 59| -1: [VarAccess] i0

View File

@@ -3919,6 +3919,34 @@
| samConversion.kt:54:29:54:34 | int | file://:0:0:0:0 | <none> | TypeAccess |
| samConversion.kt:57:9:60:1 | Unit | file://:0:0:0:0 | <none> | TypeAccess |
| samConversion.kt:58:5:58:45 | i0 | samConversion.kt:57:9:60:1 | test | LocalVariableDeclExpr |
| samConversion.kt:58:14:58:45 | (...)... | samConversion.kt:57:9:60:1 | test | CastExpr |
| samConversion.kt:58:14:58:45 | ...=... | samConversion.kt:58:14:58:45 | | AssignExpr |
| samConversion.kt:58:14:58:45 | <fn> | samConversion.kt:58:14:58:45 | | VarAccess |
| samConversion.kt:58:14:58:45 | <fn> | samConversion.kt:58:14:58:45 | fn1 | VarAccess |
| samConversion.kt:58:14:58:45 | Function2<Integer,Integer,Unit> | file://:0:0:0:0 | <none> | TypeAccess |
| samConversion.kt:58:14:58:45 | Integer | file://:0:0:0:0 | <none> | TypeAccess |
| samConversion.kt:58:14:58:45 | Integer | file://:0:0:0:0 | <none> | TypeAccess |
| samConversion.kt:58:14:58:45 | InterfaceFn1Sus | samConversion.kt:57:9:60:1 | test | TypeAccess |
| samConversion.kt:58:14:58:45 | InterfaceFn1Sus | samConversion.kt:57:9:60:1 | test | TypeAccess |
| samConversion.kt:58:14:58:45 | Unit | file://:0:0:0:0 | <none> | TypeAccess |
| samConversion.kt:58:14:58:45 | Unit | file://:0:0:0:0 | <none> | TypeAccess |
| samConversion.kt:58:14:58:45 | i | samConversion.kt:58:14:58:45 | fn1 | VarAccess |
| samConversion.kt:58:14:58:45 | int | file://:0:0:0:0 | <none> | TypeAccess |
| samConversion.kt:58:14:58:45 | int | file://:0:0:0:0 | <none> | TypeAccess |
| samConversion.kt:58:14:58:45 | invoke(...) | samConversion.kt:58:14:58:45 | fn1 | MethodAccess |
| samConversion.kt:58:14:58:45 | j | samConversion.kt:58:14:58:45 | fn1 | VarAccess |
| samConversion.kt:58:14:58:45 | new (...) | samConversion.kt:57:9:60:1 | test | ClassInstanceExpr |
| samConversion.kt:58:14:58:45 | this | samConversion.kt:58:14:58:45 | | ThisAccess |
| samConversion.kt:58:14:58:45 | this.<fn> | samConversion.kt:58:14:58:45 | | VarAccess |
| samConversion.kt:58:30:58:45 | ...->... | samConversion.kt:57:9:60:1 | test | LambdaExpr |
| samConversion.kt:58:30:58:45 | Function2<Integer,Integer,Unit> | samConversion.kt:57:9:60:1 | test | TypeAccess |
| samConversion.kt:58:30:58:45 | Integer | samConversion.kt:57:9:60:1 | test | TypeAccess |
| samConversion.kt:58:30:58:45 | Integer | samConversion.kt:57:9:60:1 | test | TypeAccess |
| samConversion.kt:58:30:58:45 | Unit | file://:0:0:0:0 | <none> | TypeAccess |
| samConversion.kt:58:30:58:45 | Unit | samConversion.kt:57:9:60:1 | test | TypeAccess |
| samConversion.kt:58:32:58:32 | int | file://:0:0:0:0 | <none> | TypeAccess |
| samConversion.kt:58:35:58:35 | int | file://:0:0:0:0 | <none> | TypeAccess |
| samConversion.kt:58:40:58:43 | INSTANCE | samConversion.kt:58:30:58:45 | invoke | VarAccess |
| samConversion.kt:59:5:59:6 | i0 | samConversion.kt:57:9:60:1 | test | VarAccess |
| samConversion.kt:59:8:59:15 | fn1(...) | samConversion.kt:57:9:60:1 | test | MethodAccess |
| samConversion.kt:59:12:59:12 | 1 | samConversion.kt:57:9:60:1 | test | IntegerLiteral |

View File

@@ -26,6 +26,7 @@ lambdaExpr
| samConversion.kt:11:12:13:5 | ...->... | stmt body | samConversion.kt:11:12:13:5 | invoke | invoke(int) | samConversion.kt:11:12:13:5 | new Function1<Integer,Boolean>(...) { ... } |
| samConversion.kt:43:31:45:68 | ...->... | stmt body | samConversion.kt:43:31:45:68 | invoke | invoke(int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int) | samConversion.kt:43:31:45:68 | new FunctionN<Boolean>(...) { ... } |
| samConversion.kt:46:32:46:44 | ...->... | stmt body | samConversion.kt:46:32:46:44 | invoke | invoke(int) | samConversion.kt:46:32:46:44 | new Function1<Integer,Boolean>(...) { ... } |
| samConversion.kt:58:30:58:45 | ...->... | stmt body | samConversion.kt:58:30:58:45 | invoke | invoke(int,int) | samConversion.kt:58:30:58:45 | new Function2<Integer,Integer,Unit>(...) { ... } |
memberRefExprs
| funcExprs.kt:38:26:38:38 | ...::... | funcExprs.kt:38:26:38:38 | invoke | invoke() | funcExprs.kt:38:26:38:38 | new Function0<Integer>(...) { ... } |
| funcExprs.kt:39:26:39:36 | ...::... | funcExprs.kt:39:26:39:36 | invoke | invoke() | funcExprs.kt:39:26:39:36 | new Function0<Integer>(...) { ... } |
@@ -60,10 +61,10 @@ modifiers
| funcExprs.kt:36:29:36:117 | ...->... | funcExprs.kt:36:29:36:117 | invoke | public |
| funcExprs.kt:75:12:75:22 | ...->... | funcExprs.kt:75:12:75:22 | invoke | override, public |
| funcExprs.kt:83:31:83:51 | ...->... | funcExprs.kt:83:31:83:51 | invoke | override, public |
| funcExprs.kt:86:39:86:59 | ...->... | funcExprs.kt:86:39:86:59 | invoke | override, public |
| funcExprs.kt:86:39:86:59 | ...->... | funcExprs.kt:86:39:86:59 | invoke | override, public, suspend |
| funcExprs.kt:90:15:90:69 | ...->... | funcExprs.kt:90:15:90:69 | invoke | override, public |
| funcExprs.kt:90:15:90:69 | ...->... | funcExprs.kt:90:15:90:69 | invoke | public |
| funcExprs.kt:94:15:94:67 | ...->... | funcExprs.kt:94:15:94:67 | invoke | override, public |
| funcExprs.kt:94:15:94:67 | ...->... | funcExprs.kt:94:15:94:67 | invoke | override, public, suspend |
| samConversion.kt:2:31:2:45 | ...->... | samConversion.kt:2:31:2:45 | invoke | override, public |
| samConversion.kt:4:27:4:42 | ...->... | samConversion.kt:4:27:4:42 | invoke | override, public |
| samConversion.kt:7:29:7:46 | ...->... | samConversion.kt:7:29:7:46 | invoke | override, public |
@@ -72,6 +73,7 @@ modifiers
| samConversion.kt:43:31:45:68 | ...->... | samConversion.kt:43:31:45:68 | invoke | override, public |
| samConversion.kt:43:31:45:68 | ...->... | samConversion.kt:43:31:45:68 | invoke | public |
| samConversion.kt:46:32:46:44 | ...->... | samConversion.kt:46:32:46:44 | invoke | override, public |
| samConversion.kt:58:30:58:45 | ...->... | samConversion.kt:58:30:58:45 | invoke | override, public, suspend |
nonOverrideInvoke
| funcExprs.kt:36:29:36:117 | ...->... | funcExprs.kt:36:29:36:117 | invoke | 23 |
| funcExprs.kt:90:15:90:69 | ...->... | funcExprs.kt:90:15:90:69 | invoke | 23 |

View File

@@ -36,7 +36,7 @@ methods
| methods5.kt:0:0:0:0 | Methods5Kt | methods5.kt:3:1:11:1 | x | x() | public, static | |
| methods5.kt:5:3:5:27 | | methods5.kt:5:3:5:27 | a | a(int) | public | |
| methods5.kt:9:3:9:32 | | methods5.kt:9:3:9:32 | f1 | f1(foo.bar.C1,int) | public | |
| methods6.kt:0:0:0:0 | Methods6Kt | methods6.kt:3:9:4:1 | s | s() | public, static | |
| methods6.kt:0:0:0:0 | Methods6Kt | methods6.kt:3:9:4:1 | s | s() | public, static, suspend | |
| methods.kt:0:0:0:0 | MethodsKt | methods.kt:2:1:3:1 | topLevelMethod | topLevelMethod(int,int) | public, static | |
| methods.kt:5:1:20:1 | Class | methods.kt:6:5:7:5 | classMethod | classMethod(int,int) | public | |
| methods.kt:5:1:20:1 | Class | methods.kt:9:5:12:5 | anotherClassMethod | anotherClassMethod(int,int) | public | |