[compiler] replace Enum values() with entries
To fix warnings. Also, use of `Enum.entries` may improve the performance ^KT-48872
This commit is contained in:
committed by
Space Team
parent
ec167d4d42
commit
072d191306
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -281,7 +281,7 @@ class JsIntrinsics(private val irBuiltIns: IrBuiltIns, val context: JsIrBackendC
|
||||
val jsArrayIteratorFunction = getInternalFunction("arrayIterator")
|
||||
|
||||
val jsPrimitiveArrayIteratorFunctions =
|
||||
PrimitiveType.values().associate { it to getInternalFunction("${it.typeName.asString().toLowerCaseAsciiOnly()}ArrayIterator") }
|
||||
PrimitiveType.entries.associate { it to getInternalFunction("${it.typeName.asString().toLowerCaseAsciiOnly()}ArrayIterator") }
|
||||
|
||||
val jsClass = getInternalFunction("jsClassIntrinsic")
|
||||
val arrayLiteral: IrSimpleFunctionSymbol = getInternalFunction("arrayLiteral")
|
||||
@@ -321,14 +321,14 @@ class JsIntrinsics(private val irBuiltIns: IrBuiltIns, val context: JsIrBackendC
|
||||
)
|
||||
|
||||
val primitiveToSizeConstructor =
|
||||
PrimitiveType.values().associate { type ->
|
||||
PrimitiveType.entries.associate { type ->
|
||||
type to (primitiveToTypedArrayMap[type]?.let {
|
||||
getInternalFunction("${it.toLowerCaseAsciiOnly()}Array")
|
||||
} ?: getInternalFunction("${type.typeName.asString().toLowerCaseAsciiOnly()}Array"))
|
||||
}
|
||||
|
||||
val primitiveToLiteralConstructor =
|
||||
PrimitiveType.values().associate { type ->
|
||||
PrimitiveType.entries.associate { type ->
|
||||
type to (primitiveToTypedArrayMap[type]?.let {
|
||||
getInternalFunction("${it.toLowerCaseAsciiOnly()}ArrayOf")
|
||||
} ?: getInternalFunction("${type.typeName.asString().toLowerCaseAsciiOnly()}ArrayOf"))
|
||||
|
||||
+6
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@@ -276,10 +276,10 @@ private class JsIrAstDeserializer(private val source: ByteArray) {
|
||||
}
|
||||
}
|
||||
|
||||
private val sideEffectKindValues = SideEffectKind.values()
|
||||
private val jsBinaryOperatorValues = JsBinaryOperator.values()
|
||||
private val jsUnaryOperatorValues = JsUnaryOperator.values()
|
||||
private val jsFunctionModifiersValues = JsFunction.Modifier.values()
|
||||
private val sideEffectKindValues get() = SideEffectKind.entries
|
||||
private val jsBinaryOperatorValues get() = JsBinaryOperator.entries
|
||||
private val jsUnaryOperatorValues get() = JsUnaryOperator.entries
|
||||
private val jsFunctionModifiersValues get() = JsFunction.Modifier.entries
|
||||
|
||||
private fun readExpression(): JsExpression {
|
||||
return withComments {
|
||||
@@ -450,7 +450,7 @@ private class JsIrAstDeserializer(private val source: ByteArray) {
|
||||
}
|
||||
}
|
||||
|
||||
private val specialFunctionValues = SpecialFunction.values()
|
||||
private val specialFunctionValues get() = SpecialFunction.entries
|
||||
|
||||
private fun readName(): JsName {
|
||||
val identifier = stringTable[readInt()]
|
||||
|
||||
Reference in New Issue
Block a user