Redo IrSymbol as a light-weight declaration reference

Strip it of any "useful" information but a reference to the corresponding
symbol owner (file or a declaration).
TODO: add that useful information to declarations.

NB not all IrDeclarations have IrSymbols (IrProperty doesn't - at least now).
This commit is contained in:
Dmitry Petrov
2017-03-21 11:56:19 +03:00
parent b817638851
commit f96a21e899
56 changed files with 221 additions and 950 deletions
@@ -18,9 +18,9 @@ package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
import org.jetbrains.kotlin.ir.expressions.IrBody
import org.jetbrains.kotlin.ir.symbols.IrAnonymousInitializerSymbol
interface IrAnonymousInitializer : IrDeclaration {
interface IrAnonymousInitializer : IrSymbolDeclaration<IrAnonymousInitializerSymbol> {
override val descriptor: ClassDescriptor // TODO special descriptor for anonymous initializer blocks
override val declarationKind: IrDeclarationKind
@@ -17,8 +17,9 @@
package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
interface IrClass : IrDeclaration, IrDeclarationContainer, IrTypeParametersContainer {
interface IrClass : IrSymbolDeclaration<IrClassSymbol>, IrDeclarationContainer, IrTypeParametersContainer {
override val declarationKind: IrDeclarationKind
get() = IrDeclarationKind.CLASS
@@ -17,9 +17,10 @@
package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
interface IrConstructor : IrFunction {
interface IrConstructor : IrFunction, IrSymbolDeclaration<IrConstructorSymbol> {
override val declarationKind: IrDeclarationKind
get() = IrDeclarationKind.CONSTRUCTOR
@@ -17,9 +17,15 @@
package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.IrStatement
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
interface IrSymbolOwner : IrElement {
val symbol: IrSymbol
}
interface IrDeclaration : IrStatement {
val descriptor: DeclarationDescriptor
val declarationKind: IrDeclarationKind
@@ -29,6 +35,10 @@ interface IrDeclaration : IrStatement {
accept(transformer, data) as IrStatement
}
interface IrSymbolDeclaration<out S : IrSymbol> : IrDeclaration, IrSymbolOwner {
override val symbol: S
}
enum class IrDeclarationKind {
MODULE,
FILE,
@@ -18,8 +18,9 @@ package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol
interface IrEnumEntry : IrDeclaration {
interface IrEnumEntry : IrSymbolDeclaration<IrEnumEntrySymbol> {
override val declarationKind: IrDeclarationKind get() = IrDeclarationKind.ENUM_ENTRY
override val descriptor: ClassDescriptor
@@ -21,10 +21,13 @@ import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
import org.jetbrains.kotlin.descriptors.annotations.checkAnnotationName
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.SourceManager
import org.jetbrains.kotlin.ir.symbols.IrFileSymbol
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.name.FqName
interface IrFile : IrElement, IrDeclarationContainer {
interface IrFile : IrElement, IrDeclarationContainer, IrSymbolOwner {
override val symbol: IrFileSymbol
val fileEntry: SourceManager.FileEntry
val fileAnnotations: MutableList<AnnotationDescriptor>
val packageFragmentDescriptor: PackageFragmentDescriptor
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.ir.expressions.IrBody
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
interface IrFunction : IrDeclaration, IrTypeParametersContainer {
override val descriptor: FunctionDescriptor
@@ -32,7 +33,7 @@ interface IrFunction : IrDeclaration, IrTypeParametersContainer {
}
interface IrSimpleFunction : IrFunction {
interface IrSimpleFunction : IrFunction, IrSymbolDeclaration<IrSimpleFunctionSymbol> {
override val declarationKind: IrDeclarationKind
get() = IrDeclarationKind.FUNCTION
}
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
interface IrProperty : IrDeclaration {
override val descriptor: PropertyDescriptor
@@ -31,7 +32,7 @@ interface IrProperty : IrDeclaration {
get() = IrDeclarationKind.PROPERTY
}
interface IrField : IrDeclaration {
interface IrField : IrSymbolDeclaration<IrFieldSymbol> {
override val descriptor: PropertyDescriptor
override val declarationKind: IrDeclarationKind
@@ -17,9 +17,10 @@
package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
interface IrTypeParameter : IrDeclaration {
interface IrTypeParameter : IrSymbolDeclaration<IrTypeParameterSymbol> {
override val declarationKind: IrDeclarationKind
get() = IrDeclarationKind.TYPE_PARAMETER
@@ -18,9 +18,10 @@ package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.descriptors.ParameterDescriptor
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
interface IrValueParameter : IrDeclaration {
interface IrValueParameter : IrSymbolDeclaration<IrValueParameterSymbol> {
override val declarationKind: IrDeclarationKind
get() = IrDeclarationKind.VALUE_PARAMETER
@@ -18,8 +18,9 @@ package org.jetbrains.kotlin.ir.declarations
import org.jetbrains.kotlin.descriptors.VariableDescriptor
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol
interface IrVariable : IrDeclaration {
interface IrVariable : IrSymbolDeclaration<IrVariableSymbol> {
override val descriptor: VariableDescriptor
override val declarationKind: IrDeclarationKind
@@ -17,12 +17,11 @@
package org.jetbrains.kotlin.ir.declarations.impl
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.ir.*
import org.jetbrains.kotlin.ir.declarations.IrAnonymousInitializer
import org.jetbrains.kotlin.ir.declarations.impl.IrDeclarationBase
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
import org.jetbrains.kotlin.ir.expressions.IrBody
import org.jetbrains.kotlin.ir.symbols.IrAnonymousInitializerSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrAnonymousInitializerSymbolImpl
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
@@ -30,8 +29,13 @@ class IrAnonymousInitializerImpl(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
override val descriptor: ClassDescriptor
override val descriptor: ClassDescriptor,
override val symbol: IrAnonymousInitializerSymbol
) : IrDeclarationBase(startOffset, endOffset, origin), IrAnonymousInitializer {
constructor(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: ClassDescriptor) :
this(startOffset, endOffset, origin, descriptor,
IrAnonymousInitializerSymbolImpl(descriptor))
constructor(
startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: ClassDescriptor,
body: IrBlockBody
@@ -18,6 +18,8 @@ package org.jetbrains.kotlin.ir.declarations.impl
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrClassSymbolImpl
import org.jetbrains.kotlin.ir.util.transform
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
@@ -28,8 +30,13 @@ class IrClassImpl(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
override val descriptor: ClassDescriptor
override val descriptor: ClassDescriptor,
override val symbol: IrClassSymbol
) : IrDeclarationBase(startOffset, endOffset, origin), IrClass {
constructor(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: ClassDescriptor) :
this(startOffset, endOffset, origin, descriptor,
IrClassSymbolImpl(descriptor))
constructor(
startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: ClassDescriptor,
members: List<IrDeclaration>
@@ -20,12 +20,19 @@ import org.jetbrains.kotlin.descriptors.ClassConstructorDescriptor
import org.jetbrains.kotlin.ir.declarations.IrConstructor
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.expressions.IrBody
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrConstructorSymbolImpl
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrConstructorImpl(
startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin,
override val descriptor: ClassConstructorDescriptor
override val descriptor: ClassConstructorDescriptor,
override val symbol: IrConstructorSymbol
) : IrFunctionBase(startOffset, endOffset, origin), IrConstructor {
constructor(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: ClassConstructorDescriptor) :
this(startOffset, endOffset, origin, descriptor,
IrConstructorSymbolImpl(descriptor))
constructor(
startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: ClassConstructorDescriptor,
body: IrBody
@@ -21,6 +21,8 @@ import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrEnumEntry
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrEnumEntrySymbolImpl
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
@@ -28,8 +30,13 @@ class IrEnumEntryImpl(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
override val descriptor: ClassDescriptor
override val descriptor: ClassDescriptor,
override val symbol: IrEnumEntrySymbol
) : IrDeclarationBase(startOffset, endOffset, origin), IrEnumEntry {
constructor(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: ClassDescriptor) :
this(startOffset, endOffset, origin, descriptor,
IrEnumEntrySymbolImpl(descriptor))
constructor(
startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: ClassDescriptor,
correspondingClass: IrClass?, initializerExpression: IrExpression
@@ -19,8 +19,9 @@ package org.jetbrains.kotlin.ir.declarations.impl
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrField
import org.jetbrains.kotlin.ir.expressions.IrBody
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrFieldSymbolImpl
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
@@ -29,8 +30,13 @@ class IrFieldImpl(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
override val descriptor: PropertyDescriptor
override val descriptor: PropertyDescriptor,
override val symbol: IrFieldSymbol
): IrDeclarationBase(startOffset, endOffset, origin), IrField {
constructor(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: PropertyDescriptor) :
this(startOffset, endOffset, origin, descriptor,
IrFieldSymbolImpl(descriptor))
constructor(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: PropertyDescriptor,
initializer: IrExpressionBody?
) : this(startOffset, endOffset, origin, descriptor) {
@@ -18,9 +18,12 @@ package org.jetbrains.kotlin.ir.declarations.impl
import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
import org.jetbrains.kotlin.ir.*
import org.jetbrains.kotlin.ir.IrElementBase
import org.jetbrains.kotlin.ir.SourceManager
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.ir.symbols.IrFileSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrFileSymbolImpl
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.utils.SmartList
@@ -28,11 +31,18 @@ import java.util.*
class IrFileImpl(
override val fileEntry: SourceManager.FileEntry,
override val packageFragmentDescriptor: PackageFragmentDescriptor
override val packageFragmentDescriptor: PackageFragmentDescriptor,
override val symbol: IrFileSymbol
) : IrElementBase(0, fileEntry.maxOffset), IrFile {
constructor(fileEntry: SourceManager.FileEntry, packageFragmentDescriptor: PackageFragmentDescriptor)
: this(fileEntry, packageFragmentDescriptor,
IrFileSymbolImpl(packageFragmentDescriptor))
constructor(
fileEntry: SourceManager.FileEntry, packageFragmentDescriptor: PackageFragmentDescriptor,
fileAnnotations: List<AnnotationDescriptor>, declarations: List<IrDeclaration>
fileEntry: SourceManager.FileEntry,
packageFragmentDescriptor: PackageFragmentDescriptor,
fileAnnotations: List<AnnotationDescriptor>,
declarations: List<IrDeclaration>
) : this(fileEntry, packageFragmentDescriptor) {
this.fileAnnotations.addAll(fileAnnotations)
this.declarations.addAll(declarations)
@@ -20,14 +20,21 @@ import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
import org.jetbrains.kotlin.ir.expressions.IrBody
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionSymbolImpl
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
class IrFunctionImpl(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
override val descriptor: FunctionDescriptor
override val descriptor: FunctionDescriptor,
override val symbol: IrSimpleFunctionSymbol
) : IrFunctionBase(startOffset, endOffset, origin), IrSimpleFunction {
constructor(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: FunctionDescriptor) :
this(startOffset, endOffset, origin, descriptor,
IrSimpleFunctionSymbolImpl(descriptor))
constructor(
startOffset: Int,
endOffset: Int,
@@ -19,6 +19,8 @@ package org.jetbrains.kotlin.ir.declarations.impl
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
@@ -26,8 +28,13 @@ class IrTypeParameterImpl(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
override val descriptor: TypeParameterDescriptor
override val descriptor: TypeParameterDescriptor,
override val symbol: IrTypeParameterSymbol
) : IrDeclarationBase(startOffset, endOffset, origin), IrTypeParameter {
constructor(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: TypeParameterDescriptor) :
this(startOffset, endOffset, origin, descriptor,
IrTypeParameterSymbolImpl(descriptor))
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
visitor.visitTypeParameter(this, data)
@@ -22,6 +22,8 @@ import org.jetbrains.kotlin.ir.declarations.IrValueParameter
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBodyImpl
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
@@ -29,8 +31,13 @@ class IrValueParameterImpl(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
override val descriptor: ParameterDescriptor
override val descriptor: ParameterDescriptor,
override val symbol: IrValueParameterSymbol
) : IrDeclarationBase(startOffset, endOffset, origin), IrValueParameter {
constructor(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: ParameterDescriptor) :
this(startOffset, endOffset, origin, descriptor,
IrValueParameterSymbolImpl(descriptor))
constructor(
startOffset: Int,
endOffset: Int,
@@ -49,6 +56,7 @@ class IrValueParameterImpl(
defaultValue: IrExpression
) : this(startOffset, endOffset, origin, descriptor, IrExpressionBodyImpl(defaultValue))
override var defaultValue: IrExpressionBody? = null
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
@@ -20,6 +20,8 @@ import org.jetbrains.kotlin.descriptors.VariableDescriptor
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrVariable
import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrVariableSymbolImpl
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
@@ -27,8 +29,13 @@ class IrVariableImpl(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
override val descriptor: VariableDescriptor
override val descriptor: VariableDescriptor,
override val symbol: IrVariableSymbol
) : IrDeclarationBase(startOffset, endOffset, origin), IrVariable {
constructor(startOffset: Int, endOffset: Int, origin: IrDeclarationOrigin, descriptor: VariableDescriptor) :
this(startOffset, endOffset, origin, descriptor,
IrVariableSymbolImpl(descriptor))
constructor(
startOffset: Int,
endOffset: Int,
@@ -1,23 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
import org.jetbrains.kotlin.ir.declarations.IrAnonymousInitializer
interface IrAnonymousInitializerSymbol : IrDeclarationSymbol {
override val declaration: IrAnonymousInitializer
}
@@ -1,27 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
import org.jetbrains.kotlin.ir.declarations.IrFunction
import org.jetbrains.kotlin.types.KotlinType
interface IrCallableSymbol : IrMemberSymbol {
override val declaration: IrFunction
val returnType: KotlinType
}
@@ -1,30 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.types.KotlinType
interface IrClassSymbol : IrClassifierSymbol {
override val declaration: IrClass
val kind: ClassKind
val supertypes: List<KotlinType>
val isCompanionObject: Boolean
val isData: Boolean
}
@@ -1,22 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
interface IrClassifierSymbol : IrMemberSymbol {
// TODO type constructor for symbols?
// val typeConstructor: TypeConstructor
}
@@ -1,23 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
import org.jetbrains.kotlin.ir.declarations.IrConstructor
interface IrConstructorSymbol : IrCallableSymbol {
override val declaration: IrConstructor
}
@@ -1,24 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
interface IrDeclarationSymbol : IrSymbol {
val declaration: IrDeclaration
val container: IrSymbol
}
@@ -1,25 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
import org.jetbrains.kotlin.ir.declarations.IrEnumEntry
interface IrEnumEntrySymbol : IrMemberSymbol {
override val declaration: IrEnumEntry
val ordinal: Int
}
@@ -1,27 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
import org.jetbrains.kotlin.ir.declarations.IrField
import org.jetbrains.kotlin.types.KotlinType
interface IrFieldSymbol : IrMemberSymbol {
override val declaration: IrField
val type: KotlinType
val isMutable: Boolean
}
@@ -1,26 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.name.FqName
interface IrFileSymbol : IrSymbol {
val fileName: String
val packageFqName: FqName
val element: IrFile
}
@@ -1,21 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
interface IrFunctionSymbol : IrCallableSymbol {
val overridden: List<IrFunctionSymbol>
}
@@ -1,25 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibility
interface IrMemberSymbol : IrNamedSymbol {
val modality: Modality
val visibility: Visibility
}
@@ -1,23 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
import org.jetbrains.kotlin.name.Name
interface IrNamedSymbol : IrDeclarationSymbol {
val name: Name
}
@@ -16,10 +16,34 @@
package org.jetbrains.kotlin.ir.symbols
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.declarations.*
interface IrSymbol {
val annotations: MutableList<AnnotationDescriptor>
val owner : IrSymbolOwner
val descriptor: DeclarationDescriptor
}
interface IrBindableSymbol<out D : DeclarationDescriptor, B : IrSymbolOwner> : IrSymbol{
override val owner: B
override val descriptor: D
fun bind(owner: B)
}
interface IrAnonymousInitializerSymbol : IrBindableSymbol<ClassDescriptor, IrAnonymousInitializer>
interface IrClassSymbol : IrBindableSymbol<ClassDescriptor, IrClass>
interface IrEnumEntrySymbol : IrBindableSymbol<ClassDescriptor, IrEnumEntry>
interface IrFileSymbol : IrBindableSymbol<PackageFragmentDescriptor, IrFile>
interface IrFieldSymbol : IrBindableSymbol<PropertyDescriptor, IrField>
interface IrTypeParameterSymbol : IrBindableSymbol<TypeParameterDescriptor, IrTypeParameter>
interface IrValueParameterSymbol : IrBindableSymbol<ParameterDescriptor, IrValueParameter>
interface IrVariableSymbol : IrBindableSymbol<VariableDescriptor, IrVariable>
interface IrFunctionSymbol : IrSymbol {
override val descriptor: FunctionDescriptor
}
interface IrConstructorSymbol : IrFunctionSymbol, IrBindableSymbol<ClassConstructorDescriptor, IrConstructor>
interface IrSimpleFunctionSymbol : IrFunctionSymbol, IrBindableSymbol<FunctionDescriptor, IrSimpleFunction>
@@ -1,30 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.Variance
interface IrTypeParameterSymbol : IrClassifierSymbol {
// TODO IrTypeParameter
// override val declaration: IrTypeParameter
val isReified: Boolean
val variance: Variance
val upperBounds: List<KotlinType>
val index: Int
}
@@ -1,24 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
interface IrValueParameterSymbol : IrValueSymbol {
// TODO IrValueParameter
// override val declaration: IrValueParameter
val index: Int
}
@@ -1,24 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
import org.jetbrains.kotlin.types.KotlinType
interface IrValueSymbol : IrNamedSymbol {
val type: KotlinType
}
@@ -1,25 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols
import org.jetbrains.kotlin.ir.declarations.IrVariable
interface IrVariableSymbol : IrValueSymbol {
override val declaration: IrVariable
val isMutable: Boolean
}
@@ -1,28 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.ir.declarations.IrAnonymousInitializer
import org.jetbrains.kotlin.ir.symbols.IrAnonymousInitializerSymbol
class IrAnonymousInitializerSymbolImpl() : IrDeclarationSymbolBase(), IrAnonymousInitializerSymbol {
override lateinit var declaration: IrAnonymousInitializer
constructor(declaration: IrAnonymousInitializer) : this() {
this.declaration = declaration
}
}
@@ -0,0 +1,76 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.symbols.*
abstract class IrBindableSymbolBase<out D : DeclarationDescriptor, B : IrSymbolOwner>(
override val descriptor: D
) : IrBindableSymbol<D, B> {
private var _owner: B? = null
override val owner: B
get() = _owner ?: throw IllegalStateException("Symbol for $descriptor is unbound")
override fun bind(owner: B) {
if (_owner == null)
_owner = owner
else
throw IllegalStateException("Symbol for $descriptor is already bound")
}
}
class IrAnonymousInitializerSymbolImpl(descriptor: ClassDescriptor) :
IrBindableSymbolBase<ClassDescriptor, IrAnonymousInitializer>(descriptor),
IrAnonymousInitializerSymbol
class IrClassSymbolImpl(descriptor: ClassDescriptor) :
IrBindableSymbolBase<ClassDescriptor, IrClass>(descriptor),
IrClassSymbol
class IrEnumEntrySymbolImpl(descriptor: ClassDescriptor) :
IrBindableSymbolBase<ClassDescriptor, IrEnumEntry>(descriptor),
IrEnumEntrySymbol
class IrFileSymbolImpl(descriptor: PackageFragmentDescriptor) :
IrBindableSymbolBase<PackageFragmentDescriptor, IrFile>(descriptor),
IrFileSymbol
class IrFieldSymbolImpl(descriptor: PropertyDescriptor) :
IrBindableSymbolBase<PropertyDescriptor, IrField>(descriptor),
IrFieldSymbol
class IrTypeParameterSymbolImpl(descriptor: TypeParameterDescriptor) :
IrBindableSymbolBase<TypeParameterDescriptor, IrTypeParameter>(descriptor),
IrTypeParameterSymbol
class IrValueParameterSymbolImpl(descriptor: ParameterDescriptor) :
IrBindableSymbolBase<ParameterDescriptor, IrValueParameter>(descriptor),
IrValueParameterSymbol
class IrVariableSymbolImpl(descriptor: VariableDescriptor) :
IrBindableSymbolBase<VariableDescriptor, IrVariable>(descriptor),
IrVariableSymbol
class IrSimpleFunctionSymbolImpl(descriptor: FunctionDescriptor) :
IrBindableSymbolBase<FunctionDescriptor, IrSimpleFunction>(descriptor),
IrSimpleFunctionSymbol
class IrConstructorSymbolImpl(descriptor: ClassConstructorDescriptor) :
IrBindableSymbolBase<ClassConstructorDescriptor, IrConstructor>(descriptor),
IrConstructorSymbol
@@ -1,32 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.ir.symbols.IrCallableSymbol
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.KotlinType
abstract class IrCallableSymbolBase(
name: Name,
modality: Modality,
visibility: Visibility,
override val returnType: KotlinType
) : IrMemberSymbolBase(name, modality, visibility), IrCallableSymbol
@@ -1,37 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.KotlinType
class IrClassSymbolImpl(
name: Name,
modality: Modality,
visibility: Visibility,
override val kind: ClassKind,
override val supertypes: List<KotlinType>,
override val isData: Boolean,
override val isCompanionObject: Boolean
) : IrClassifierSymbolBase(name, modality, visibility), IrClassSymbol {
override lateinit var declaration: IrClass
}
@@ -1,29 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
import org.jetbrains.kotlin.name.Name
abstract class IrClassifierSymbolBase(
name: Name,
modality: Modality,
visibility: Visibility
) : IrMemberSymbolBase(name, modality, visibility),
IrClassifierSymbol
@@ -1,33 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.ir.declarations.IrConstructor
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.KotlinType
class IrConstructorSymbolImpl(
name: Name,
modality: Modality,
visibility: Visibility,
returnType: KotlinType
) : IrCallableSymbolBase(name, modality, visibility, returnType), IrConstructorSymbol {
override lateinit var declaration: IrConstructor
}
@@ -1,24 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.ir.symbols.IrDeclarationSymbol
import org.jetbrains.kotlin.ir.symbols.IrSymbol
abstract class IrDeclarationSymbolBase : IrSymbolBase(), IrDeclarationSymbol {
override final lateinit var container: IrSymbol
}
@@ -1,32 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.ir.declarations.IrEnumEntry
import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol
import org.jetbrains.kotlin.name.Name
class IrEnumEntrySymbolImpl(
name: Name,
modality: Modality,
visibility: Visibility,
override val ordinal: Int
) : IrMemberSymbolBase(name, modality, visibility), IrEnumEntrySymbol {
override lateinit var declaration: IrEnumEntry
}
@@ -1,34 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.ir.declarations.IrField
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.KotlinType
class IrFieldSymbolImpl(
name: Name,
modality: Modality,
visibility: Visibility,
override val type: KotlinType,
override val isMutable: Boolean
) : IrMemberSymbolBase(name, modality, visibility), IrFieldSymbol {
override lateinit var declaration: IrField
}
@@ -1,28 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.ir.symbols.IrFileSymbol
import org.jetbrains.kotlin.name.FqName
class IrFileSymbolImpl(
override val fileName: String,
override val packageFqName: FqName
) : IrSymbolBase(), IrFileSymbol {
override lateinit var element: IrFile
}
@@ -1,37 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.ir.declarations.IrFunction
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.utils.SmartList
class IrFunctionSymbolImpl(
name: Name,
modality: Modality,
visibility: Visibility,
returnType: KotlinType
) : IrCallableSymbolBase(name, modality, visibility, returnType), IrFunctionSymbol {
override lateinit var declaration: IrFunction
override val overridden: MutableList<IrFunctionSymbol> = SmartList()
}
@@ -1,33 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.ir.symbols.IrMemberSymbol
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.name.Name
abstract class IrMemberSymbolBase(
name: Name,
override val modality: Modality,
override val visibility: Visibility
) : IrNamedSymbolBase(name), IrMemberSymbol {
constructor(name: Name, modality: Modality, visibility: Visibility, container: IrSymbol) : this(name, modality, visibility) {
this.container = container
}
}
@@ -1,24 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.ir.symbols.IrNamedSymbol
import org.jetbrains.kotlin.name.Name
abstract class IrNamedSymbolBase(
override val name: Name
) : IrDeclarationSymbolBase(), IrNamedSymbol
@@ -1,25 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.utils.SmartList
abstract class IrSymbolBase : IrSymbol {
override val annotations: MutableList<AnnotationDescriptor> = SmartList()
}
@@ -1,38 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.Variance
class IrTypeParameterSymbolImpl(
name: Name,
modality: Modality,
visibility: Visibility,
override val variance: Variance,
override val upperBounds: List<KotlinType>,
override val index: Int,
override val isReified: Boolean
) : IrClassifierSymbolBase(name, modality, visibility), IrTypeParameterSymbol {
// TODO IrTypeParameter
override lateinit var declaration: IrDeclaration
}
@@ -1,30 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.KotlinType
class IrValueParameterSymbolImpl(
name: Name,
type: KotlinType,
override val index: Int
) : IrValueSymbolBase(name, type), IrValueParameterSymbol {
override lateinit var declaration: IrDeclaration
}
@@ -1,27 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.ir.symbols.IrValueSymbol
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.KotlinType
abstract class IrValueSymbolBase(
name: Name,
override val type: KotlinType
) : IrNamedSymbolBase(name), IrValueSymbol
@@ -1,30 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.symbols.impl
import org.jetbrains.kotlin.ir.declarations.IrVariable
import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.types.KotlinType
class IrVariableSymbolImpl(
name: Name,
type: KotlinType,
override val isMutable: Boolean
) : IrValueSymbolBase(name, type), IrVariableSymbol {
override lateinit var declaration: IrVariable
}