[JS IR BE] Fix @DoNotIntrinsify processing. Reuse it for compareTo
This commit is contained in:
@@ -134,8 +134,6 @@ class JsIntrinsics(private val irBuiltIns: IrBuiltIns, val context: JsIrBackendC
|
||||
val jsToString = getInternalFunction("toString")
|
||||
val jsAnyToString = getInternalFunction("anyToString")
|
||||
val jsCompareTo = getInternalFunction("compareTo")
|
||||
// TODO: Use annotations
|
||||
val compareToDoNotIntrinsicify = getInternalFunction("compareToDoNotIntrinsicify")
|
||||
val jsEquals = getInternalFunction("equals")
|
||||
|
||||
// Coroutines
|
||||
|
||||
+1
-5
@@ -343,7 +343,7 @@ class IntrinsicifyCallsLowering(private val context: JsIrBackendContext) : FileL
|
||||
}
|
||||
|
||||
override fun visitFunction(declaration: IrFunction): IrStatement {
|
||||
if (declaration.symbol == intrinsics.compareToDoNotIntrinsicify)
|
||||
if (declaration.hasAnnotation(intrinsics.doNotIntrinsifyAnnotationSymbol))
|
||||
return declaration
|
||||
return super.visitFunction(declaration)
|
||||
}
|
||||
@@ -355,10 +355,6 @@ class IntrinsicifyCallsLowering(private val context: JsIrBackendContext) : FileL
|
||||
val symbol = call.symbol
|
||||
val declaration = symbol.owner
|
||||
|
||||
if (declaration.annotations.any { it.superQualifierSymbol == intrinsics.doNotIntrinsifyAnnotationSymbol }) {
|
||||
return call
|
||||
}
|
||||
|
||||
if (declaration.isDynamic() || declaration.isEffectivelyExternal()) {
|
||||
when (call.origin) {
|
||||
IrStatementOrigin.GET_PROPERTY -> {
|
||||
|
||||
@@ -336,6 +336,12 @@ fun IrAnnotationContainer.hasAnnotation(name: FqName) =
|
||||
it.symbol.owner.parentAsClass.descriptor.fqNameSafe == name
|
||||
}
|
||||
|
||||
fun IrAnnotationContainer.hasAnnotation(symbol: IrClassSymbol) =
|
||||
annotations.any {
|
||||
it.symbol.owner.parentAsClass.symbol == symbol
|
||||
}
|
||||
|
||||
|
||||
val IrConstructor.constructedClassType get() = (parent as IrClass).thisReceiver?.type!!
|
||||
|
||||
fun IrFunction.isFakeOverriddenFromAny(): Boolean {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun box(): String {
|
||||
|
||||
Reference in New Issue
Block a user