6e6ffa12a6
- New module ":compiler:backend.wasm"
- Initial compiler infra (driver, phaser, context)
- Subset of Wasm AST
- Skeleton of IR -> Wasm AST
- Wasm AST -> WAT transformer
- Testing infra
- SpiderMonkey jsshell tool
46 lines
958 B
Kotlin
Vendored
46 lines
958 B
Kotlin
Vendored
// EXPECTED_REACHABLE_NODES: 1284
|
|
package foo
|
|
|
|
fun testShortConversions(c: Short): Boolean {
|
|
if (c.toDouble() != 3.0) {
|
|
return false
|
|
}
|
|
if (c.toFloat() != 3.toFloat()) {
|
|
return false
|
|
}
|
|
if (c.toByte() != 3.toByte()) {
|
|
return false
|
|
}
|
|
if (c.toInt() != 3) {
|
|
return false
|
|
}
|
|
if (c.toShort() != 3.toShort()) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
fun testByteConversions(c: Byte): Boolean {
|
|
if (c.toDouble() != 3.0) {
|
|
return false
|
|
}
|
|
if (c.toFloat() != 3.toFloat()) {
|
|
return false
|
|
}
|
|
if (c.toByte() != 3.toByte()) {
|
|
return false
|
|
}
|
|
if (c.toInt() != 3) {
|
|
return false
|
|
}
|
|
if (c.toShort() != 3.toShort()) {
|
|
return false
|
|
}
|
|
return true
|
|
}
|
|
|
|
fun box(): String {
|
|
if (!testShortConversions(3)) return "fail: testShortConversions"
|
|
if (!testByteConversions(3)) return "fail: testByteConversions"
|
|
return "OK"
|
|
} |