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
Anton Bannykh
df62b5e311
JS IR: special origins for declaration created during lowerings
...
Otherwise the lazy properties lowering may try to process them
2021-02-24 18:32:56 +03:00
Ilya Goncharov
187d4998fa
[JS IR] Not cast to declaration parent in JsCodeOutlineLowering, use parent otherwise
...
^KT-45057 fixed
2021-02-20 13:08:45 +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
Georgy Bronnikov
4c701cf44c
IR: make extractedLocalClasses a JS-only field
2021-02-17 11:05:22 +03:00
Georgy Bronnikov
d154c8d8e6
IR: copy each file before lowering.
...
Avoid inter-file dependencies while lowering.
2021-02-17 11:03:27 +03:00
Anton Bannykh
c06b345f3c
Hide stageController into the IrFactory
2021-02-17 10:42:50 +03:00
SokolovaMaria
15aaf3a078
Copy typeParameters from original declaration to the exportedDefaultStubFun before substitution of type parameters
2021-02-15 23:17:11 +03:00
Ilya Goncharov
76b124a9c0
[JS IR] Method of any is exported
...
^KT-44616 fixed
2021-02-08 13:40:39 +03:00
Ilya Goncharov
6c051b2be4
[JS IR] Override method are not exported
...
[JS IR] Add test with jsexport overrides not js export method with stable name
^KT-44616 fixed
2021-02-08 13:38:30 +03:00
Svyatoslav Kuzmich
cdb488149f
[JS IR] Namer improvements
...
- Compute and store local names locally when translating a body.
It is a step towards separate JS generation and hopefully reduces memory usage.
- Use stable mangled names for member names. Needed for separate JS generation.
- Add `abstract class IrNamerBase` with just 3 abstract methods to simplify
creating new IrNamer implementations.
- Fix O(N^2) of findFreshName when it is called wtih the same name suggestion a lot of times.
- Refactor NameTables initialisation: factor out some functions and use descriptive names.
- Use StringBuilder in sanitizeName
2021-02-04 16:17:01 +03:00
Svyatoslav Kuzmich
8be7e6064e
[JS IR] Optimize sanitization
...
- Use direct function call instead of lambda
- Don't do anything for already valid names
2021-02-04 16:16:00 +03:00
Svyatoslav Kuzmich
2a424ad2af
[IR] Make isExternal mutable and accessible via common interface
...
JS IR: Mark all effectively external declarations as external to access it
directly instead of computing it every time
2021-02-04 16:15:33 +03:00
Svyatoslav Kuzmich
924a7b009b
[JS IR] Fix object getInstance visibility
2021-02-04 15:41:22 +03:00
Victor Turansky
7523a5e97f
KT-40235 Fix external interface companion support
2021-02-03 20:36:24 +03:00
Ilya Goncharov
d6e74b9620
[JS IR] Use local scope for SAM if there are scopes
...
[JS IR] Use private for top level sam wrappers and local otherwise
^KT-44433 fixed
2021-02-03 12:13:52 +03:00
Roman Artemev
ba5193870e
[IR] Drop unused language version settings parameters from DependenciesGenerator
2021-02-02 12:05:34 +03:00
Ilya Goncharov
5fa9acc17a
[JS IR] Add additional exported declarations inside dce loop
...
[JS IR] Remove useless filter in dce for more log information
^KT-44469 fixed
2021-01-28 18:56:34 +03:00
Ilya Goncharov
d88d1d048e
[JS IR] Context to NameTables for stable names in additional exported declarations
...
[JS IR] BridgesConstruction with generic without cast
^KT-44469 fixed
2021-01-28 18:56:21 +03:00
Ilya Goncharov
f186047101
[JS IR] Add additional exported declarations with exported stub to dce
...
^KT-44469 fixed
2021-01-28 18:56:01 +03:00
Ilya Goncharov
6e98b81f3a
[JS IR] Use recursive isExported for stable name detection
...
^KT-44469 fixed
2021-01-28 18:55:48 +03:00
Svyatoslav Kuzmich
4bde884844
[JS IR] Use non-persistent IR for non-dce-driven mode
...
Eliminate overhead of persistency that we don't use in this mode.
2021-01-27 14:58:33 +03:00
Svyatoslav Kuzmich
02615ec569
[JS IR] Fix: Use proper parameter in ExportedDefaultParameterStub
2021-01-27 14:57:42 +03:00
Svyatoslav Kuzmich
f85263ca7f
[JS IR] Add fast path to JsCodeOutliningLowering
2021-01-25 19:18:44 +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
Ilya Goncharov
aa1e23d9b0
[JS IR] Use origins for bridge with and without stable names
...
^KT-44415 fixed
2021-01-25 15:16:47 +03:00
Ilya Goncharov
57fdabdace
[JS IR] Add BRIDGE origin as ignore for stabitility of names
...
^KT-44415 fixed
2021-01-25 15:16:35 +03:00
Alexander Udalov
221f44da5f
Fix warnings in stdlib/compiler/plugins/test code
2021-01-13 19:18:20 +01:00
Svyatoslav Kuzmich
2d88ff6fb2
[JS IR] Fix unsgined integer default arguemtns (KT-44180)
...
Const lowering didn't exprect null constants with unsigned number
types and crashed with NPE. This commit fixes that.
2021-01-12 15:42:31 +03:00
Shagen Ogandzhanian
96de9144de
[JS IR] Generate stub for exported functions with default params
...
see https://youtrack.jetbrains.com/issue/KT-43407
2020-12-31 20:21:21 +01:00
Shagen Ogandzhanian
e7dc199ad7
Init enum entries whenever we access companion object or accessing valueOf
...
Fixes https://youtrack.jetbrains.com/issue/KT-43987
Fixes https://youtrack.jetbrains.com/issue/KT-43989
2020-12-30 14:54:34 +01:00
Zalim Bashorov
02849edc22
[IR] Make descriptor parameter optional for IrFileSymbolImpl and IrExternalPackageFragmentSymbolImpl
...
Remove DescriptorlessIrFileSymbol and use IrFileSymbolImpl instead.
2020-12-28 18:53:54 +03:00
Zalim Bashorov
14254ceb0b
[IR] Remove no longer needed usages of ObsoleteDescriptorBasedAPI
2020-12-28 18:53:54 +03:00
Zalim Bashorov
0372dae3ce
[JS scripting] Remove usages of descriptor based APIs and proper support for callable references
2020-12-28 18:53:53 +03:00
Svyatoslav Kuzmich
0945c110bf
[JS IR] Support init blocks in inline classes
2020-12-25 17:00:23 +03:00
Zalim Bashorov
274b09cf36
[JS IR] Support generating JS expression from IrComposite
...
Except the case when it's empty.
2020-12-24 20:03:23 +03:00
Zalim Bashorov
d7e3f826bb
[JS IR] Generate jsClass function inside the compiler instead of relying on declaration inside stdlib
...
We want to make its type parameter reified to do it we have to make it inline and non-external.
But we don't want to inline it in call sites and want prevent using it anywhere except places generated by the compiler.
In user code, including stdlib, we should use `K::class.js` instead.
Separately we have to intrinsify `K::class.js` to reduce overhead.
2020-12-24 20:03:23 +03:00
Zalim Bashorov
df6635085b
[JS IR] Replace calls with invalid type arguments for type parameters with call to errorCode function from runtime.
2020-12-24 20:03:22 +03:00
Zalim Bashorov
ff77155b5a
[JS IR] A type argument of the jsClass intrinsic must be a class (IrClass)
2020-12-24 20:03:22 +03:00