refactor: lazy initialize implementation field for mutable methods

This commit is contained in:
oSumAtrIX 2022-04-06 19:37:29 +02:00
parent 1ee2e4ba56
commit bea0cbc550
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -13,7 +13,7 @@ class MutableMethod(method: Method) : Method, BaseMethodReference() {
private var returnType = method.returnType
// Create own mutable MethodImplementation (due to not being able to change members like register count)
private var implementation = method.implementation?.let { MutableMethodImplementation(it) }
private val _implementation by lazy { method.implementation?.let { MutableMethodImplementation(it) } }
private val _annotations by lazy { method.annotations.map { annotation -> annotation.toMutable() }.toMutableSet() }
private val _parameters by lazy { method.parameters.map { parameter -> parameter.toMutable() }.toMutableList() }
private val _parameterTypes by lazy { method.parameterTypes.toMutableList() }
@ -47,7 +47,7 @@ class MutableMethod(method: Method) : Method, BaseMethodReference() {
}
override fun getImplementation(): MutableMethodImplementation? {
return implementation
return _implementation
}
companion object {