Commit Graph

824 Commits

Author SHA1 Message Date
Roman Artemev a36135baf1 [JS IR] Fix reflection generation 2021-06-02 13:42:35 +03:00
Roman Artemev 974779e91b [JS IR] Support function reference to array inline constructor 2021-06-02 13:42:34 +03:00
Alexander Udalov 8b3769b88e Remove dependency of ir.serialization.common on ir.backend.common 2021-06-01 20:28:22 +02:00
Alexander Udalov a3ad03d1ad Slightly refactor module dependencies of backend.js/serialization.js
The comment in serialization.js/build.gradle.kts is not needed because
such dependency cannot be introduced accidentally, since Gradle does not
support cycles in module dependencies.
2021-06-01 20:28:22 +02:00
Anton Bannykh b3bb033fe4 JS IR: fix plain module reference 2021-05-26 17:53:21 +03:00
Ilya Goncharov f40110eb83 [JS IR] Fixes after rebase 2021-05-20 16:37:52 +03:00
Ilya Goncharov b76f5547e4 [JS IR] Remove unnecessary overrides in IrNamer 2021-05-20 16:37:48 +03:00
Ilya Goncharov 18cb8a1b9b [JS IR] Add flag with writing base class to metadata 2021-05-20 16:37:45 +03:00
Ilya Goncharov 228c6879f5 [JS IR] Add per-module output module name 2021-05-20 16:37:44 +03:00
Ilya Goncharov 0e00186ca1 [JS IR] Fix compilation after rebase 2021-05-20 16:37:39 +03:00
Anton Bannykh 0182c09318 [JS IR] fix name clashes for imported external declarations 2021-05-20 16:37:38 +03:00
Anton Bannykh 6e40c814c8 [JS IR] add a flag which prepends a custom prefix to the per-module .js files 2021-05-20 16:37:37 +03:00
Anton Bannykh 7bd9462ffb [JS IR] save the desired JS output file name in the klib.
This is only usedful for code splitting. The output .js file name
is provided by the build system during the module compilation.
It is desirable to keep the .js output file names same as in old BE,
but calculating those name during the klib -> js phase is tricky.

Thus the desired names are saved in the klib, and used later on.
2021-05-20 16:37:35 +03:00
Anton Bannykh 6633a9edc0 [JS IR] add a flag which enable safe property access
If an accessor is not available at runtime we fall back
to the property access.

This is useful in cases when JS objects are casted to Kotlin
classes implicitly. This pattern did work in the old BE, which
lead to a significant amount of code which doesn't work anymore.
2021-05-20 16:37:34 +03:00
Anton Bannykh 8b18818bcc [JS IR] add base class to the $metadata$.interfaces list
This is needed for better compatibility with the old BE.
Some code in Space relies on the $metadata$ format.
2021-05-20 16:37:32 +03:00
Ilya Goncharov 74d1812461 [JS IR] Review remarks
- Move origin to common place
- Add comments and todo about solution
- Remove MODULE directive from tests
- Add test with in-place using of js function
2021-05-17 16:51:22 +03:00
Ilya Goncharov 137532bfa6 [JS IR] Use separate origin for class reference to preserve constructors 2021-05-17 16:51:17 +03:00
Andi Wenger f9d2ca68ce KJS IR: Fix KT-45738 - Consider recursive checkForPrimitiveOrPattern
Recursive results from checkForPrimitiveOrPattern were ignored. If it found a case/condition that could not be optimized the resulting "false" was not propagated. This would lead to a "optimized" when without all conditions.
- see KT-45738
- The return is now lifted out of the when to make it more obvious what is going on.
- New test for mixed multiple conditions in when
2021-04-29 23:52:01 +03:00
Svyatoslav Kuzmich ccc27b6a0c [IR] Add module property to IrFile 2021-04-26 18:52:42 +03:00
Alexander Udalov 643c3f26c1 Remove dependency of backend.js on ir.tree.impl
By taking the instance of IrFactory either from SymbolTable, or passing
it from cli-js which depends on both ir.tree.impl and
ir.tree.persistent, and can choose the appropriate implementation.
2021-04-14 13:47:02 +02:00
Anton Bannykh c224dd4cb1 JS IR: JsMapping serialization 2021-04-09 19:54:15 +03:00
Anton Bannykh 387b84b37c JS IR: simplify DCE root calculation 2021-04-09 19:54:13 +03:00
Ilya Gorbunov e450a6494a Migrate deprecations in core, compiler, idea, tests
Replacing deprecated Char.toInt() with Char.code and
Number.toChar() with Number.toInt().toChar(), where Number is not Int.

KT-23451
2021-04-07 18:30:20 +03:00
Ilya Goncharov 368ac36204 [IR] Remove IrExpressionWithCopy and replace with shallowCopy method 2021-03-31 20:14:55 +03:00
Ilya Goncharov 084d824984 [IR] Use deepCopyWithSymbols in IrTypeOperatorCall 2021-03-31 20:14:54 +03:00
Ilya Goncharov 47f1a8a0bb [IR] Make IrTypeOperatorCall copyable
^KT-45655 fixed
2021-03-31 20:14:52 +03:00
Ilya Goncharov 8ac8dbdab8 [JS IR] Type operator call pureness 2021-03-19 21:52:51 +03:00
Ilya Goncharov 47d050c420 [JS IR] Correct pureness of expressions for arrayLiteral 2021-03-19 21:52:50 +03:00
Ilya Goncharov f890156dde [JS IR] arrayConcat not use additional slice 2021-03-19 21:52:50 +03:00
Ilya Goncharov ece0e200d5 [JS IR] Not nullize external varargs if it is not on the end of call 2021-03-19 21:52:50 +03:00
Ilya Goncharov b8d5712bc0 [JS IR] Not use double slice for external varargs 2021-03-19 21:52:50 +03:00
Ilya Goncharov 120b5b9e05 [JS IR] Move isPure check to backend.common and add platform-specific check on calls with side effects 2021-03-19 21:52:50 +03:00
Ilya Goncharov 7bbb5b77db [JS IR] Concat varargs with non varargs on compile time for function w/o receiver 2021-03-19 21:52:50 +03:00
Ilya Goncharov fc559ab0cd [JS IR] Unite varargs and non varargs before vararg 2021-03-19 21:52:49 +03:00
Ilya Goncharov 88abb3d6c9 [JS IR] Fix creating of classes extended from nested one
[JS IR] Extract getClassRef method

 ^KT-44950 fixed
2021-03-18 21:14:00 +03:00
Svyatoslav Kuzmich 6bd34db725 [JS IR] Fix kotlin.js.js with complex constant expressions
Use IR interpreter to evaluate complex constexprs
2021-03-17 15:12:18 +03:00
Ilya Goncharov ead0b50107 [JS IR] In file:JsModule top level with fresh names 2021-03-12 12:57:56 +03:00
Alexander Udalov bf844aa8e4 JVM IR: prevent behavior change with operator dot calls on literals
#KT-42321 Fixed
2021-03-10 18:46:30 +01:00
Alexander Udalov f332192de8 IR: remove SourceManager, make PsiSourceManager a singleton 2021-03-05 20:46:33 +01:00
Shagen Ogandzhanian 2a170652c5 Don't create IIFE for varags at all when it possible
^KT-40689 fixed
2021-03-02 22:13:32 +03:00
Shagen Ogandzhanian cac57e4178 Don't create externalVarargReceiverTmp when there's no need to create it
^KT-40689 fixed
2021-03-02 22:13:31 +03:00
Shagen Ogandzhanian 6255f2bd77 Simplify JsInvocation in case we not it's Array
^KT-40689 fixed
2021-03-02 22:13:30 +03:00
Shagen Ogandzhanian e98413740b Pass scope to the call of iifeFun only when it make sense
^KT-40689 fixed
2021-03-02 22:13:29 +03:00
Shagen Ogandzhanian 1dbe7d12a2 Simplify concatElements resolution for size=0 and size=1 cases
^KT-40689 fixed
2021-03-02 22:13:28 +03:00
Shagen Ogandzhanian bcfc0c21b1 Don't add to the concatenation chain empty arraysForConcat at all
^KT-40689 fixed
2021-03-02 22:13:26 +03:00
Shagen Ogandzhanian d71fa4831d Filter out empty arrays before concatentating
^KT-40689 fixed
2021-03-02 22:13:25 +03:00
Shagen Ogandzhanian 31f5bcfaef Minor cosmetic readability fixes in VarargLowering
^KT-40689 fixed
2021-03-02 22:13:24 +03:00
Shagen Ogandzhanian c996161db0 Unroll any constructor call if argument is JsArrayLiteral
^KT-40689 fixed
2021-03-02 22:13:23 +03:00
Shagen Ogandzhanian 997d23eb43 Simplify signatures for arrays in argumentsWithVarargAsSingleArray
^KT-40689 fixed
2021-03-02 22:13:22 +03:00
Anton Bannykh b0e0e62c0b Propagate isExternal flag in Psi2Ir and deserializer 2021-03-02 14:30:16 +03:00