Create basic version of FIR interfaces (mostly declarations)

#KT-24014 Fixed
This commit is contained in:
Mikhail Glukhikh
2018-03-13 20:28:34 +03:00
parent 0f02622e32
commit 4755a494f1
42 changed files with 501 additions and 1 deletions
@@ -5,4 +5,10 @@
package org.jetbrains.kotlin.fir
interface FirElement
import com.intellij.psi.PsiElement
interface FirElement {
val psi: PsiElement?
val session: FirSession
}
@@ -0,0 +1,8 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir
interface FirSession
@@ -0,0 +1,12 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
// Probably not a function
@Deprecated("May be not needed")
interface FirAnonymousInitializer : FirDeclarationWithBody {
}
@@ -0,0 +1,13 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.fir.types.FirType
// Good name needed (something with receiver, type parameters, return type, and name)
interface FirCallableMember : FirMemberDeclaration, FirTypedDeclaration {
val receiverType: FirType
}
@@ -0,0 +1,20 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.fir.types.FirType
interface FirClass : FirDeclarationContainer, FirMemberDeclaration {
// including delegated types
val superTypes: List<FirType>
val classKind: ClassKind
val isCompanion: Boolean
val isData: Boolean
}
@@ -0,0 +1,12 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.fir.expressions.FirConstructorCall
interface FirConstructor : FirFunction {
val delegatedConstructor: FirConstructorCall?
}
@@ -0,0 +1,10 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.fir.FirElement
interface FirDeclaration : FirElement
@@ -0,0 +1,12 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
interface FirDeclarationContainer {
// May be only member declarations should be here
// ?: FirAnonymousInitializer
val declarations: List<FirDeclaration>
}
@@ -0,0 +1,12 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.fir.expressions.FirBody
interface FirDeclarationWithBody : FirDeclaration {
val body: FirBody
}
@@ -0,0 +1,12 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.fir.expressions.FirExpression
interface FirEnumEntry : FirClass {
val arguments: List<FirExpression>
}
@@ -0,0 +1,10 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
// Is it necessary?
interface FirErrorDeclaration : FirDeclaration {
}
@@ -0,0 +1,10 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
interface FirFile : FirPackageFragment {
val imports: List<FirImport>
}
@@ -0,0 +1,13 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.fir.expressions.FirAnnotationContainer
// May be should inherit FirTypeParameterContainer
interface FirFunction : FirDeclarationWithBody, FirAnnotationContainer {
val valueParameters: List<FirValueParameter>
}
@@ -0,0 +1,11 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.fir.FirElement
interface FirImport : FirElement {
}
@@ -0,0 +1,16 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.fir.expressions.FirAnnotationContainer
interface FirMemberDeclaration : FirTypeParameterContainer, FirNamedDeclaration, FirAnnotationContainer {
val visibility: Visibility
val modality: Modality
}
@@ -0,0 +1,12 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.name.Name
interface FirNamedDeclaration : FirDeclaration {
val name: Name
}
@@ -0,0 +1,9 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
interface FirNamedFunction : FirFunction, FirCallableMember {
}
@@ -0,0 +1,11 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.fir.FirElement
interface FirPackageFragment : FirElement, FirDeclarationContainer {
}
@@ -0,0 +1,19 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.fir.expressions.FirExpression
import org.jetbrains.kotlin.fir.expressions.FirVariable
// May be should not inherit FirVariable
interface FirProperty : FirCallableMember, FirVariable {
// Should it be nullable or have some default?
val getter: FirPropertyAccessor
val setter: FirPropertyAccessor
val delegate: FirExpression?
}
@@ -0,0 +1,14 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.descriptors.Visibility
interface FirPropertyAccessor : FirFunction {
val isGetter: Boolean
val visibility: Visibility
}
@@ -0,0 +1,13 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.fir.expressions.FirAnnotationContainer
import org.jetbrains.kotlin.fir.types.FirType
interface FirTypeAlias : FirMemberDeclaration, FirAnnotationContainer {
val abbreviatedType: FirType
}
@@ -0,0 +1,16 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.fir.expressions.FirAnnotationContainer
import org.jetbrains.kotlin.fir.types.FirType
import org.jetbrains.kotlin.types.Variance
interface FirTypeParameter : FirNamedDeclaration, FirAnnotationContainer {
val variance: Variance
val bounds: List<FirType>
}
@@ -0,0 +1,10 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
interface FirTypeParameterContainer {
val typeParameters: List<FirTypeParameter>
}
@@ -0,0 +1,13 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.fir.expressions.FirAnnotationContainer
import org.jetbrains.kotlin.fir.types.FirType
interface FirTypedDeclaration : FirDeclaration, FirAnnotationContainer {
val returnType: FirType
}
@@ -0,0 +1,18 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.declarations
import org.jetbrains.kotlin.fir.expressions.FirExpression
interface FirValueParameter : FirTypedDeclaration, FirNamedDeclaration {
val isCrossinline: Boolean
val isNoinline: Boolean
val isVararg: Boolean
val defaultValue: FirExpression?
}
@@ -0,0 +1,15 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.expressions
import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget
import org.jetbrains.kotlin.fir.types.FirType
interface FirAnnotationCall : FirCall {
val annotationType: FirType
val useSiteTarget: AnnotationUseSiteTarget
}
@@ -0,0 +1,10 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.expressions
interface FirAnnotationContainer {
val annotations: List<FirAnnotationCall>
}
@@ -0,0 +1,11 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.expressions
// Should we have FirBlockBody / FirExpressionBody?
interface FirBody {
val statements: List<FirStatement>
}
@@ -0,0 +1,10 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.expressions
interface FirCall : FirExpression {
val arguments: List<FirExpression>
}
@@ -0,0 +1,12 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.expressions
import org.jetbrains.kotlin.fir.types.FirType
interface FirConstructorCall : FirCall {
val constructedType: FirType
}
@@ -0,0 +1,9 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.expressions
interface FirExpression : FirStatement {
}
@@ -0,0 +1,11 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.expressions
import org.jetbrains.kotlin.fir.FirElement
interface FirStatement : FirElement {
}
@@ -0,0 +1,13 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.expressions
import org.jetbrains.kotlin.fir.declarations.FirTypedDeclaration
import org.jetbrains.kotlin.fir.declarations.FirNamedDeclaration
interface FirVariable : FirTypedDeclaration, FirNamedDeclaration, FirStatement {
val initializer: FirExpression?
}
@@ -0,0 +1,12 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.types
import org.jetbrains.kotlin.fir.expressions.FirExpression
interface FirDelegatedType : FirExplicitType {
val delegate: FirExpression
}
@@ -0,0 +1,9 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.types
interface FirExplicitType : FirType, FirTypeProjectionContainer {
}
@@ -0,0 +1,9 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.types
interface FirImplicitType : FirType {
}
@@ -0,0 +1,12 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.types
import org.jetbrains.kotlin.types.KotlinType
interface FirResolvedType : FirType {
val type: KotlinType
}
@@ -0,0 +1,8 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.types
interface FirStarProjection : FirTypeProjection
@@ -0,0 +1,11 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.types
import org.jetbrains.kotlin.fir.FirElement
interface FirType : FirElement {
}
@@ -0,0 +1,12 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.types
import org.jetbrains.kotlin.fir.FirElement
interface FirTypeProjection : FirElement {
}
@@ -0,0 +1,10 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.types
interface FirTypeProjectionContainer {
val arguments: List<FirTypeProjection>
}
@@ -0,0 +1,14 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. 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.fir.types
import org.jetbrains.kotlin.types.Variance
interface FirTypeProjectionWithVariance {
val variance: Variance
val type: FirType
}