Commit Graph

1161 Commits

Author SHA1 Message Date
Svyatoslav Kuzmich 569187a751 [JS IR BE] Use Char boxing rules of current backend 2019-02-25 15:09:26 +03:00
Svyatoslav Kuzmich de020ed58a [JS IR BE] Generate and export JS properties 2019-02-25 15:09:26 +03:00
Svyatoslav Kuzmich fc5636b7c1 [JS IR BE] Fix: Don't generate built-in "Function" interface 2019-02-25 15:09:26 +03:00
Svyatoslav Kuzmich 1184c158e4 [JS IR BE] Support @JsName in bridges 2019-02-25 15:09:26 +03:00
Svyatoslav Kuzmich e09a6f0007 [JS IR BE] Fix codegen for external companion objects 2019-02-25 15:09:25 +03:00
Svyatoslav Kuzmich c4ffe36a21 [JS IR BE] Add CharSequence type check 2019-02-25 15:09:25 +03:00
Svyatoslav Kuzmich 74c8f54fc8 [JS IR BE] Support cast to native interface 2019-02-25 15:09:25 +03:00
Yan Zhulanow 47f0b68a8c Change mangling for destructured lambda parameters 2019-02-25 14:43:56 +03:00
Georgy Bronnikov 3531f47bfb Remove descriptors from ToArrayLowering 2019-02-23 00:42:16 +03:00
Georgy Bronnikov c3652a47c6 Remove descriptors from JvmStaticAnnotationLowering 2019-02-23 00:42:16 +03:00
Georgy Bronnikov 28bab6510e Remove descriptors from JvmOverloadsAnnotationLowering 2019-02-23 00:42:16 +03:00
Georgy Bronnikov f61072873f remove descriptors from createInnerClassConstructorWithOuterThisParameter 2019-02-23 00:42:16 +03:00
Georgy Bronnikov 72ea4cc3d7 Remove descriptors from BridgeLowering 2019-02-23 00:42:16 +03:00
Georgy Bronnikov c9b8f58a10 Restore overriddenSymbols consistency in InterfaceDelegationLowering 2019-02-23 00:42:16 +03:00
Georgy Bronnikov cb757f1cbc Remove descriptors from SyntheticAccessorLowering 2019-02-23 00:42:16 +03:00
Georgy Bronnikov 9078cb87e8 Remove descriptors from InitializersLowering 2019-02-23 00:42:16 +03:00
Georgy Bronnikov 5d7a736cb1 Remove desriptors from ObjectClassLowering 2019-02-23 00:42:16 +03:00
Georgy Bronnikov 5f4b8dd0aa Remove descriptors from EnumClassLowering 2019-02-23 00:42:16 +03:00
Dmitry Petrov b792f3f12f KT-30020 expressions without resolved calls in augmented assignment LHS
Augmented assignment operator (e.g., '+=') can be resolved to simple
function call ('plusAssign'). In that case, augmented assignment LHS
can be an arbitrary expression, and may have no associated ResolvedCall.

For example:
    (a as MutableList<Int>) += 42

Note that it can happen only in case of augmented assignment operator
convention resolution, because all other forms of assignment-like
operator desugaring require some kind of 'store' operation
(property setter, 'set' operator for array element expression, etc),
and should resolve to some combination of calls.

In that case we simply generate LHS on 'load', and throw assertion on
'store'.
2019-02-22 17:45:27 +03:00
Dmitry Petrov c248dd29c2 IR: declaration builders, initial iteration, use in some JVM lowerings 2019-02-21 16:03:11 +03:00
Igor Chevdar 1d0fdd7976 [IR] Some fixes to wrapped descriptors 2019-02-20 10:39:30 +05:00
Alexander Udalov d267f1e875 JVM IR: generate synthetic $annotations methods for properties 2019-02-19 17:25:47 +01:00
Alexander Udalov c92c50aa98 JVM IR: generate JVM signatures of companion object properties 2019-02-19 16:37:47 +01:00
Alexander Udalov c357967c2c JVM IR: generate Kotlin metadata
Introduce MetadataSource as a way to store the original descriptor for
any element (before any lowerings) and maintain it until the end of the
codegen where it's used in generating the metadata. Note that JVM
signatures written to the metadata are formed from the _resulting_
generated elements, not by mapping the original descriptors.

Some corner cases are not supported yet, namely properties declared in
companion objects, synthetic methods for property annotations,
JvmPackageName, etc.

 #KT-29119 Fixed
2019-02-19 16:37:47 +01:00
Alexander Udalov 4487c7a988 JVM IR: rename private fields for properties with same name
This is needed to get rid of the code that appends "$companion" to
properties moved from companion, because it caused inconsistencies in
the ABI and in JVM signatures stored in the metadata
2019-02-19 16:37:46 +01:00
Mads Ager 057bdb3954 Generate better code for branches based on comparisons.
For comparison intrinsics and for instanceof checks, make
it possible to get the the stack value produced and branch
on that directly instead of materializing a boolean to
branch on from it.

That reduces code such as

```
    IF_CMPEQ L1
    CONST_0
    GOTO L2
L1: CONST_1
L2: IFEQ L3
```

to just one IF_CMP instruction.
2019-02-19 15:46:52 +01:00
Mads Ager e9ec8e2cee JVM_IR: Do not generate annotations on $default methods. 2019-02-19 13:23:42 +01:00
Dmitry Petrov e1fdf0aa43 KT-29959 fix IR generation for 'd.m = e' 2019-02-19 09:59:42 +03:00
Dmitry N. Petrov 4e05c2305e Merge pull request #2121 from jimgoog/mutable-origin
Make IrDeclaration.origin mutable
2019-02-18 16:48:50 +03:00
Dmitriy Novozhilov 8fc7b4436b Revert "Temporary fix to compile project with the snapshot compiler"
This reverts commit acb83f1a
2019-02-18 12:43:42 +03:00
Ilmir Usmanov 1e4b7e1ef1 Put $assertionDisabled field into inline-site's class
The generated code is more inline with java, and we avoid the error of
accessing package-private field outside of the package.
However, this changes semantics a bit. Now, a user should set assertion
status of inline-site's package, instead of inline function's one.
 #KT-28317: Fixed
2019-02-18 12:39:03 +03:00
Mikhail Zarechenskiy acb83f1af1 Temporary fix to compile project with the snapshot compiler
The problem is in NI and can relate to a236ad5686
2019-02-18 11:45:02 +03:00
Jim S 47d63fc9be Make IrDeclaration.origin mutable 2019-02-16 09:55:03 -08:00
Dmitry Petrov 4c3d0cd9d7 KT-29861 startOffset/endOffset for 'valueOf' function of enum class 2019-02-15 16:25:16 +03:00
Dmitry Petrov 1b0d410a6f KT-29862 startOffset of class declaration
NB startOffset of primary class constructor declaration should still
point to the 'class' keyword (because of debugger requirements).
2019-02-15 16:25:16 +03:00
Dmitry Petrov 6aff53204f psi2ir: support dynamic infix calls ('foo bar 42' is 'foo.bar(42)') 2019-02-14 16:03:11 +03:00
Dmitry Petrov 77cbd10f9c psi2ir: don't generate temporaries in dynamic array augmented assignment
In constructs such as 'd[i] += x', where both indexed get and indexed
set are dynamic calls, it's safe to generate augmented assignment body
directly, without temporary variables for array ('d') and index ('i').
Note that corresponding IntermediateValue's are OnceExpressionValue's,
which would throw an exception if this assumption is violated.
2019-02-14 16:03:11 +03:00
Dmitry Petrov 580eb6fcac JS_IR: support dynamic expressions in block decomposition 2019-02-14 16:03:11 +03:00
Dmitry Petrov 03c35a4f44 JS_IR: support dynamic expressions in JS tree generation 2019-02-14 16:03:11 +03:00
Dmitry Petrov 4cee8c6f00 Minor: fix IrDynamicOperatorExpressionImpl double dispatch methods 2019-02-14 16:03:11 +03:00
Dmitry Petrov 83b2fed5be psi2ir: minor: drop unused import 2019-02-14 16:03:11 +03:00
Dmitry Petrov 6889e470d1 psi2ir: minor: move array access generation code 2019-02-14 16:03:11 +03:00
Dmitry Petrov 50269d3a5c psi2ir: minor: simplify code for dynamic array element assignment 2019-02-14 16:03:11 +03:00
Dmitry Petrov cf29dce4c2 pri2ir: dynamic unary & binary expressions
NB1 Not every dynamic unary or binary expression is translated to
dynamic operator expressions literally. For example, assignments and
increments can have safe calls in LHS, which require some extra logic.

NB2 There are some open design questions left regarding how dynamic
expressions should actually be translated.
2019-02-14 16:03:11 +03:00
Dmitry Petrov 82701de87b psi2ir: minor: drop some unused params/imports 2019-02-14 16:03:11 +03:00
Dmitry Petrov fbbe4f6e92 psi2ir: dynamic array element get/set 2019-02-14 16:03:11 +03:00
Dmitry Petrov 9a2bd5f4e6 psi2ir: dynamic member simple assignment/augmented assignment/++/-- 2019-02-14 16:03:11 +03:00
Dmitry Petrov fc76d0970b psi2ir: Implicit casts with 'dynamic' 2019-02-14 16:03:11 +03:00
Dmitry Petrov 3c8f52b436 psi2ir: simple dynamic member calls 2019-02-14 16:03:11 +03:00
Dmitry Petrov ddb1ea2047 psi2ir: dynamic member access ('d.x', 'd?.x') 2019-02-14 16:03:11 +03:00