IrDeclaration has annotations
Note that acceptChildren doesn't traverse them (yet?).
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright 2010-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.ir.declarations
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
|
||||
interface IrAnnotationContainer {
|
||||
val annotations: MutableList<IrExpression>
|
||||
}
|
||||
@@ -26,7 +26,7 @@ interface IrSymbolOwner : IrElement {
|
||||
val symbol: IrSymbol
|
||||
}
|
||||
|
||||
interface IrDeclaration : IrStatement {
|
||||
interface IrDeclaration : IrStatement, IrAnnotationContainer {
|
||||
val descriptor: DeclarationDescriptor
|
||||
val declarationKind: IrDeclarationKind
|
||||
val origin: IrDeclarationOrigin
|
||||
|
||||
@@ -37,7 +37,7 @@ interface IrExternalPackageFragment : IrPackageFragment {
|
||||
override val symbol: IrExternalPackageFragmentSymbol
|
||||
}
|
||||
|
||||
interface IrFile : IrPackageFragment {
|
||||
interface IrFile : IrPackageFragment, IrAnnotationContainer {
|
||||
override val symbol: IrFileSymbol
|
||||
|
||||
val fileEntry: SourceManager.FileEntry
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.ir.IrElementBase
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
|
||||
abstract class IrDeclarationBase(
|
||||
startOffset: Int,
|
||||
@@ -29,4 +30,6 @@ abstract class IrDeclarationBase(
|
||||
IrDeclaration {
|
||||
|
||||
override lateinit var parent: IrDeclarationParent
|
||||
|
||||
override val annotations: MutableList<IrExpression> = ArrayList()
|
||||
}
|
||||
@@ -22,6 +22,7 @@ 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.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFileSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrFileSymbolImpl
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
|
||||
@@ -29,6 +30,7 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.utils.SmartList
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
class IrFileImpl(
|
||||
override val fileEntry: SourceManager.FileEntry,
|
||||
@@ -62,6 +64,8 @@ class IrFileImpl(
|
||||
|
||||
override val declarations: MutableList<IrDeclaration> = ArrayList()
|
||||
|
||||
override val annotations: MutableList<IrExpression> = ArrayList()
|
||||
|
||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||
visitor.visitFile(this, data)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user