localVariableReferences.kt moved from reflection.jvm to runtime.jvm
This commit is contained in:
@@ -50,12 +50,11 @@ public class JvmRuntimeTypes {
|
|||||||
LockBasedStorageManager.NO_LOCKS,
|
LockBasedStorageManager.NO_LOCKS,
|
||||||
DefaultBuiltIns.getInstance());
|
DefaultBuiltIns.getInstance());
|
||||||
PackageFragmentDescriptor kotlinJvmInternal = new MutablePackageFragmentDescriptor(module, new FqName("kotlin.jvm.internal"));
|
PackageFragmentDescriptor kotlinJvmInternal = new MutablePackageFragmentDescriptor(module, new FqName("kotlin.jvm.internal"));
|
||||||
PackageFragmentDescriptor kotlinReflectJvmInternal = new MutablePackageFragmentDescriptor(module, new FqName("kotlin.reflect.jvm.internal"));
|
|
||||||
|
|
||||||
this.lambda = createClass(kotlinJvmInternal, "Lambda");
|
this.lambda = createClass(kotlinJvmInternal, "Lambda");
|
||||||
this.functionReference = createClass(kotlinJvmInternal, "FunctionReference");
|
this.functionReference = createClass(kotlinJvmInternal, "FunctionReference");
|
||||||
this.localVariableReference = createClass(kotlinReflectJvmInternal, "LocalVariableReference");
|
this.localVariableReference = createClass(kotlinJvmInternal, "LocalVariableReference");
|
||||||
this.mutableLocalVariableReference = createClass(kotlinReflectJvmInternal, "MutableLocalVariableReference");
|
this.mutableLocalVariableReference = createClass(kotlinJvmInternal, "MutableLocalVariableReference");
|
||||||
this.propertyReferences = new ArrayList<ClassDescriptor>(3);
|
this.propertyReferences = new ArrayList<ClassDescriptor>(3);
|
||||||
this.mutablePropertyReferences = new ArrayList<ClassDescriptor>(3);
|
this.mutablePropertyReferences = new ArrayList<ClassDescriptor>(3);
|
||||||
|
|
||||||
|
|||||||
@@ -86,12 +86,6 @@ class PropertyReferenceCodegen(
|
|||||||
invokespecial(superAsmType.internalName, "<init>", "()V", false)
|
invokespecial(superAsmType.internalName, "<init>", "()V", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target !is LocalVariableDescriptor) {
|
|
||||||
generateMethod("property reference getOwner", ACC_PUBLIC, method("getOwner", K_DECLARATION_CONTAINER_TYPE)) {
|
|
||||||
ClosureCodegen.generateCallableReferenceDeclarationContainer(this, target, state)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
generateMethod("property reference getName", ACC_PUBLIC, method("getName", JAVA_STRING_TYPE)) {
|
generateMethod("property reference getName", ACC_PUBLIC, method("getName", JAVA_STRING_TYPE)) {
|
||||||
aconst(target.name.asString())
|
aconst(target.name.asString())
|
||||||
}
|
}
|
||||||
@@ -100,7 +94,12 @@ class PropertyReferenceCodegen(
|
|||||||
aconst(getPropertyReferenceSignature(target as VariableDescriptorWithAccessors, state))
|
aconst(getPropertyReferenceSignature(target as VariableDescriptorWithAccessors, state))
|
||||||
}
|
}
|
||||||
|
|
||||||
generateAccessors()
|
if (target !is LocalVariableDescriptor) {
|
||||||
|
generateMethod("property reference getOwner", ACC_PUBLIC, method("getOwner", K_DECLARATION_CONTAINER_TYPE)) {
|
||||||
|
ClosureCodegen.generateCallableReferenceDeclarationContainer(this, target, state)
|
||||||
|
}
|
||||||
|
generateAccessors()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun generateAccessors() {
|
private fun generateAccessors() {
|
||||||
|
|||||||
+15
-6
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2016 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -14,16 +14,25 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package kotlin.reflect.jvm.internal
|
package kotlin.jvm.internal
|
||||||
|
|
||||||
import kotlin.jvm.internal.MutablePropertyReference0
|
|
||||||
import kotlin.jvm.internal.PropertyReference0
|
|
||||||
import kotlin.reflect.KDeclarationContainer
|
import kotlin.reflect.KDeclarationContainer
|
||||||
|
|
||||||
|
private fun notSupportedError(): Nothing {
|
||||||
|
throw UnsupportedOperationException("Not supported for local property reference.")
|
||||||
|
}
|
||||||
|
|
||||||
open class LocalVariableReference : PropertyReference0() {
|
open class LocalVariableReference : PropertyReference0() {
|
||||||
override fun getOwner(): KDeclarationContainer = EmptyContainerForLocal
|
override fun getOwner(): KDeclarationContainer = notSupportedError()
|
||||||
|
|
||||||
|
override fun get(): Any? = notSupportedError()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open class MutableLocalVariableReference : MutablePropertyReference0() {
|
open class MutableLocalVariableReference : MutablePropertyReference0() {
|
||||||
override fun getOwner(): KDeclarationContainer = EmptyContainerForLocal
|
override fun getOwner(): KDeclarationContainer = notSupportedError()
|
||||||
|
|
||||||
|
override fun get(): Any? = notSupportedError()
|
||||||
|
|
||||||
|
override fun set(value: Any?): Unit = notSupportedError()
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user