Delegated Properties: Code generation for local properties (JVM)
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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 kotlin.reflect.jvm.internal
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ConstructorDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import kotlin.reflect.KCallable
|
||||
import kotlin.reflect.KotlinReflectionInternalError
|
||||
|
||||
internal object EmptyContainerForLocal : KDeclarationContainerImpl() {
|
||||
override val jClass: Class<*>
|
||||
get() = fail()
|
||||
|
||||
override val members: Collection<KCallable<*>>
|
||||
get() = fail()
|
||||
|
||||
override val constructorDescriptors: Collection<ConstructorDescriptor>
|
||||
get() = fail()
|
||||
|
||||
override fun getProperties(name: Name): Collection<PropertyDescriptor> = fail()
|
||||
|
||||
override fun getFunctions(name: Name): Collection<FunctionDescriptor> = fail()
|
||||
|
||||
private fun fail(): Nothing = throw KotlinReflectionInternalError("Introspecting local functions, lambdas and anonymous functions " +
|
||||
"is not yet fully supported in Kotlin reflection")
|
||||
}
|
||||
@@ -62,20 +62,3 @@ internal class KFunctionFromReferenceImpl(
|
||||
override fun invoke(p1: Any?, p2: Any?, p3: Any?, p4: Any?, p5: Any?, p6: Any?, p7: Any?, p8: Any?, p9: Any?, p10: Any?, p11: Any?, p12: Any?, p13: Any?, p14: Any?, p15: Any?, p16: Any?, p17: Any?, p18: Any?, p19: Any?, p20: Any?, p21: Any?, p22: Any?): Any? = reference(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22)
|
||||
}
|
||||
|
||||
internal object EmptyContainerForLocal : KDeclarationContainerImpl() {
|
||||
override val jClass: Class<*>
|
||||
get() = fail()
|
||||
|
||||
override val members: Collection<KCallable<*>>
|
||||
get() = fail()
|
||||
|
||||
override val constructorDescriptors: Collection<ConstructorDescriptor>
|
||||
get() = fail()
|
||||
|
||||
override fun getProperties(name: Name): Collection<PropertyDescriptor> = fail()
|
||||
|
||||
override fun getFunctions(name: Name): Collection<FunctionDescriptor> = fail()
|
||||
|
||||
private fun fail(): Nothing = throw KotlinReflectionInternalError("Introspecting local functions, lambdas and anonymous functions " +
|
||||
"is not yet fully supported in Kotlin reflection")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2010-2015 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 kotlin.reflect.jvm.internal
|
||||
|
||||
import kotlin.jvm.internal.MutablePropertyReference0
|
||||
import kotlin.jvm.internal.PropertyReference0
|
||||
import kotlin.reflect.KDeclarationContainer
|
||||
|
||||
open class LocalVariableReference : PropertyReference0() {
|
||||
override fun getOwner(): KDeclarationContainer = EmptyContainerForLocal
|
||||
}
|
||||
|
||||
open class MutableLocalVariableReference : MutablePropertyReference0() {
|
||||
override fun getOwner(): KDeclarationContainer = EmptyContainerForLocal
|
||||
}
|
||||
Reference in New Issue
Block a user