Add operator modifier by inspection on idea module
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2019 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.
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,7 @@ import com.intellij.debugger.streams.trace.impl.handler.type.ArrayType
|
||||
class KotlinArrayVariable(override val type: ArrayType, override val name: String) : VariableImpl(type, name), ArrayVariable {
|
||||
override fun get(index: Expression): Expression = TextExpression("$name[${index.toCode()}]!!")
|
||||
|
||||
override fun set(index: Expression, value: Expression): Expression = TextExpression("$name[${index.toCode()}] = ${value.toCode()}")
|
||||
override operator fun set(index: Expression, value: Expression): Expression = TextExpression("$name[${index.toCode()}] = ${value.toCode()}")
|
||||
|
||||
override fun defaultDeclaration(size: Expression): VariableDeclaration =
|
||||
KotlinVariableDeclaration(this, false, type.sizedDeclaration(size.toCode()))
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2000-2019 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.
|
||||
*/
|
||||
|
||||
@@ -12,8 +12,8 @@ import com.intellij.debugger.streams.trace.dsl.impl.VariableImpl
|
||||
import com.intellij.debugger.streams.trace.impl.handler.type.ListType
|
||||
|
||||
class KotlinListVariable(override val type: ListType, name: String) : VariableImpl(type, name), ListVariable {
|
||||
override fun get(index: Expression): Expression = call("get", index)
|
||||
override fun set(index: Expression, newValue: Expression): Expression = call("set", index, newValue)
|
||||
override operator fun get(index: Expression): Expression = call("get", index)
|
||||
override operator fun set(index: Expression, newValue: Expression): Expression = call("set", index, newValue)
|
||||
override fun add(element: Expression): Expression = call("add", element)
|
||||
|
||||
override fun contains(element: Expression): Expression = call("contains", element)
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2000-2019 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.
|
||||
*/
|
||||
|
||||
@@ -13,9 +13,9 @@ import com.intellij.debugger.streams.trace.dsl.impl.common.MapVariableBase
|
||||
import com.intellij.debugger.streams.trace.impl.handler.type.MapType
|
||||
|
||||
class KotlinMapVariable(type: MapType, name: String) : MapVariableBase(type, name) {
|
||||
override fun get(key: Expression): Expression = this.call("getValue", key)
|
||||
override operator fun get(key: Expression): Expression = this.call("getValue", key)
|
||||
|
||||
override fun set(key: Expression, newValue: Expression): Expression =
|
||||
override operator fun set(key: Expression, newValue: Expression): Expression =
|
||||
TextExpression("${toCode()}[${key.toCode()}] = ${newValue.toCode()}")
|
||||
|
||||
override fun contains(key: Expression): Expression = TextExpression("(${key.toCode()} in ${toCode()})")
|
||||
|
||||
Reference in New Issue
Block a user