Commit Graph

48 Commits

Author SHA1 Message Date
Ilya Gorbunov 7e2c365b79 Generate docs for floorDiv and mod and improve docs for div and rem
Refactor operator documentation generation for primitives and unsigned
types so that it is easier to specialize it.

Manually sync docs of numeric types in js-ir stdlib.

 KT-26234
2021-03-05 07:32:16 +03:00
Ilya Goncharov bd2601f289 [JS IR] Extract adding of function call to another function
[JS IR] Add option for dce mode

[JS IR] Add logging to non useful declarations if appropriate dce mode

[JS IR] Add mode with throwing exception

[JS IR] unreachableDeclaration method is in rootDeclarations

[JS IR] Add js extra help arg with dce mode and include debug.kt to compile unreachableMethod

[JS IR] unreachableDeclaration as internal to not reproduce stdlib api

[JS IR] Fix description of dce mode argument

- Use console.error instead of console.log
- Use JsError instead Kotlin exception for lightweight

[JS IR] Remove body for throwing exception

[JS IR] Remove default parameter in unreachableDeclaration

[JS IR] Process without removing fields and declaration containers

[JS IR] Rename dce mode on dce runtime diagnostic

[JS IR] Use console.trace instead of console.error

[JS IR] Extract JsError

- Fix naming in prependFunctionCall
- Fix description on runtime diagnostic argument
- Using message collector instead of throwing exception

[JS IR] Distinguish unreachableMethods for log and exception

[JS IR] Extract checking of Kotlin packages of IrField

^KT-45059 fixed
2021-02-20 12:05:06 +03:00
Svyatoslav Kuzmich 218c246111 [JS] Fix extra js function capturing 2021-02-04 15:41:21 +03:00
Svyatoslav Kuzmich cb3b1f8ae2 [JS IR] Fix referencing Kotin variables in inline JS code
Fixed by outlining JS code that uses Kotlin variables making usages of
these locals explicit and preventing bugs due to one-sided variable renaming.

This prevents using Kotlin variables as lvalue in JS code.
2021-01-25 19:18:44 +03:00
Roman Artemev c16b11a124 [JS IR BE] Fix throwable stuff to make exceptions similar to JVM 2020-10-12 15:22:43 +03:00
Roman Artemev ff093d363a [JS IR BE] Fix Throwable ancestor transformation
Make sure that `message` and `cause` are properly configured

 - synchronize IR BE and Legacy behaviour
 - fix corresponding IR lowering
 - fix JS IR core runtime
 - add test
 - fix KT-39964
2020-10-12 15:22:43 +03:00
Abduqodiri Qurbonzoda 36e6247125 Add more details about bit shift operations #KT-41112 2020-09-16 04:05:12 +03:00
Roman Artemev 8a810e2a5e [JS IR] Add runtime API to throw ISE in case of compiled code with errors 2020-09-01 14:53:07 +03:00
Alexander Udalov da6d904c6e Suppress code warnings in kotlin-stdlib 2020-08-20 20:30:34 +02:00
Svyatoslav Kuzmich 6792779281 [JS IR] Fix stack trace capturing in secondary constructors (KT-37563)
Call captureStack in primary constructors and generated factories
2020-06-22 11:50:14 +03:00
Anton Bannykh a18bfad53a Add stdlib API test + remove some extra IR stdlib API's 2020-06-03 17:14:29 +03:00
Vitaly 9ede8445e7 [JS BE] add runtime-function and intrinsics for es6-classes 2020-05-27 00:32:54 +03:00
Anton Bannykh e8a6ddceaa JS IR: hide runtime helpers from users 2020-04-28 16:40:07 +03:00
Dmitry Petrov 05cb0e8994 KNVE: support in JVM_IR and JS_IR 2020-04-20 20:07:52 +03:00
Abduqodiri Qurbonzoda e632d58936 Nullable Array.contentEquals/contentHashCode/contentToString #KT-34161 2020-03-12 18:01:23 +03:00
Zalim Bashorov 9e7f72382f [stdlib-js-ir] Remove BitUtils object and make all members toplevel
It works slightly better with IR DCE --
we get about 6% less code on box tests.
2020-03-11 12:54:41 +03:00
Roman Artemev c2676ded31 [JS IR] Implement KProperty runtime utils 2020-03-03 18:54:36 +03:00
Roman Artemev 26237f8bd5 [JS IR] Implement new function references scheme 2020-03-03 18:54:34 +03:00
Ilya Gorbunov 8f37ace9ee Finally drop deprecated mod functions from numeric types
#KT-26654
2020-01-23 19:28:22 +03:00
Roman Artemev 9871f8c579 [JS BE] Fix DCE to let it remove constant properties 2019-12-24 19:26:05 +03:00
Anton Bannykh 9fec2c78d1 JS IR: apply forLoopsLowering
Replaced createTemporaryVariable usages with createTmpVariables.
The latter doesn't rely on KotlinType's. Using KotlinType with
JS_IR backend causes runtime excpetions, as some expected descriptor
API is not implemented, because it avoids descriptors as much as
possible.
2019-11-26 15:08:10 +03:00
Anton Bannykh 81699299f5 JS_IR: DCE
Could be enabled by toggling `-Xir-dce`

Box test output in js/js.translator/testData/out-min
2019-11-26 12:20:39 +03:00
Roman Artemev 987c6ab3ee [JS IR] Roll making Char inline class back
- un/mute falling tests
2019-11-25 20:22:03 +03:00
Roman Artemev 18d0b477b6 [JS IR] Fix arrayOfNulls API 2019-11-19 11:15:36 +03:00
Abduqodiri Qurbonzoda 432828a2db Clarify floating-point to integral conversion rounding behaviour 2019-08-15 00:57:27 +03:00
Dmitry Petrov a9c961931c JS_IR: Support 'CHECK_NOT_NULL' intrinsic 2019-08-14 11:16:11 +03:00
Ilya Gorbunov ebb59d51d2 Fix incorrect Double.toLong conversion for infinite values in JS
#KT-33225 Fixed
2019-08-09 11:49:28 +03:00
Roman Artemev d4fb76c1da [JS IR BE] Fix overriding property of Throwable 2019-07-09 10:40:01 +03:00
Svyatoslav Kuzmich 675f01ee80 [JS IR BE] Set Throwable subtype name in extendThrowable function 2019-07-05 19:31:23 +03:00
Svyatoslav Kuzmich a2625c7bc8 [JS IR BE] Don't render null messages in Throwable
Set message property to 'undefined' to make Error.prototype.toString
skip it
2019-07-04 18:33:23 +03:00
Svyatoslav Kuzmich 94aebd0101 [JS IR BE] Proper support for String and Any constructors
Remove workarounds from codegen
2019-07-04 17:03:47 +03:00
Svyatoslav Kuzmich 918d470e1b [JS IR BE] Simplify throwable lowering.
- Make kotlin.Throwable class extenral
- Add runtime function 'extendThrowable' to use instead of delegating
  constructors to Throwable
2019-07-03 20:37:48 +03:00
Ilya Gorbunov eae1813ead stdlib-js(-v1/-ir): rename source files to avoid duplicates in sources
Prohibit having duplicates in sources jar and rename those source files,
that clash with the same named source files coming from
the common js source root.

Relates to KT-31965
2019-06-18 20:03:04 +03:00
Roman Artemev 1f70284b18 [JS IR BE] Fix charSequenceLength function for JS IR 2019-06-17 18:10:53 +03:00
Svyatoslav Kuzmich a3677d6fc0 [JS IR RUNTIME] Fix types in kotlin.js.captureStack 2019-05-24 11:50:47 +03:00
Roman Artemev 9c7d47789c [JS IR BE] Implement type check for SuspendFunctionN 2019-05-22 15:18:13 +03:00
Svyatoslav Kuzmich b8bbcb3f93 [JS IR BE] Copy type metadata for Boolean, Char and Long varargs 2019-05-21 19:19:31 +03:00
Svyatoslav Kuzmich 23a214710b [JS IR BE] Add Unit return type to function signature 2019-05-15 14:09:02 +03:00
Svyatoslav Kuzmich e3bcabeae3 [JS IR] stdlib: Fix bugs in Long.toString(radix) 2019-05-07 21:49:12 +03:00
Svyatoslav Kuzmich bc29a5b15c [JS IR] stdlib: port methods that use bit representation of numbers
- Port part of 'misc.js' from current backend to 'bitUtils.kt' in IR backend
- Enable toBits, toRawBits, fromBits extension function on Double and Float
- Enable Double.withSign
- Refactor getNumberHashCode using new utils
2019-05-07 21:49:12 +03:00
Svyatoslav Kuzmich 7687985442 [JS IR] Stdlib: use total-order comparasion for content equals 2019-05-07 21:48:50 +03:00
Svyatoslav Kuzmich 3a506a372b [JS IR] stdlib: Use Nothing in return type of THROW helpers
Backend generated calls to those helpers inside expression which
resuleted in invalid type casts in IR (in dead code).
2019-05-07 21:48:50 +03:00
Svyatoslav Kuzmich 379cb08226 [JS] Reduce usage of 'js' function in stdlib
Function 'kotlin.js.js' is to be redesigned in JS IR backend,
partially because it is a hard feature to support.

Current implementation is unstable and can cause problems around
 inlining and name generator. Luckily most of its use-cases
can be covered by simpler features like dynamic expressions and
external declarations.

Thus we are reducing it's usage in stdlib to make IR backend more
stable in current state. JavaScript features that can't be covered by dynamic expression are
implemented in 'jsOperators.kt' file respectively for each backend:

 - 'internal inline' function which calls 'js' function inside for current
   pre-IR backend

 - 'internal' function with '_hack' parameters for JS IR backend which will be
   later intinsicified in a compiler
2019-04-30 15:27:19 +03:00
Svyatoslav Kuzmich 09d7f4015b Move test.kt stubs to smallRuntime
We already use kotlin.test with fullRuntime klib.
2019-04-24 13:06:59 +03:00
Svyatoslav Kuzmich b0bd5802bb Remove optionalExpectation hacks
Add common sources to Generate IR Runtime
2019-04-24 13:06:58 +03:00
nikita.movshin deb416484c Update copyright. Fix 2 lines comments after rebase
Change the copyright from "JetBrains s.r.o." to
"JetBrains s.r.o. and Kotlin Project contributors"
2019-04-23 20:15:03 +03:00
nikita.movshin 65244b4bea Update copyright.
Change the copyright from "JetBrains s.r.o." to
"JetBrains s.r.o. and Kotlin Project contributors"
Update only 2 lines copyright.
2019-04-23 20:09:22 +03:00
Svyatoslav Kuzmich b1d303b027 Reorganize stdlib-js sources specific to the current JS backend
Move kotlin-stdlib-js project and the sources specific to the current backend to 'stdlib/js-v1' directory,
but leave sources that can be shared with the new IR backend in the common 'stdlib/js' location
with exception for 'stdlib/js/src/generated', which is used exclusively for current backend.
This simplifies sourceset configuration when building stdlib with the new backend.
2019-04-22 20:30:57 +03:00