The patch adopts and reuses the optimizations from the legacy backend.
The optimizations remove useless temporary variables,
statements and simplify generated JS code.
The optimizations can be disabled by `-Xoptimize-generated-js=false`.
Related to KT-51139
We will need it to generate original names for catch parameters in
sourcemaps.
Also, don't generate redundant debug info for compiler-generated
exception handling control flow operators.
See the doc comment to the MultipleCatchesLowering class
#KT-46276
- Map generated explicit Unit returns to the closing brace of
the original body
- Name the continuation parameter as `$completion` to match the JVM BE,
and generate debug info for it (so that it appears in the 'names'
array in sourcemaps)
- Don't generate debug info for coroutine instantiation ceremony
(so that the user doesn't need to step in many times to get where they
want)
#KT-46276
Namely:
- Generate debug info for closing braces, which allows the breakpoints
set on closing braces to be hit
- Generate debug info for 'if' and 'try/catch' statements.
KT-46276
Unit materialization for IrCall is required for operations with dynamic type.
However it produces useless Unit_getInstance() calls,
especially in return expressions. The pach also adds some heuristics
for reducing the amount of Unit_getInstance() calls from return expressions:
do not add Unit_getInstance() if return value has Unit type.
Relaited to KT-51139
^KT-23252 Fixed
[JS IR] Fix line number test
[JS IR] Ignore isInstance repl test
[JS IR] Ignore isInstance repl test
[JS IR] Add test with unsafe variance
Revert "[JS IR] Optimize away upcasts"
This reverts commit 8149189585.
Get rid of duplicated signatures
Revert "[JS IR] Consider erasing type parameters in return type in js signatures"
This reverts commit 6adcbe081e.
Revert "rra/ilgonmic/exported-bridges-2 [JS IR] Use js name for signature"
This reverts commit 00289d35
[JS IR] Leave as is
[JS IR] Add test with overloading by generic
[JS IR] Add test from master
[JS IR] Add tests from master
Merge-request: KT-MR-5987
Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com>
^KT-51700 fixed
^KT-51523 fixed
^KT-51685 fixed
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.
- 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
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.