Adapt JS translator to new operator rem
This commit is contained in:
+9
-7
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2016 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -29,12 +29,12 @@ import org.jetbrains.kotlin.utils.identity as ID
|
|||||||
object LongOperationFIF : FunctionIntrinsicFactory {
|
object LongOperationFIF : FunctionIntrinsicFactory {
|
||||||
|
|
||||||
val LONG_EQUALS_ANY = pattern("Long.equals")
|
val LONG_EQUALS_ANY = pattern("Long.equals")
|
||||||
val LONG_BINARY_OPERATION_LONG = pattern("Long.compareTo|rangeTo|plus|minus|times|div|mod|and|or|xor(Long)")
|
val LONG_BINARY_OPERATION_LONG = pattern("Long.compareTo|rangeTo|plus|minus|times|div|mod|rem|and|or|xor(Long)")
|
||||||
val LONG_BIT_SHIFTS = pattern("Long.shl|shr|ushr(Int)")
|
val LONG_BIT_SHIFTS = pattern("Long.shl|shr|ushr(Int)")
|
||||||
val LONG_BINARY_OPERATION_INTEGER = pattern("Long.compareTo|rangeTo|plus|minus|times|div|mod(Int|Short|Byte)")
|
val LONG_BINARY_OPERATION_INTEGER = pattern("Long.compareTo|rangeTo|plus|minus|times|div|mod|rem(Int|Short|Byte)")
|
||||||
val LONG_BINARY_OPERATION_FLOATING_POINT = pattern("Long.compareTo|plus|minus|times|div|mod(Double|Float)")
|
val LONG_BINARY_OPERATION_FLOATING_POINT = pattern("Long.compareTo|plus|minus|times|div|mod|rem(Double|Float)")
|
||||||
val INTEGER_BINARY_OPERATION_LONG = pattern("Int|Short|Byte.compareTo|rangeTo|plus|minus|times|div|mod(Long)")
|
val INTEGER_BINARY_OPERATION_LONG = pattern("Int|Short|Byte.compareTo|rangeTo|plus|minus|times|div|mod|rem(Long)")
|
||||||
val FLOATING_POINT_BINARY_OPERATION_LONG = pattern("Double|Float.compareTo|plus|minus|times|div|mod(Long)")
|
val FLOATING_POINT_BINARY_OPERATION_LONG = pattern("Double|Float.compareTo|plus|minus|times|div|mod|rem(Long)")
|
||||||
|
|
||||||
private val longBinaryIntrinsics =
|
private val longBinaryIntrinsics =
|
||||||
(
|
(
|
||||||
@@ -47,6 +47,7 @@ object LongOperationFIF : FunctionIntrinsicFactory {
|
|||||||
"times" to "multiply",
|
"times" to "multiply",
|
||||||
"div" to "div",
|
"div" to "div",
|
||||||
"mod" to "modulo",
|
"mod" to "modulo",
|
||||||
|
"rem" to "modulo",
|
||||||
"shl" to "shiftLeft",
|
"shl" to "shiftLeft",
|
||||||
"shr" to "shiftRight",
|
"shr" to "shiftRight",
|
||||||
"ushr" to "shiftRightUnsigned",
|
"ushr" to "shiftRightUnsigned",
|
||||||
@@ -62,7 +63,8 @@ object LongOperationFIF : FunctionIntrinsicFactory {
|
|||||||
"minus" to BaseBinaryIntrinsic(::subtract),
|
"minus" to BaseBinaryIntrinsic(::subtract),
|
||||||
"times" to BaseBinaryIntrinsic(::mul),
|
"times" to BaseBinaryIntrinsic(::mul),
|
||||||
"div" to BaseBinaryIntrinsic(::div),
|
"div" to BaseBinaryIntrinsic(::div),
|
||||||
"mod" to BaseBinaryIntrinsic(::mod)
|
"mod" to BaseBinaryIntrinsic(::mod),
|
||||||
|
"rem" to BaseBinaryIntrinsic(::mod)
|
||||||
)
|
)
|
||||||
|
|
||||||
class BaseBinaryIntrinsic(val applyFun: (left: JsExpression, right: JsExpression) -> JsExpression) : FunctionIntrinsic() {
|
class BaseBinaryIntrinsic(val applyFun: (left: JsExpression, right: JsExpression) -> JsExpression) : FunctionIntrinsic() {
|
||||||
|
|||||||
Reference in New Issue
Block a user