A nicer workaround for JS compiler wrong function name bug
This commit is contained in:
1 parent
5d61858f81
commit
e997c18d1d
8 files changed
+38
-28
No files matched your search
-3
@@ -18,9 +18,6 @@ fun ClassDefinition.defineHashFunctions() {
|
||||
"crypto_hash_sha256_state"
|
||||
)
|
||||
+funcDef(
|
||||
"crypto_hash_sha256_init_spec",
|
||||
"crypto_hash_sha256_init",
|
||||
"crypto_hash_sha256_init",
|
||||
"crypto_hash_sha256_init",
|
||||
CustomTypeDefinition(ClassName(packageName, "Sha256State")),
|
||||
dynamicJsReturn = true,
|
||||
|
||||
+7
-2
@@ -85,8 +85,13 @@ object JsLibsodiumGenerator {
|
||||
constructJsCall.append(paramsToString(methodDefinition))
|
||||
}
|
||||
is CustomTypeDefinition -> {
|
||||
constructJsCall.append("return getSodium().${methodDefinition.jsName}")
|
||||
constructJsCall.append(paramsToString(methodDefinition))
|
||||
if (methodDefinition.parameterList.filter { it.isStateType.not() }.size > 0) {
|
||||
constructJsCall.append("return getSodium().${methodDefinition.jsName}")
|
||||
constructJsCall.append(paramsToString(methodDefinition))
|
||||
} else {
|
||||
constructJsCall.append("val result = js(\"getSodium().${methodDefinition.jsName}()\")")
|
||||
constructJsCall.append("\nreturn result")
|
||||
}
|
||||
}
|
||||
}
|
||||
methodBuilder.addStatement(constructJsCall.toString())
|
||||
|
||||
Reference in new issue
Block a user