Roman Elizarov | 44e3ba5 | 2017-08-01 22:01:31 -0700 | [diff] [blame] | 1 | /* |
Roman Elizarov | 1f74a2d | 2018-06-29 19:19:45 +0300 | [diff] [blame^] | 2 | * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
Roman Elizarov | 44e3ba5 | 2017-08-01 22:01:31 -0700 | [diff] [blame] | 3 | */ |
| 4 | |
| 5 | package kotlinx.coroutines.experimental.quasar |
| 6 | |
| 7 | import co.paralleluniverse.fibers.instrument.MethodDatabase |
| 8 | import co.paralleluniverse.fibers.instrument.SuspendableClassifier |
| 9 | |
| 10 | /** |
| 11 | * @suppress **Internal implementation**. |
| 12 | */ |
| 13 | class KotlinSuspendableClassifier : SuspendableClassifier { |
| 14 | override fun isSuspendable( |
| 15 | db: MethodDatabase, |
| 16 | sourceName: String?, |
| 17 | sourceDebugInfo: String?, |
| 18 | isInterface: Boolean, |
| 19 | className: String?, |
| 20 | superClassName: String?, |
| 21 | interfaces: Array<out String>, |
| 22 | methodName: String, |
| 23 | methodDesc: String, |
| 24 | methodSignature: String?, |
| 25 | methodExceptions: Array<out String>? |
| 26 | ): MethodDatabase.SuspendableType? { |
| 27 | if (methodName == "run" && |
| 28 | methodDesc.startsWith("()") && |
| 29 | interfaces.contains("co/paralleluniverse/strands/SuspendableCallable")) |
| 30 | return MethodDatabase.SuspendableType.SUSPENDABLE |
| 31 | return null |
| 32 | } |
| 33 | } |