ac5444ef7c
'hasDefaultValue' needs to be adapted to support locating default values in 'expect' functions, and this is not possible in module 'descriptors', where it was originally declared. Therefore, move it to module 'resolution' and copy its current logic to a separate function 'declaresOrInheritsDefaultValue' which is used in 5 places. 'hasDefaultValue' itself is updated in subsequent commits. Besides changing imports, also use a simpler declaresDefaultValue in some places, which does not include default values inherited from supertypes: this is OK for constructors, and in LazyJavaClassMemberScope for functions from built-ins which do not have default argument values at all
JavaScript Translation
This module performs the translation of Kotlin source code to JavaScript.
There are various Kotlin APIs to JavaScript environments and libraries in the js.libraries project.
Compiling the Kotlin Standard Library for JavaScript
The Kotlin Standard Library for JS is built with gradle, see the corresponding module's ReadMe.
Reusing JVM based test cases in JavaScript
Any Kotlin test cases using the org.junit.Test annotation and the kotlin.test package, such as this test case are automatically converted to JavaScript using QUnit.
This allows the test cases to be run directly in a web page in any web browser.
Using the Kotlin Library in JavaScript
There is a simple sample which shows how to use the Kotlin Standard Library from inside JavaScript in a web page.
Contributing
We love contributions! The JavaScript translation could really use your help! If you fancy contributing:
- check the contributing section on general stuff like getting the code etc
- try fix one of the pending JavaScript translation issues