[JS IR] Add property name to boolean in externals diagnostic

This commit is contained in:
Ilya Goncharov
2021-06-22 16:45:11 +03:00
committed by Space
parent 21a3494bca
commit 82f979b11f
2 changed files with 7 additions and 5 deletions
@@ -10,14 +10,14 @@ import JsError
@JsName("Boolean")
internal external fun nativeBoolean(obj: Any?): Boolean
internal fun booleanInExternalLog(obj: dynamic) {
internal fun booleanInExternalLog(name: String, obj: dynamic) {
if (jsTypeOf(obj) != "boolean") {
console.asDynamic().error("Boolean expected, but actual:", obj)
console.asDynamic().error("Boolean expected for '$name', but actual:", obj)
}
}
internal fun booleanInExternalException(obj: dynamic) {
internal fun booleanInExternalException(name: String, obj: dynamic) {
if (jsTypeOf(obj) != "boolean") {
throw JsError("Boolean expected, but actual: $obj")
throw JsError("Boolean expected for '$name', but actual: $obj")
}
}