Alexey Andreev
3b2d634cea
JS: optimize variable representation in coroutines
...
Don't convert local variables to fields of coroutine object
when variable is both used and defined in a single block.
2017-09-26 13:56:20 +03:00
Alexey Andreev
b852f73dd2
JS: make string template optimization more conservative
...
See KT-18548
2017-09-26 13:56:20 +03:00
Alexey Andreev
95566b1374
JS: fix serialization of fileId in case of incremental compilation
2017-09-26 13:56:19 +03:00
Alexey Andreev
ee4d790f43
JS: optimize default arguments in cross-module inliner
...
This reduces size of circlet UI (of approx 2.5 mb) by about 90 kb
2017-09-25 11:29:05 +03:00
Alexey Andreev
e6ab3dc936
JS: generate aliases for intrinsics.
...
This makes generated code more friendly to UglifyJS.
For example, uglified circlet loses 15 kb.
2017-09-25 11:29:04 +03:00
Alexey Andreev
c5e5a43f68
JS: fix unit materialization in case of null check and elvis operator
...
See KT-20287
2017-09-19 15:30:55 +03:00
Alexey Andreev
b4c622d433
JS: optimize destructuring declaration when possible
...
See KT-8285
2017-09-19 15:30:26 +03:00
Alexey Andreev
9771a3c66e
JS: prove that KT-8282 is no more reproducible
2017-09-18 13:13:00 +03:00
Alexey Andreev
aa35d4ed36
JS: prove that KT-8315 is no more reproducible
2017-09-18 13:13:00 +03:00
Anton Bannykh
2249675e59
JS: throw exception when accessing uninitialized lateinit property (KT-14964)
2017-09-13 20:16:01 +03:00
Alexey Andreev
37fa45dc34
Add mechanism for type coercion in JS
...
Use it for char boxing/unboxing and unit materialization.
Possible to use for other purposes, for example, to add type checks
to dynamics.
See KT-18793, KT-17915, KT-19081, KT-18216, KT-12970, KT-17014,
KT-13932, KT-13930
2017-09-11 14:34:34 +03:00
Alexey Andreev
24c6f5f0f0
JS: add test to prove that KT-19483 is no more reproducible
2017-09-08 18:27:43 +03:00
Alexey Andreev
1350e3c4ac
JS: improve optimization of for loop over range literals
...
See KT-18329, partial fix for KT-8372
2017-09-08 18:27:40 +03:00
Alexey Andreev
502c51ccff
Sanitize names for backing fields and private declarations in JS BE
...
See KT-1816
2017-09-08 18:27:40 +03:00
Alexey Andreev
206369c088
JS: fix capturing of reified type parameters when used as class literals
...
See KT-19891
2017-09-08 18:27:39 +03:00
Alexey Andreev
d2ff821a3b
JS: prove that lambdas in inline function compiled correctly
...
Obsoletes KT-19712
2017-09-08 10:57:42 +03:00
Alexey Andreev
ff0efe59f6
JS: fix error in generation of if/else statements in some cases
...
See KT-19495
2017-09-08 10:56:49 +03:00
Alexey Andreev
4779f4fefb
JS: don't mark access to captured var as pure
...
See KT-19108
2017-09-08 10:56:06 +03:00
Alexey Andreev
5bf4540458
JS: fix inlining of functions derived from other modules
...
See KT-16408
2017-09-06 17:55:31 +03:00
Alexey Andreev
b8aa2f81a2
Fix delegate property name clash in JS BE
...
See KT-19542
2017-09-04 15:35:35 +03:00
Alexey Andreev
5a984a40e6
Fix JS compiler crash when translating external object fun with vararg
...
See KT-19793
2017-09-04 15:34:10 +03:00
Alexey Andreev
989cebe79e
JS: fix bug in temporary variable eliminator
...
The problem was in considering `a` as trivial in following case:
```
var a = b;
```
However, that's wrong assumption, since `b` can be temporary variable
itself which is further substituted by a non-trivial expression.
2017-09-04 15:33:16 +03:00
Alexey Andreev
abb254297a
Properly rename local name aliases when merging JS fragments together
2017-09-04 15:33:16 +03:00
Alexey Andreev
593aa72439
Fix bug in new JS inliner when inlining nested calls
2017-09-04 15:33:15 +03:00
Alexey Andreev
918ce78c5a
Support inlining internal functions to friend modules in JS BE
...
There's one exception: if an inline internal function calls
private function, this will fail at run time.
2017-09-04 15:33:13 +03:00
Alexey Andreev
7646c2fc72
Use local aliases for Kotlin runtime functions in JS BE
2017-09-04 15:33:11 +03:00
Alexey Andreev
8c256b24dc
Avoid duplication of imports introduced during JS inlining
2017-09-04 15:33:10 +03:00
Alexey Andreev
b90885d1cb
Support new inline function format in JS DCE tool
2017-09-04 15:33:09 +03:00
Alexey Andreev
901346243d
JS: fix inlining of function that calls functions from other modules
2017-09-04 15:33:08 +03:00
Alexey Andreev
834cd1d93d
Fix testdata for new JS inliner
2017-09-04 15:33:07 +03:00
Alexey Andreev
eb6186b74d
Fix translation of classes to work with new JS inliner
2017-09-04 15:33:05 +03:00
Alexey Andreev
7c421b0b83
Refactor JS translator to generate code for new inliner
2017-09-04 15:33:03 +03:00
Alexey Tsvetkov
1c4ada2008
Fix searching serialized classes package contains multiple fragments
2017-08-29 04:28:03 +03:00
Ilya Gorbunov
baa6b44567
Deprecate CharSequence.size in JS
...
#KT-18267 Fixed
2017-07-24 21:14:45 +03:00
Anton Bannykh
e43a145614
fixup: updated EXPECTED_REACHABLE_NODES
2017-07-19 12:24:09 +03:00
Alexey Andreev
7634673213
Fix module re-importing when inlining functions in JS BE
...
When inliner reads function's body from other module, it performs
substitution _ -> moduleAlias. However, local alias can't be used
for this purpose, since call site can be in public inline function
itself, so the correct substitution would be -> _.$$imports$$.alias
2017-07-11 19:27:08 +03:00
Alexey Andreev
20842dcc44
Add module name as a prefix to declaration keys in JS translator
...
This is necessary due to different modules can have same
package declarations. When importing declarations from these
packages, we should distinguish from which module we are importing it.
See KT-18652
2017-06-26 18:16:00 +03:00
Alexey Andreev
a0e1bde594
Allow to embed source files into JS source maps
2017-06-26 18:15:28 +03:00
Alexey Andreev
3ae214b97a
Fix reified parameters with non-identifier names in JS
...
See KT-18169
2017-06-20 10:41:52 +03:00
Alexey Andreev
d3a5201ecc
Intrinsify String?.plus in JS BE
...
See KT-8020
2017-06-20 10:40:21 +03:00
Alexey Andreev
b6d12fe7f3
Fix bug in re-importing modules from inline declarations in JS
...
Fix another case in KT-18201
2017-06-06 13:36:19 +03:00
Alexey Andreev
3180ea24d1
Fix assertion in test for reimporting declarations in JS
2017-06-05 11:21:41 +03:00
Alexey Andreev
1df6f2f9a0
JS BE: expose imported modules via $$importsForInline$$ property
...
... and use it as prefix to FQN in inline functions. This allows
to properly inline function declared in module A to module B,
when this function calls another function in module C.
See KT-18201
2017-06-02 14:18:42 +03:00
Alexey Andreev
4bb1130f3f
Fix translation of labels with non-identifier names in JS BE
...
See KT-18027
2017-05-29 15:37:31 +03:00
Alexey Andreev
a0ddbf0e9b
Fix handling non-ES5 identifiers in JS
...
When a Kotlin identifiers contains non-ES5 chars, JS BE
either reports error (for published declarations) or mangles name
(for non-published ones). The old approach relied on wrong
assuption that Java identifier = ES identifier.
However, that's not true. This commit introduces functions that
check identifiers according to ES5.1 spec rather than
using Character.isIdentifierStart[Part]
See KT-17476
2017-05-29 15:37:29 +03:00
Alexey Andreev
dde50a34db
Fix comparison of boolean values in JS BE
...
See KT-16984
2017-05-26 18:26:08 +03:00
Alexey Andreev
f5510b8d66
Fix translation to JS of call to top-level fun with vararg and @JsModule
...
See KT-17871
2017-05-26 18:24:15 +03:00
Alexey Andreev
9181140387
Suppress some DCE tests that can't pass
2017-05-26 18:20:21 +03:00
Alexey Andreev
e2c2fcf1ff
Generate EXPECTED_REACHABLE_NODES directive on JS box tests
2017-05-26 18:20:20 +03:00
Alexey Andreev
ca7062d776
Fix JS parser to properly handle "." <keyword> sequence
2017-05-26 18:20:16 +03:00