[PSI] Add new Psi nodes representing contract effects list and each individual contract effect in the list

This commit is contained in:
Arsen Nagdalian
2020-07-15 13:31:12 +03:00
parent 4b7d34b537
commit e3fe9c3314
8 changed files with 110 additions and 0 deletions
@@ -64,6 +64,8 @@ public interface KtNodeTypes {
IElementType TYPE_ARGUMENT_LIST = KtStubElementTypes.TYPE_ARGUMENT_LIST;
IElementType VALUE_ARGUMENT_LIST = KtStubElementTypes.VALUE_ARGUMENT_LIST;
IElementType VALUE_ARGUMENT = KtStubElementTypes.VALUE_ARGUMENT;
IElementType CONTRACT_EFFECT_LIST = KtStubElementTypes.CONTRACT_EFFECT_LIST;
IElementType CONTRACT_EFFECT = KtStubElementTypes.CONTRACT_EFFECT;
IElementType LAMBDA_ARGUMENT = KtStubElementTypes.LAMBDA_ARGUMENT;
IElementType VALUE_ARGUMENT_NAME = KtStubElementTypes.VALUE_ARGUMENT_NAME;
IElementType TYPE_REFERENCE = KtStubElementTypes.TYPE_REFERENCE;
@@ -0,0 +1,19 @@
/*
* Copyright 2010-2020 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.
*/
package org.jetbrains.kotlin.psi
import com.intellij.lang.ASTNode
import org.jetbrains.kotlin.psi.stubs.KotlinContractEffectStub
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes
//class KtContractEffect(node: ASTNode) : KtDeclarationImpl(node) {
//
//}
class KtContractEffect: KtElementImplStub<KotlinContractEffectStub> { // TODO: check constructors
public constructor(node: ASTNode): super(node)
public constructor(stub: KotlinContractEffectStub): super(stub, KtStubElementTypes.CONTRACT_EFFECT)
}
@@ -0,0 +1,19 @@
/*
* Copyright 2010-2020 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.
*/
package org.jetbrains.kotlin.psi
import com.intellij.lang.ASTNode
import org.jetbrains.kotlin.psi.stubs.KotlinPlaceHolderStub
import org.jetbrains.kotlin.psi.stubs.elements.KtStubElementTypes
//class KtContractEffectList(node: ASTNode): KtDeclarationImpl(node) {
//
//}
class KtContractEffectList : KtElementImplStub<KotlinPlaceHolderStub<KtContractEffectList>> {
public constructor(node: ASTNode): super(node)
public constructor(stub: KotlinPlaceHolderStub<KtContractEffectList>): super(stub, KtStubElementTypes.CONTRACT_EFFECT_LIST)
}
@@ -64,6 +64,8 @@ interface KotlinValueArgumentStub<T : KtValueArgument> : KotlinPlaceHolderStub<T
fun isSpread(): Boolean
}
interface KotlinContractEffectStub : KotlinPlaceHolderStub<KtContractEffect> {}
interface KotlinAnnotationEntryStub : StubElement<KtAnnotationEntry> {
fun getShortName(): String?
fun hasValueArguments(): Boolean
@@ -0,0 +1,31 @@
/*
* Copyright 2010-2020 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.
*/
package org.jetbrains.kotlin.psi.stubs.elements
import com.intellij.psi.PsiElement
import com.intellij.psi.stubs.StubElement
import com.intellij.psi.stubs.StubInputStream
import com.intellij.psi.stubs.StubOutputStream
import org.jetbrains.kotlin.psi.KtContractEffect
import org.jetbrains.kotlin.psi.stubs.KotlinContractEffectStub
import org.jetbrains.kotlin.psi.stubs.impl.KotlinContractEffectStubImpl
class KtContractEffectElementType(debugName: String, psiClass: Class<KtContractEffect>) :
KtStubElementType<KotlinContractEffectStub, KtContractEffect>(debugName, psiClass, KotlinContractEffectStub::class.java) {
override fun serialize(stub: KotlinContractEffectStub, dataStream: StubOutputStream) {
// TODO("Not yet implemented")
}
override fun deserialize(dataStream: StubInputStream, parentStub: StubElement<PsiElement>?): KotlinContractEffectStub {
// TODO("Not yet implemented")
return KotlinContractEffectStubImpl(parentStub, this)
}
override fun createStub(psi: KtContractEffect, parentStub: StubElement<PsiElement>?): KotlinContractEffectStub {
// TODO("Not yet implemented")
return KotlinContractEffectStubImpl(parentStub, this)
}
}
@@ -0,0 +1,13 @@
/*
* Copyright 2010-2020 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.
*/
package org.jetbrains.kotlin.psi.stubs.elements
import com.intellij.lang.ASTNode
import org.jetbrains.kotlin.psi.KtContractEffectList
class KtContractEffectListElementType(debugName: String) :
KtPlaceHolderStubElementType<KtContractEffectList>(debugName, KtContractEffectList::class.java) {
}
@@ -107,6 +107,12 @@ public interface KtStubElementTypes {
KtValueArgumentElementType<KtValueArgument> VALUE_ARGUMENT =
new KtValueArgumentElementType<>("VALUE_ARGUMENT", KtValueArgument.class);
KtPlaceHolderStubElementType<KtContractEffectList> CONTRACT_EFFECT_LIST =
new KtContractEffectListElementType("CONTRACT_EFFECT_LIST");
KtContractEffectElementType CONTRACT_EFFECT =
new KtContractEffectElementType("CONTRACT_EFFECT", KtContractEffect.class);
KtValueArgumentElementType<KtLambdaArgument> LAMBDA_ARGUMENT =
new KtValueArgumentElementType<>("LAMBDA_ARGUMENT", KtLambdaArgument.class);
@@ -0,0 +1,18 @@
/*
* Copyright 2010-2020 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.
*/
package org.jetbrains.kotlin.psi.stubs.impl
import com.intellij.psi.PsiElement
import com.intellij.psi.stubs.StubElement
import org.jetbrains.kotlin.psi.KtContractEffect
import org.jetbrains.kotlin.psi.stubs.KotlinContractEffectStub
import org.jetbrains.kotlin.psi.stubs.elements.KtContractEffectElementType
class KotlinContractEffectStubImpl(
parent: StubElement<out PsiElement>?,
elementType: KtContractEffectElementType
) : KotlinPlaceHolderStubImpl<KtContractEffect>(parent, elementType), KotlinContractEffectStub {
}