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
ed592452a3
Fix JS source maps for functions with expression body
2017-05-30 12:48:59 +03:00
Alexey Andreev
1014666937
Fix JS source maps for delegates and backing fields
2017-05-30 12:48:58 +03:00
Alexey Andreev
13795b47fb
Fix JS source maps for initialization of variables captured by class
2017-05-30 12:48:58 +03:00
Alexey Andreev
bfc3a9c2af
Fix JS source maps for && expression with complex operands
2017-05-30 12:48:57 +03:00
Alexey Andreev
1111f2d5cd
Fix JS source maps for while/do..while statements
2017-05-30 12:48:57 +03:00
Alexey Andreev
413ac40c25
Fix JS source maps for for statements
2017-05-30 12:48:56 +03:00
Alexey Andreev
d7a10750e0
Fix JS source maps for lambdas
2017-05-30 12:48:55 +03:00
Alexey Andreev
82d37c0d57
Fix JS source maps for catch blocks
2017-05-30 12:48:55 +03:00
Alexey Andreev
6ad991adfb
Fix JS source maps for "is" and "in" clauses in when expression
2017-05-30 12:48:54 +03:00
Alexey Andreev
9692c02f6e
Fix JS source maps for string literals
2017-05-30 12:48:53 +03:00
Alexey Andreev
8dae399945
Fix generation of JS source maps for default parameters
...
(Of open member functions)
2017-05-30 12:48:52 +03:00
Alexey Andreev
e1009622af
Fix generation of JS source maps for call expressions
2017-05-30 12:48:52 +03:00
Alexey Andreev
6e489900cb
Fix generation of JS source maps for long literals
2017-05-30 12:48:51 +03:00
Alexey Andreev
89e3fb7592
Keep JS AST source information after refreshing local names
2017-05-30 12:48:51 +03:00
Alexey Andreev
ad89e5906f
Fix JS source maps for increment expression used as statement
2017-05-30 12:48:50 +03:00
Alexey Andreev
bad79dfa85
Fix JS source maps for return statement of inlined function
2017-05-30 12:48:49 +03:00
Alexey Andreev
5a4d3c5391
Generate JS source maps for object instance function
2017-05-30 12:48:49 +03:00
Alexey Andreev
77df0f28bf
Fix generation of JS source maps for class properties
2017-05-30 12:48:48 +03:00
Alexey Andreev
6f8ccfb80d
Add test for JS source maps for literals
2017-05-30 12:48:47 +03:00
Alexey Andreev
3077a0f640
Fix generation of JS source maps for suspend functions
2017-05-30 12:12:49 +03:00
Alexey Andreev
28140b0883
Fix generation of JS source maps for closures
2017-05-30 12:12:34 +03:00
Alexey Andreev
3a7df13440
Fix generation of source maps for synthetic code in enums in JS BE
2017-05-30 12:12:33 +03:00
Alexey Andreev
fb3a864892
Fix generation of JS source maps for synthetic code in constructors
2017-05-30 12:12:32 +03:00
Alexey Andreev
4332f1cb2c
Don't share instances of JsNameRef nodes to avoid wrong source maps
...
When to name references to the same name are represented by
a shared JS AST node, setting line number of the second usage may
override line number of the first usage.
Also, supply more JS AST nodes related to default parameters,
with corresponding source information.
2017-05-30 12:12:30 +03:00
Alexey Andreev
e5662ac2ad
Copy location info when copying JS AST subtrees
...
This is necessary to preserve source information of a function's body
after inlining.
2017-05-30 12:12:28 +03:00
Alexey Andreev
9218b61141
Add tests for source maps in JS BE
2017-05-30 12:12:27 +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
e2fc808d83
Add simple test infrastructure for JS DCE
...
Add test infrastructure that allows to test handwritten JS
to test various small aspects of DCE, as opposed to box tests
which test kotlin stdlib + kotlin generated examples
2017-05-26 18:20:30 +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
Anton Bannykh
419f12f1b7
JS: fix char to string convertion in string templates (#KT-17966 fixed)
2017-05-22 13:57:36 +03:00
Anton Bannykh
e098de5e33
JS: fix char boxing in elvis expressions (#KT-17700 fixed)
2017-05-11 21:31:38 +03:00
Alexey Andreev
2c10f253c5
Fix node.js tests on Windows agents in Teamcity
2017-05-10 16:46:49 +03:00
Anton Bannykh
2e9a59819a
JS: support internal visibility from friend modules
...
Friend modules should be provided using the -Xfriend-modules flag
in the same format as -libraries. No manual configuration required for
JPS, Gradle and Maven plugins.
Friend modules could be switched off using the -Xfriend-modules-disabled
flag. Doing that will
* prevent internal declarations from being exported,
* values provided by -Xfriend-modules ignored,
* raise a compilation error on attemps to use internal declarations from other modules
Fixes #KT-15135 and #KT-16568.
2017-05-04 21:44:17 +03:00
Alexey Andreev
6047746c90
Fix optimization in JS BE
...
Don't apply while condition folding when corresponding break
statement breaks outer loop.
2017-04-28 10:52:13 +03:00
Alexey Andreev
d89ce80d97
Fix temporary variable elimination in JS BE
...
Don't eliminate temporary variable when between its usage and its
definition there's assignment to a non-local variable.
Fix KT-17540
2017-04-28 10:51:30 +03:00
Zalim Bashorov
678d2e7c21
KJS: transform labeled blocks to labeled do-while
...
It's a workaround for JDK-8177691.
Such code can appear during inline.
2017-04-26 13:07:33 +03:00
Zalim Bashorov
76fa6ad5c2
KJS: switch to using Nashorn instead of Rhino for JS backend tests
2017-04-26 13:07:30 +03:00
Alexey Andreev
38aecb14a2
Improve Number.hashCode implementation in JavaScript
...
Fix KT-13577
2017-04-26 11:52:54 +03:00
Alexey Andreev
feb968e66d
JS: fix generation of names for local declarations
...
Local declarations obtain names prefixed with outer function's name.
Only simple name (i.e. without mangling) of outer function used
in this case. This raises a problem in case of inline functions
with object literals. Currently, they are not copied, but exported
from module. Consider two inline functions foo with different
signatures, both declare object literals. In this case both literals
are exported as foo$f, so only one will be accessible from outside.
2017-04-24 18:39:04 +03:00
Alexey Andreev
df46417cd7
JS: fix NPE in incremental compilation
...
Fix NPE when compiling project incrementally and a file which
is not recompiled contains try/catch statement
2017-04-24 18:39:03 +03:00
Alexey Andreev
1c2120d7e2
JS: avoid repeated export of the same declaration
2017-04-24 18:30:42 +03:00
Alexey Andreev
0058d2fdf6
JS: add some tests to ensure that AST metadata is correctly serialized and deserialized and visible to JS optimizer
2017-04-24 18:29:52 +03:00