Add KParameter.type, KType, KType.isMarkedNullable

This commit is contained in:
Alexander Udalov
2015-07-13 20:46:10 +03:00
parent b0db9c5b03
commit 6ab1c6bfb3
6 changed files with 100 additions and 0 deletions
@@ -19,6 +19,7 @@ package kotlin.reflect.jvm.internal
import org.jetbrains.kotlin.descriptors.ParameterDescriptor
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import kotlin.reflect.KParameter
import kotlin.reflect.KType
class KParameterImpl(
override val index: Int,
@@ -32,4 +33,7 @@ class KParameterImpl(
val name = valueParameter.name
return if (name.isSpecial) null else name.asString()
}
override val type: KType
get() = KTypeImpl(descriptor.getType())
}
@@ -0,0 +1,25 @@
/*
* 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.types.JetType
import kotlin.reflect.KType
class KTypeImpl(val type: JetType) : KType {
override val isMarkedNullable: Boolean
get() = type.isMarkedNullable
}