JS backend: add the ability to get JS constructor function by class name and from instance. Support it for reified type parameters too. Add ability to get name of class.

#KT-5987 Fixed
 #KT-4115 Fixed
This commit is contained in:
Zalim Bashorov
2016-08-03 22:22:15 +03:00
parent e7eb35b169
commit 88ad00b0bc
13 changed files with 253 additions and 11 deletions
+28
View File
@@ -0,0 +1,28 @@
/*
* 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 kotlin.js
@native
interface JsClass<T> {
val name: String
}
@native
fun <T> jsClass(): JsClass<T> = noImpl
val <T> T.jsClass: JsClass<T>
get() = js("Object").getPrototypeOf(this).constructor