Commit Graph

75 Commits

Author SHA1 Message Date
Ilmir Usmanov d67e4f0c48 Rename inline class -> @JvmInline value class in stdlib and compiler 2021-02-25 16:06:51 +01:00
Ilya Gorbunov 87e130e77a Remove obsolete diagnostics suppression
The diagnostic NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS is now
obsolete because internal constructors of inline classes became allowed.
2021-02-03 18:23:53 +03:00
Ilya Gorbunov 2f3e1dcbc6 Add EXACTLY_ONCE contract to suspendCoroutine* functions
Update line numbers in the affected test.
2020-07-10 01:05:16 +03:00
Dmitry Petrov 202bbdf8dd Forward compatibility hacks for Result.{success, failure}
Don't mangled functions annotated with @JvmName.
Annotate 'Result.success' and 'Result.failure' with @JvmName and
@Suppress("INAPPLICABLE_JVM_NAME").
NB this would require bootstrap.
2020-06-04 12:16:27 +03:00
Roman Artemev 46b98a1e98 [JS BE] Make sourceMap generation more precise
- Don't produce mapping for closing bracket in case of expressionBody
 - Map Kt*Function declaration into corresponding js fun declaration
 - Update test data & add new test
2019-07-24 18:56:40 +03:00
Roman Artemev af45e1c5dc [JS BE] Do not produce source mapping for fake KtElement
Fix [KT-26701], [KT-12935]
2019-07-17 10:21:34 +03:00
Anton Bannykh b5b770c804 JS: line number fix 2019-02-14 15:14:28 +03:00
Anton Bannykh cd0fd569b4 JS: visit tests and main in import remover; update line numbers 2019-02-14 15:14:28 +03:00
Ilya Gorbunov beec6a7c4a Update line numbers after reformatting coroutines stdlib sources 2018-11-28 06:05:03 +03:00
Anton Bannykh 829bdf6061 JS: fix noInline version of inline suspend fun (KT-27611 fixed) 2018-11-07 12:34:00 +03:00
Roman Artemev 4c30888d89 Fix test data 2018-10-19 19:38:00 +03:00
romanart 47b8e54f84 Update test data 2018-10-17 18:33:52 +03:00
Anton Bannykh 66b5dd92d9 JS: fix line number data 2018-09-19 13:57:43 +03:00
Anton Bannykh 65f98a285a JS: fix test by using release coroutines 2018-09-11 15:29:48 +03:00
Roman Artemev d0ce5d5a4d Fix test data 2018-09-11 14:29:47 +03:00
Anton Bannykh 8975a6e17e JS: adapt to 1.3 coroutines API
Also update a line number test
2018-08-30 16:24:43 +03:00
Ilmir Usmanov 8fa3584c5c Minor. Fix test 2018-07-16 15:09:23 +03:00
Alexey Tsvetkov 87558873b5 Fix source element for JsSwitch generated from 'when'
Before this change we set JsSwitch source to subject's JsExpression.
We ignore these types of source elements during:
1. js ast serialization (see 'JsAstSerializer.extractLocation');
2. source map generation (see 'SourceMapBuilderConsumer.addMapping').

However we might add indent during source generation
(see 'JsToStringGenerationVisitor.pushSourceInfo').

That seemingly broken 'testEnumEntryRemoved' in
'IncrementalJsCompilerRunnerTestGenerated.ClassHierarchyAffected',
because deserialized ast during incremental build would not
have source element at all (JsExpression was ignored), but ast
during rebuild would have JsExpression source element.
2018-04-19 05:18:54 +03:00
Anton Bannykh 04cbea4956 JS: fix Long constant translation (KT-19228 fixed) 2018-03-15 14:58:10 +03:00
Alexey Andreev 88441da131 JS: cache PropertyMetadata objects in property delegates
Also, remove unused PropertyMetadata instances

See KT-20737, KT-20738
2017-11-21 12:21:22 +03:00
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