Use computeIsAbsent instead of getOrPut in generated expression
This commit is contained in:
committed by
Yan Zhulanow
parent
fd17d9959a
commit
113bb9ca46
+1
-1
@@ -22,7 +22,7 @@ class KotlinMapVariable(type: MapType, name: String) : MapVariableBase(type, nam
|
|||||||
override fun keys(): Expression = TextExpression("${toCode()}.keys")
|
override fun keys(): Expression = TextExpression("${toCode()}.keys")
|
||||||
|
|
||||||
override fun computeIfAbsent(key: Expression, supplier: Lambda): Expression =
|
override fun computeIfAbsent(key: Expression, supplier: Lambda): Expression =
|
||||||
TextExpression("${toCode()}.getOrPut(${key.toCode()}, ${supplier.toCode()})")
|
TextExpression("${toCode()}.computeIfAbsent(${key.toCode()}, ${supplier.toCode()})")
|
||||||
|
|
||||||
override fun defaultDeclaration(isMutable: Boolean): VariableDeclaration =
|
override fun defaultDeclaration(isMutable: Boolean): VariableDeclaration =
|
||||||
KotlinVariableDeclaration(this, false, type.defaultValue)
|
KotlinVariableDeclaration(this, false, type.defaultValue)
|
||||||
|
|||||||
Reference in New Issue
Block a user