[Wasm] Fix few things around assertions in stdlib

This commit is contained in:
Igor Laevsky
2022-04-27 21:27:09 +03:00
committed by teamcity
parent 6c54b78574
commit d46102b129
2 changed files with 3 additions and 3 deletions
@@ -159,7 +159,7 @@ class WasmSymbols(
val wasmRefCast = getInternalFunction("wasm_ref_cast")
val rangeCheck = getInternalFunction("rangeCheck")
val assertFuncs = findFunctions(kotlinTopLevelPackage.memberScope, Name.identifier("assert"))
val assertFuncs = findFunctions(kotlinTopLevelPackage.memberScope, Name.identifier("assert")).map { symbolTable.referenceSimpleFunction(it) }
val boxIntrinsic: IrSimpleFunctionSymbol = getInternalFunction("boxIntrinsic")
val unboxIntrinsic: IrSimpleFunctionSymbol = getInternalFunction("unboxIntrinsic")
@@ -5,10 +5,11 @@
package kotlin
// Note: codegen for these functions must be explicitly enabled with the -Xwasm-enable-asserts command line flag.
/**
* Throws an [AssertionError] if the [value] is false.
*/
@kotlin.internal.InlineOnly
public fun assert(value: Boolean) {
assert(value) { "Assertion failed" }
}
@@ -16,7 +17,6 @@ public fun assert(value: Boolean) {
/**
* Throws an [AssertionError] calculated by [lazyMessage] if the [value] is false.
*/
@kotlin.internal.InlineOnly
public fun assert(value: Boolean, lazyMessage: () -> Any) {
if (!value) {
val message = lazyMessage()