IR: make IrDeclarationReference and subtypes classes
This commit is contained in:
+1
-1
@@ -511,7 +511,7 @@ class FunctionInlining(
|
|||||||
private class IrGetValueWithoutLocation(
|
private class IrGetValueWithoutLocation(
|
||||||
override val symbol: IrValueSymbol,
|
override val symbol: IrValueSymbol,
|
||||||
override val origin: IrStatementOrigin? = null
|
override val origin: IrStatementOrigin? = null
|
||||||
) : IrExpressionBase(), IrGetValue {
|
) : IrGetValue() {
|
||||||
override val startOffset: Int get() = UNDEFINED_OFFSET
|
override val startOffset: Int get() = UNDEFINED_OFFSET
|
||||||
override val endOffset: Int get() = UNDEFINED_OFFSET
|
override val endOffset: Int get() = UNDEFINED_OFFSET
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,7 @@ package org.jetbrains.kotlin.ir.expressions
|
|||||||
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
|
|
||||||
|
abstract class IrClassReference : IrDeclarationReference() {
|
||||||
interface IrClassReference : IrDeclarationReference {
|
abstract override val symbol: IrClassifierSymbol
|
||||||
override val symbol: IrClassifierSymbol
|
abstract val classType: IrType
|
||||||
val classType: IrType
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-9
@@ -16,23 +16,24 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.ir.expressions
|
package org.jetbrains.kotlin.ir.expressions
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBase
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol
|
import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||||
|
|
||||||
interface IrDeclarationReference : IrExpression {
|
abstract class IrDeclarationReference : IrExpressionBase() {
|
||||||
val symbol: IrSymbol
|
abstract val symbol: IrSymbol
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IrGetSingletonValue : IrDeclarationReference
|
abstract class IrGetSingletonValue : IrDeclarationReference()
|
||||||
|
|
||||||
interface IrGetObjectValue : IrGetSingletonValue {
|
abstract class IrGetObjectValue : IrGetSingletonValue() {
|
||||||
override val symbol: IrClassSymbol
|
abstract override val symbol: IrClassSymbol
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IrGetEnumValue : IrGetSingletonValue {
|
abstract class IrGetEnumValue : IrGetSingletonValue() {
|
||||||
override val symbol: IrEnumEntrySymbol
|
abstract override val symbol: IrEnumEntrySymbol
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +41,6 @@ interface IrGetEnumValue : IrGetSingletonValue {
|
|||||||
*
|
*
|
||||||
* On JS platform represent a plain reference to JavaScript function.
|
* On JS platform represent a plain reference to JavaScript function.
|
||||||
*/
|
*/
|
||||||
interface IrRawFunctionReference : IrDeclarationReference {
|
abstract class IrRawFunctionReference : IrDeclarationReference() {
|
||||||
override val symbol: IrFunctionSymbol
|
abstract override val symbol: IrFunctionSymbol
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-8
@@ -19,17 +19,17 @@ package org.jetbrains.kotlin.ir.expressions
|
|||||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
|
||||||
|
|
||||||
interface IrFieldAccessExpression : IrDeclarationReference {
|
abstract class IrFieldAccessExpression : IrDeclarationReference() {
|
||||||
override val symbol: IrFieldSymbol
|
abstract override val symbol: IrFieldSymbol
|
||||||
|
|
||||||
val superQualifierSymbol: IrClassSymbol?
|
abstract val superQualifierSymbol: IrClassSymbol?
|
||||||
|
|
||||||
var receiver: IrExpression?
|
var receiver: IrExpression? = null
|
||||||
val origin: IrStatementOrigin?
|
abstract val origin: IrStatementOrigin?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IrGetField : IrFieldAccessExpression
|
abstract class IrGetField : IrFieldAccessExpression()
|
||||||
|
|
||||||
interface IrSetField : IrFieldAccessExpression {
|
abstract class IrSetField : IrFieldAccessExpression() {
|
||||||
var value: IrExpression
|
abstract var value: IrExpression
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
|||||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||||
import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBase
|
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
import org.jetbrains.kotlin.ir.types.defaultType
|
import org.jetbrains.kotlin.ir.types.defaultType
|
||||||
@@ -23,7 +22,7 @@ import org.jetbrains.kotlin.types.KotlinType
|
|||||||
|
|
||||||
abstract class IrMemberAccessExpression<S : IrSymbol>(
|
abstract class IrMemberAccessExpression<S : IrSymbol>(
|
||||||
val typeArgumentsCount: Int
|
val typeArgumentsCount: Int
|
||||||
) : IrExpressionBase(), IrDeclarationReference {
|
) : IrDeclarationReference() {
|
||||||
var dispatchReceiver: IrExpression? = null
|
var dispatchReceiver: IrExpression? = null
|
||||||
var extensionReceiver: IrExpression? = null
|
var extensionReceiver: IrExpression? = null
|
||||||
|
|
||||||
|
|||||||
+8
-9
@@ -19,17 +19,16 @@ package org.jetbrains.kotlin.ir.expressions
|
|||||||
import org.jetbrains.kotlin.ir.symbols.IrValueSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrValueSymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrVariableSymbol
|
||||||
|
|
||||||
interface IrValueAccessExpression : IrDeclarationReference {
|
abstract class IrValueAccessExpression : IrDeclarationReference() {
|
||||||
override val symbol: IrValueSymbol
|
abstract override val symbol: IrValueSymbol
|
||||||
val origin: IrStatementOrigin?
|
abstract val origin: IrStatementOrigin?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IrGetValue : IrValueAccessExpression, IrExpressionWithCopy {
|
abstract class IrGetValue : IrValueAccessExpression(), IrExpressionWithCopy {
|
||||||
override fun copy(): IrGetValue
|
abstract override fun copy(): IrGetValue
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IrSetVariable : IrValueAccessExpression {
|
abstract class IrSetVariable : IrValueAccessExpression() {
|
||||||
override val symbol: IrVariableSymbol
|
abstract override val symbol: IrVariableSymbol
|
||||||
var value: IrExpression
|
abstract var value: IrExpression
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ class IrClassReferenceImpl(
|
|||||||
override val type: IrType,
|
override val type: IrType,
|
||||||
override val symbol: IrClassifierSymbol,
|
override val symbol: IrClassifierSymbol,
|
||||||
override val classType: IrType
|
override val classType: IrType
|
||||||
) : IrExpressionBase(), IrClassReference {
|
) : IrClassReference() {
|
||||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||||
visitor.visitClassReference(this, data)
|
visitor.visitClassReference(this, data)
|
||||||
}
|
}
|
||||||
|
|||||||
-24
@@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.impl
|
|
||||||
|
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrFieldAccessExpression
|
|
||||||
|
|
||||||
abstract class IrFieldExpressionBase : IrExpressionBase(), IrFieldAccessExpression {
|
|
||||||
final override var receiver: IrExpression? = null
|
|
||||||
}
|
|
||||||
+1
-1
@@ -26,7 +26,7 @@ class IrGetEnumValueImpl(
|
|||||||
override val endOffset: Int,
|
override val endOffset: Int,
|
||||||
override val type: IrType,
|
override val type: IrType,
|
||||||
override val symbol: IrEnumEntrySymbol,
|
override val symbol: IrEnumEntrySymbol,
|
||||||
) : IrExpressionBase(), IrGetEnumValue {
|
) : IrGetEnumValue() {
|
||||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||||
return visitor.visitGetEnumValue(this, data)
|
return visitor.visitGetEnumValue(this, data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class IrGetFieldImpl(
|
|||||||
override val type: IrType,
|
override val type: IrType,
|
||||||
override val origin: IrStatementOrigin? = null,
|
override val origin: IrStatementOrigin? = null,
|
||||||
override val superQualifierSymbol: IrClassSymbol? = null,
|
override val superQualifierSymbol: IrClassSymbol? = null,
|
||||||
) : IrFieldExpressionBase(), IrGetField {
|
) : IrGetField() {
|
||||||
constructor(
|
constructor(
|
||||||
startOffset: Int, endOffset: Int,
|
startOffset: Int, endOffset: Int,
|
||||||
symbol: IrFieldSymbol,
|
symbol: IrFieldSymbol,
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ class IrGetObjectValueImpl(
|
|||||||
override val endOffset: Int,
|
override val endOffset: Int,
|
||||||
override val type: IrType,
|
override val type: IrType,
|
||||||
override val symbol: IrClassSymbol
|
override val symbol: IrClassSymbol
|
||||||
) : IrExpressionBase(), IrGetObjectValue {
|
) : IrGetObjectValue() {
|
||||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R =
|
||||||
visitor.visitGetObjectValue(this, data)
|
visitor.visitGetObjectValue(this, data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class IrGetValueImpl(
|
|||||||
override val type: IrType,
|
override val type: IrType,
|
||||||
override val symbol: IrValueSymbol,
|
override val symbol: IrValueSymbol,
|
||||||
override val origin: IrStatementOrigin? = null
|
override val origin: IrStatementOrigin? = null
|
||||||
) : IrExpressionBase(), IrGetValue {
|
) : IrGetValue() {
|
||||||
constructor(
|
constructor(
|
||||||
startOffset: Int,
|
startOffset: Int,
|
||||||
endOffset: Int,
|
endOffset: Int,
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ class IrRawFunctionReferenceImpl(
|
|||||||
override val endOffset: Int,
|
override val endOffset: Int,
|
||||||
override val type: IrType,
|
override val type: IrType,
|
||||||
override val symbol: IrFunctionSymbol,
|
override val symbol: IrFunctionSymbol,
|
||||||
) : IrExpressionBase(), IrRawFunctionReference {
|
) : IrRawFunctionReference() {
|
||||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||||
return visitor.visitRawFunctionReference(this, data)
|
return visitor.visitRawFunctionReference(this, data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class IrSetFieldImpl(
|
|||||||
override val type: IrType,
|
override val type: IrType,
|
||||||
override val origin: IrStatementOrigin? = null,
|
override val origin: IrStatementOrigin? = null,
|
||||||
override val superQualifierSymbol: IrClassSymbol? = null,
|
override val superQualifierSymbol: IrClassSymbol? = null,
|
||||||
) : IrFieldExpressionBase(), IrSetField {
|
) : IrSetField() {
|
||||||
constructor(
|
constructor(
|
||||||
startOffset: Int, endOffset: Int,
|
startOffset: Int, endOffset: Int,
|
||||||
symbol: IrFieldSymbol,
|
symbol: IrFieldSymbol,
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@ class IrSetVariableImpl(
|
|||||||
override val symbol: IrVariableSymbol,
|
override val symbol: IrVariableSymbol,
|
||||||
override var value: IrExpression,
|
override var value: IrExpression,
|
||||||
override val origin: IrStatementOrigin?
|
override val origin: IrStatementOrigin?
|
||||||
) : IrExpressionBase(), IrSetVariable {
|
) : IrSetVariable() {
|
||||||
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
override fun <R, D> accept(visitor: IrElementVisitor<R, D>, data: D): R {
|
||||||
return visitor.visitSetVariable(this, data)
|
return visitor.visitSetVariable(this, data)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user