Commit Graph

411 Commits

Author SHA1 Message Date
Igor Chevdar ad8bcda99e [IR] Merged K/N inliner with the common one 2019-08-16 18:32:19 +03:00
Dmitry Petrov a9c961931c JS_IR: Support 'CHECK_NOT_NULL' intrinsic 2019-08-14 11:16:11 +03:00
Dmitry Petrov 7170439517 IR: '!!' is generated as 'CHECK_NOT_NULL' intrinsic
```
fun <T : Any> CHECK_NOT_NULL(x: T?): x =
  if (x != null) x else throw NullPointerException(...)
```

This allows to compile both Kotlin/JVM and Kotlin/JS effectively.
2019-08-14 11:16:10 +03:00
Dmitry Petrov f590d4da9e IR: IrTypeAlias: serialize/deserialize new IR objects
Add uniqId for typealias declarations.
Implement WrappedTypeAliasDescriptor.
2019-08-06 12:42:43 +03:00
Dmitry Petrov 2b43b09444 IR: IrTypeAlias: Strip 'typealias' declarations in back-ends 2019-08-06 12:42:02 +03:00
Steven Schäfer 9182fe887e Fix inline class handling in DefaultParameterInjector 2019-08-05 16:48:18 +03:00
Dmitry Petrov dd3f8ecaac IR BE Common: Provisional IrFunctionExpression lowering
Transforms IrFunctionExpression elements to local function references,
as it was done before IrFunctionExpression introduction.
2019-07-19 11:36:19 +03:00
Roman Artemev efafb6585e [JS IR BE] Refactored js("...") function
- support object expression
 - do not wrap in function in statement-level position
 - support implicit return
 - code clean up
2019-07-11 18:00:28 +03:00
Roman Artemev 946bc75cda [JS IR BE] Code clean up
- Remove hacks for unbound symbols in TypeOperatorLowering
 - Replace hacker intrinsics with dynamic operations
 - Fix return type for `Object$create` intrinsic
2019-07-11 18:00:28 +03:00
Roman Artemev 6ab46204cb [JS IR BE] Properly handle primary constructors
- force primary constructor to be created by codegen
 - make sure initializer is invoked once in primary constructor
 - make one of coroutine constructor primary
 - remove hack from codegen
2019-07-10 10:39:11 +03:00
Roman Artemev a112345418 [JS IR BE] Fix builtin constructor lowering
- Do not touch delegation construction call
2019-07-10 10:39:11 +03:00
Roman Artemev 131158df65 [JS IR BE] Refact MultipleCatchLowering
- catch dynamic type instead of common super type over all catch blocks
2019-07-10 10:39:11 +03:00
Roman Artemev 1605dc3251 [JS IR BE] Remove unused classifier symbol from IrTypeOperatorCall builder 2019-07-10 10:39:10 +03:00
Roman Artemev d9c6d38715 [JS IR BE] Fix private members lowering
- visit over file instead of class
2019-07-09 10:40:01 +03:00
Svyatoslav Kuzmich 675f01ee80 [JS IR BE] Set Throwable subtype name in extendThrowable function 2019-07-05 19:31:23 +03:00
Roman Artemev 8a569cc698 [JS IR BE] Do not create $default stub for external function and any its fake override 2019-07-04 22:59:12 +03:00
Roman Artemev 28a108a205 [JS IR BE] Visit callable reference members in private member lowering 2019-07-04 22:59:12 +03:00
Roman Artemev b4c68025a7 [JS IR BE] Improve error reporting 2019-07-04 22:59:12 +03:00
Svyatoslav Kuzmich 94aebd0101 [JS IR BE] Proper support for String and Any constructors
Remove workarounds from codegen
2019-07-04 17:03:47 +03:00
Svyatoslav Kuzmich 631a09e541 [JS IR BE] ThrowableLowering: Use dynamic operators instead of jsSetJSField intrinsic 2019-07-03 20:37:49 +03:00
Svyatoslav Kuzmich 871180cdc0 [JS IR BE] Fix setting names of Throwable subclasses without primary constructor 2019-07-03 20:37:49 +03:00
Svyatoslav Kuzmich 918d470e1b [JS IR BE] Simplify throwable lowering.
- Make kotlin.Throwable class extenral
- Add runtime function 'extendThrowable' to use instead of delegating
  constructors to Throwable
2019-07-03 20:37:48 +03:00
Svyatoslav Kuzmich 6d1f893a5a [JS IR BE] Move object instance creation lowerings to IR 2019-07-03 20:37:48 +03:00
Svyatoslav Kuzmich 5dcb0ee016 [JS IR BE] Reduce JsScope usage in codegen 2019-07-03 20:37:48 +03:00
Svyatoslav Kuzmich 69962cbf8c [JS IR BE] Add JsExport annotations 2019-07-01 18:55:41 +03:00
Svyatoslav Kuzmich 685597d20a [JS IR BE] Codegen class model refactorings
Reduce JsScope usage
2019-07-01 18:55:41 +03:00
Mark Punzalan 969478481e Move extension receiver to value parameters for static functions created
during InlineClassLowering phase.

This was the only place where both dispatch and extension receivers were
NOT moved to value parameters, which meant that the receivers were not
following the conventional ordering.

Merged createStaticBodilessMethod with createStaticFunctionWithReceivers
and the latter was moved to backend/common/ir/IrUtils.kt.
2019-07-01 13:24:08 +02:00
Mark Punzalan 1abdf0561a Generate synthetic functions for local functions with default values, by
re-ordering the lowering phases.

The changes in InterfaceLowering are necessary so that IrElements that
target the removed functions are re-targeted to the new functions in
DefaultImpls. This affects local functions in interface functions since
now LocalDeclarationsLowering comes before InterfaceLowering.
2019-07-01 13:24:08 +02:00
Alexander Udalov 9131ff3626 Move IrType.isNullable to 'ir.tree' 2019-06-27 16:43:06 +02:00
Mikhael Bogdanov 9b6fef005f Simplify LocalDeclarationsLowering, support declaration pop up via separate lower
1. Scheme of capturing local variables not touched
 2. Lowered local functions are transposed to the nearest class (including local) or file
 3. Local classes are also transpose to the nearest class (including local) or file
2019-06-27 08:07:01 +02:00
Anton Bannykh d6c10d24e1 JS IR: move inliner to common part; inline suspendCoroutineUninterceptedOrReturnJS 2019-06-26 13:13:39 +03:00
Dmitry Petrov b3b7e26985 Make InsertImplicitCasts work with Descriptors and KotlinTypes again
This is a temporary change to make sure IrType infrastructure work is in
master.

It causes some of irText tests to work incorrectly (as in master).
2019-06-26 10:07:13 +03:00
Dmitry Petrov 7a44b0f951 IR: IrTypeOperatorCall.classifierSymbol can be computed from typeOperand 2019-06-26 09:39:16 +03:00
Dmitry Petrov 760806a1ac IR: IMPLICIT_DYNAMIC_CAST
Generate IMPLICIT_DYNAMIC_CAST for implicit casts from `dynamic` to `T`
2019-06-26 09:39:16 +03:00
Roman Artemev 544443f113 [JS IR BE] Initialize module dependencies in the correct order 2019-06-24 20:14:19 +03:00
Svyatoslav Kuzmich 0b19a4a32b [JS IR BE] Initial version of member namer 2019-06-21 17:02:01 +03:00
Svyatoslav Kuzmich 3e10de9cd1 [JS IR BE] Fixup property accessors 2019-06-21 17:02:01 +03:00
Svyatoslav Kuzmich 84d48b8c7b [IR BE] Don't override private declarations 2019-06-21 17:02:01 +03:00
Svyatoslav Kuzmich 7796d084e1 [JS IR BE] Generate fileds for all properties 2019-06-21 17:02:01 +03:00
Svyatoslav Kuzmich 14ec30dd5a [JS IR BE] Lower property accessors in PrimitiveCompanionLowering 2019-06-21 17:02:01 +03:00
Svyatoslav Kuzmich 19b0bb8d0f [JS IR BE] Minor codegen refactoring 2019-06-21 17:02:01 +03:00
Roman Artemev 50ad21e388 [IR BE] Fix symbol remapping for IrField/IrProperty
- Use appropriate wrapped descriptor
 - Add test
2019-06-19 10:24:15 +03:00
Svyatoslav Kuzmich cd651be461 [JS IR BE] Migrate JS BE to common klib utils 2019-06-05 11:15:45 +03:00
Roman Artemev c2d118cb75 [JS IR BE] Improve error reporting 2019-05-31 13:14:43 +03:00
Roman Artemev 5686de7e09 [JS IR BE] Make kotlinx.io compile
- Fix expect/actual default arguments
 - Fix dynamic type in inliner
 - Fix external varargs
2019-05-31 13:14:43 +03:00
Dmitriy Novozhilov bd87332b0c Fix compiler errors in compiler detected after enabling @OnlyInputTypes in NI 2019-05-29 10:57:08 +03:00
Alexander Udalov 8dc34ae7b9 IR: rename {name,fqName}Safe -> {name,fqName}ForIrSerialization
These properties have a very specific detail in their behavior, in that
the constructor's name is set to be "<init>". While this is OK for the
IR serialization, this may not always be expected in other cases, and
their rather common names (`name`, `fqNameSafe`) suggested that these
properties could be used in generic contexts.

Change all usages outside IR serialization to use
`IrDeclarationWithName.name` and nullable
`IrDeclarationWithName.fqNameWhenAvailable` instead
2019-05-24 14:09:09 +02:00
Svyatoslav Kuzmich 7aed8d2f75 [JS IR BE] Fix lowering types nullability 2019-05-24 11:50:46 +03:00
Svyatoslav Kuzmich cd55e6b1e5 [JS IR BE] Use static fields instead of variables in enum lowering 2019-05-24 11:50:46 +03:00
Roman Artemev dfa38f4a4d [JS IR BE] Fix state machine generation in case of composition of loops, inline functions and finally blocks
* lower finally blocks in any cases
 * do not optimize exit blocks for if-statements
2019-05-22 15:18:13 +03:00