blob: 64d3bf8197056a24b3ba94e538f20bd09b6a12c3 [file] [log] [blame]
Roman Elizarov44e3ba52017-08-01 22:01:31 -07001/*
Roman Elizarov1f74a2d2018-06-29 19:19:45 +03002 * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
Roman Elizarov44e3ba52017-08-01 22:01:31 -07003 */
4
5package kotlinx.coroutines.experimental.quasar
6
7import co.paralleluniverse.fibers.instrument.MethodDatabase
8import co.paralleluniverse.fibers.instrument.SuspendableClassifier
9
10/**
11 * @suppress **Internal implementation**.
12 */
13class 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}