Refactor: allow to distinguish whether JvmMemberSignature is for field or for method

Introduce a method to create org.jetbrains.kotlin.load.kotlin.MemberSignature directly from JvmMemberSignature.
Create JvmFunctionSignature from JvmMemberSignature.
This commit is contained in:
Ilya Gorbunov
2018-05-27 18:42:30 +03:00
parent 36c658fd8b
commit 2f58539200
7 changed files with 59 additions and 24 deletions
@@ -6,5 +6,16 @@
package org.jetbrains.kotlin.metadata.jvm.deserialization
data class JvmMemberSignature(val name: String, val desc: String) {
override fun toString() = name + desc
/**
* Returns `true` when this signature represents a field.
*/
val isField: Boolean = desc.indexOf(")") < 0
/**
* Returns `true` when this signature represents a method.
*/
val isMethod: Boolean get() = !isField
override fun toString() = if (isField) name + ":" + desc else name + desc
}