105 Commits

Author SHA1 Message Date
Alexey Andreev 38e50e964a JS: fix generation of source map for inline lambda with ignored result
See KT-21309
2017-11-21 12:15:25 +03:00
Alexey Andreev 678b4c67c1 JS: translate when to JsSwitch when possible
See KT-21160
2017-11-17 11:07:38 +03:00
Alexey Andreev 132285ea03 JS: optimize loop over array.withIndex()
See KT-20932
2017-11-03 17:36:05 +03:00
Alexey Andreev 27e319a279 JS: fix parsing of object literals in js() function.
Also, fix generation of source maps of content of js() function.

See KT-19794
2017-10-04 12:01:51 +03:00
Alexey Andreev 992cc61abc JS: prove that KT-15292 is no more reproducible 2017-09-29 14:32:48 +03:00
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 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 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 8c256b24dc Avoid duplication of imports introduced during JS inlining 2017-09-04 15:33:10 +03:00
Alexey Andreev 61ba6e528a Fix JS line number tests 2017-09-04 15:33:06 +03:00
Alexey Andreev ca63717124 Multiple fixes of JS source maps
- elvis expression with complex RHS
- destructuring declarations
- decomposition of `var` statement (for example, in case of
  inline destructuring functions)
- `is` LHS &&/|| inline fun RHS
- argument assignment to temporary var on inline call site
- assignment of `next()` result to temporary var in `for` expression
- rethrow statement in exception handler
2017-07-06 10:20:49 +03:00
Alexey Andreev f873834529 Fix JS source maps for objects and enums 2017-07-06 10:20:49 +03:00
Alexey Andreev d8fe7e55db Fix JS source maps for lambdas with captured variables 2017-07-06 10:20:48 +03:00
Alexey Andreev ec2a5bf0ee Fix JS source map for char boxing and unboxing 2017-07-06 10:20:47 +03:00
Alexey Andreev be7f3a787c Fix JS source maps for when expression 2017-07-06 10:20:46 +03:00
Alexey Andreev d613124cb1 Generate JS source maps for temporary vars declarations and definitions 2017-07-06 10:20:46 +03:00
Alexey Andreev 64f335380f Provide more source map info about statements in JS tests 2017-07-06 10:20:45 +03:00
Alexey Andreev fa95f78e78 Generate JS source map for if statement got from optional argument 2017-07-06 10:20:44 +03:00
Alexey Andreev 1e74325c52 Generated source map for JS function's closing curly bracket 2017-07-06 10:20:44 +03:00
Alexey Andreev 4e18ea2d04 Fix JS source map of decomposed conditional expression 2017-07-06 10:20:43 +03:00
Alexey Andreev 2122f57f51 Don't merge locations in JS source map test cases
Don't merge locations of containing if/while/do..while/for
statements with locations of conditions
2017-07-06 10:20:42 +03:00
Alexey Andreev dea73ebecf Refactor generator of JS source map
- refactor pipeline for generation of source map
- generate "empty" mappings for nodes that impossible
  to map to something reasonable
- generate more accurate locations in source maps for specific
  JS AST nodes
- for binary operation nodes parser now returns location
  of binary operator tokens instead of location of first operand
- change completely how source map remapper works
2017-07-06 10:20:41 +03:00
Alexey Andreev bf21cfd6e0 Use source map remapper in JS inliner 2017-06-07 11:13:55 +03:00
Alexey Andreev 9c4ec902b0 Fix test broken by changes in JS source maps 2017-06-07 11:13:54 +03:00
Alexey Andreev 27a44f3282 Fix JS source maps for complex enum entry 2017-06-07 11:13:47 +03:00
Alexey Andreev b70c52e41f Fix JS source maps for optional arguments
Also, when function has expression body, use expression instead
of function declaration to mark return statement.
2017-06-07 11:13:46 +03:00
Alexey Andreev 6f0e4c4deb Fix JS source maps for data class synthetic methods 2017-06-07 11:13:46 +03:00
Alexey Andreev 5bc6c07f9e Fix JS source maps for companion objects of enum 2017-06-07 11:13:45 +03:00
Alexey Andreev c9545f291a Fix JS source maps for properties without initializer 2017-06-07 11:13:44 +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