IrClassReference

This commit is contained in:
Dmitry Petrov
2016-08-31 16:11:37 +03:00
committed by Dmitry Petrov
parent 9eeb492fe3
commit 93618ebb12
3 changed files with 42 additions and 0 deletions
@@ -0,0 +1,37 @@
/*
* Copyright 2010-2016 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.expressions
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.types.KotlinType
interface IrClassReference : IrDeclarationReference {
override val descriptor: ClassDescriptor
}
class IrClassReferenceImpl(
startOffset: Int,
endOffset: Int,
type: KotlinType,
descriptor: ClassDescriptor
) : IrTerminalDeclarationReferenceBase<ClassDescriptor>(startOffset, endOffset, type, descriptor), IrClassReference {
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
return visitor.visitClassReference(this, data)
}
}
@@ -158,6 +158,9 @@ class RenderIrElementVisitor : IrElementVisitor<String, Nothing?> {
override fun visitCallableReference(expression: IrCallableReference, data: Nothing?): String =
"CALLABLE_REFERENCE ${expression.descriptor.render()} type=${expression.type.render()}"
override fun visitClassReference(expression: IrClassReference, data: Nothing?): String =
"CLASS_REFERENCE ${expression.descriptor.render()} type=${expression.type.render()}"
override fun visitTryCatch(tryCatch: IrTryCatch, data: Nothing?): String =
"TRY_CATCH type=${tryCatch.type.render()}"
@@ -64,7 +64,9 @@ interface IrElementVisitor<out R, in D> {
fun visitCall(expression: IrCall, data: D) = visitGeneralCall(expression, data)
fun visitDelegatingConstructorCall(expression: IrDelegatingConstructorCall, data: D) = visitGeneralCall(expression, data)
fun visitEnumConstructorCall(expression: IrEnumConstructorCall, data: D) = visitGeneralCall(expression, data)
fun visitCallableReference(expression: IrCallableReference, data: D) = visitDeclarationReference(expression, data)
fun visitClassReference(expression: IrClassReference, data: D) = visitDeclarationReference(expression, data)
fun visitNestedInitializersCall(expression: IrNestedInitializersCall, data: D) = visitExpression(expression, data)