[JS IR] Add property name to boolean in externals diagnostic
This commit is contained in:
+3
-1
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
|||||||
import org.jetbrains.kotlin.ir.expressions.IrBody
|
import org.jetbrains.kotlin.ir.expressions.IrBody
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrCall
|
import org.jetbrains.kotlin.ir.expressions.IrCall
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||||
|
import org.jetbrains.kotlin.ir.interpreter.toIrConst
|
||||||
import org.jetbrains.kotlin.ir.util.isEffectivelyExternal
|
import org.jetbrains.kotlin.ir.util.isEffectivelyExternal
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
||||||
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
||||||
@@ -77,7 +78,8 @@ class BooleanPropertyInExternalLowering(
|
|||||||
val call = JsIrBuilder.buildCall(
|
val call = JsIrBuilder.buildCall(
|
||||||
target = function!!
|
target = function!!
|
||||||
).apply {
|
).apply {
|
||||||
putValueArgument(0, irGet(tmp))
|
putValueArgument(0, property.name.identifier.toIrConst(context.irBuiltIns.stringType))
|
||||||
|
putValueArgument(1, irGet(tmp))
|
||||||
}
|
}
|
||||||
|
|
||||||
+call
|
+call
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ import JsError
|
|||||||
@JsName("Boolean")
|
@JsName("Boolean")
|
||||||
internal external fun nativeBoolean(obj: Any?): Boolean
|
internal external fun nativeBoolean(obj: Any?): Boolean
|
||||||
|
|
||||||
internal fun booleanInExternalLog(obj: dynamic) {
|
internal fun booleanInExternalLog(name: String, obj: dynamic) {
|
||||||
if (jsTypeOf(obj) != "boolean") {
|
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") {
|
if (jsTypeOf(obj) != "boolean") {
|
||||||
throw JsError("Boolean expected, but actual: $obj")
|
throw JsError("Boolean expected for '$name', but actual: $obj")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user