Commit Graph

1004 Commits

Author SHA1 Message Date
Svyatoslav Kuzmich 39cdee8d6c [JS IR BE] Enable IrValidator 2018-11-29 15:36:56 +03:00
Svyatoslav Kuzmich 2172a12df4 [JS IR BE] Eliminate identical IrElements duplicates 2018-11-29 15:36:56 +03:00
Svyatoslav Kuzmich ba0f652e02 [JS IR BE] Fix parameters parents 2018-11-29 15:36:56 +03:00
Svyatoslav Kuzmich d5f8c63130 [IR] Add returnType to consturcotrs of IrFunctionBase 2018-11-29 15:36:56 +03:00
Svyatoslav Kuzmich fe6b36391d [JS IR] JsIrBuilder - add returnType and parent to buildFunction 2018-11-29 15:36:56 +03:00
Georgy Bronnikov ffa3d7c57a Update test data 2018-11-29 12:48:52 +03:00
Georgy Bronnikov 32640750ee Add CompilerPhase and corresponding compiler keys 2018-11-29 12:48:52 +03:00
Dmitry Petrov 42e253b5ff KT-28456 generate index arguments per expression
In the desugaring for compound assignment to a collection element,
argument expression 'i' is mapped to value parameters 'iG' and 'iS' of
corresponding 'get' and 'set' operators.
In general, these value parameters can have different indices.

This requires extra machinery in argument generation - that is, to be
able to generate a particular expression argument using an arbitrary
callback. In the vast majority of the cases this callback will just use
the corresponding StatementGenerator to generate IR subtree for the
provided expression. In case of 'get' and 'set' operator calls for an
augmented assignment expression this will map corresponding argument
expressions to pregenerated temporary variables.

Thus, in the following context:
```
  class A

  operator fun A.get(vararg xs: Int) = 0
  operator fun A.set(i: Int, j: Int, v: Int) {}
```

statement `a[1, 2] += 3` will be desugared as (in a really pseudo
Kotlin):
```
  {
    val tmp_array = a
    val tmp_index0 = 1
    val tmp_index1 = 2
    tmp_array.set(
      i = tmp_index0,
      j = tmp_index1,
      v = tmp_array.get(xs = [tmp_index0, tmp_index1]).plus(3)
    )
  }
```
2018-11-28 14:36:44 +03:00
Mikhail Glukhikh d50c4d7211 Fix failing IR tests because of CCE in WrappedValueParameterDescriptor
In previous commits, renderValueParameter began to calculate its
containing declaration. However, WrappedValueParameterDescriptor
assumes that parent of IrParameter is IrFunction, which is not true
for dispatch receiver parameters. The correct fix would be not to create
WrappedValueParameterDescriptor for dispatch receivers at all and use
WrappedReceiverParameterDescriptor instead. In this fix, I just moved
parameter' containing declaration calculation inside specific option
which is usually false, thus hiding the found problem.
2018-11-22 13:03:05 +03:00
Dmitry Petrov 7dd906db44 KT-28324 More exact startOffset for function/constructor declarations
Function/constructor declaration start offset is the start offset of the
corresponding declaration token, if available.
2018-11-22 10:09:31 +03:00
Igor Chevdar 2f3ff60abc Fixed bug with fake overridden functions with defaults 2018-11-20 12:11:29 +03:00
Dmitry Petrov a0d74be7cf KT-28235: Make sure array access produces unique elements
This requires generating calls on-demand in
LValueWithGetterAndSetterCalls.
2018-11-16 10:33:30 +03:00
Dmitry Petrov 080c177ed2 Minor: formatting 2018-11-16 10:33:30 +03:00
Igor Chevdar 2ff87ab1ce Fixed tests on IR copier 2018-11-15 19:13:06 +03:00
Igor Chevdar 728b7b130b Removed descriptors usage from IR copier 2018-11-15 19:13:06 +03:00
Svyatoslav Kuzmich 0bf3199c19 Support nullable inline classes 2018-11-08 15:00:33 +03:00
Svyatoslav Kuzmich 370b04df35 [JS IR BE] Inline classes lowering 2018-11-08 15:00:30 +03:00
Svyatoslav Kuzmich 4866c2b36a [IR] Move irCall from JS backend to common utils 2018-11-08 15:00:09 +03:00
Svyatoslav Kuzmich 81d61aefff [IR] Specify IrType in irTemporary 2018-11-08 15:00:09 +03:00
Svyatoslav Kuzmich dd20775662 [IR] Move IrFunction.isStatic from JS to Common 2018-11-08 15:00:08 +03:00
Svyatoslav Kuzmich 4f6a18e29a [IR] Update parents when transforming declaration containers 2018-11-08 15:00:08 +03:00
Svyatoslav Kuzmich 38b31e8f7d [JS IR BE] Fix reusing expression instances 2018-11-08 15:00:08 +03:00
Svyatoslav Kuzmich 47b0f94903 [JS IR BE] Fix funny safe call 2018-11-08 15:00:08 +03:00
Svyatoslav Kuzmich 27ff4da94d [JS IR BE] Bugfix: set overriden symbols for generated bridges 2018-11-08 15:00:08 +03:00
Dmitry Petrov 8262d4a4b9 psi2ir: Don't generate constructor bodies for 'external' classes
#KT-27934
2018-11-08 12:29:15 +03:00
Dmitry Petrov 51002ee620 psi2ir: Handle missing "then" branches as empty blocks
#KT-27933
2018-11-08 12:29:15 +03:00
Dmitry Petrov bd1491ac8a psi2ir: Merge constant entries in string template expressions
This is required to handle UCNs properly, see KT-28006.

 #KT-28006
2018-11-08 12:29:15 +03:00
Georgy Bronnikov dbfbfa65a6 Remove IrClass.isFileClass as unneeded 2018-11-07 19:09:15 +03:00
Georgy Bronnikov a814e4a314 IR. Remove ClassLowerWithContext
The code is never used and shows some signs of bit rot.
2018-11-07 19:09:15 +03:00
Georgy Bronnikov 1aec16ca29 JVM_IR. Remove FileClassDescriptor, no longer used 2018-11-07 19:09:15 +03:00
Georgy Bronnikov 0a43054a92 JVM_IR. Remove descriptors from FileClassLowering 2018-11-07 19:09:15 +03:00
Georgy Bronnikov 95fbe29350 JVM_IR: remove descriptors from JvmCoercionToUnitPatcher 2018-11-07 19:09:15 +03:00
Roman Artemev 0e7520fde3 [JS IR BE] Fix GetClass on primitive type 2018-11-01 16:51:44 +03:00
Roman Artemev 2d03f87ea5 [IR BE] Support lateinit locals and isInitialized property
* update tests
2018-11-01 16:51:43 +03:00
Roman Artemev 535eea7f48 [JS IR BE] fix enum initialization 2018-11-01 16:51:42 +03:00
Roman Artemev b86e2e6dc0 [JS IR BE] Fix EnumClassLowering
* make it incremental
 * fix access to enum entry from different module
 * drop ExternalEnumLowering
2018-11-01 16:51:42 +03:00
Roman Artemev 12848d4eff [JS IR BE] Support in callable references
* default params
 * vararg
Minor refactoring
2018-11-01 16:18:44 +03:00
Roman Artemev fb709cae92 [JS IR BE] Fix private field names 2018-11-01 16:18:44 +03:00
Dmitry Savvinov 00036ba498 [BE IR] Skip comments for determining startOffset of declaration 2018-10-31 14:52:03 +03:00
Mikhael Bogdanov bedaa1a503 Use proper type constructor in IrIllegalArgumentException
'v.anew(Type.geType(...))' worked accidentally because
  1. By default, ASM 6 creates METHOD Type for 'Type.geType(...)' invocation
  2. It didn't fail because this type was used only in 'anew' invocation that
      calls 'internalName' only
  3. ASM 7 changes default behavior to throw Exception
2018-10-30 16:30:26 +01:00
Alexander Udalov c1ab08c8ce Refactor KClassValue to store ClassLiteralValue internally
Only invariant array projections and non-null element types will be
supported soon (see KT-26568), so it makes no sense to store the
complete type in KClassValue. What we need is only the ClassId of the
class, and the number of times it's wrapped into kotlin/Array, which is
exactly what ClassLiteralValue represents.

This change helps in decoupling annotation values from
descriptors/types. The only constant value that depends on descriptors
is now AnnotationValue.

 #KT-26582 Fixed
2018-10-25 16:27:23 +02:00
Alexander Udalov 9183d7ca27 Add ModuleDescriptor to AnnotationCodegen 2018-10-25 16:27:22 +02:00
Roman Artemev ffdfec4815 [JS IR BE] Minor refactoring 2018-10-25 15:49:33 +03:00
Roman Artemev 080e1ad5b5 [JS IR BE]
* Fix type parameters for callable references
 * Visit IrCallableReference tree as well
2018-10-25 15:49:22 +03:00
Roman Artemev 04bf93c1bc [JS IR BE] Refact CallableReferenceLowering
* fix cross-module references
 * make it incremental
2018-10-25 15:49:20 +03:00
Roman Artemev 43d14ed954 [JS IR BE] Put closure function declaration in container (factory function) 2018-10-25 15:49:20 +03:00
Roman Artemev 9515de0b7e [JS IR BE] Fix name clash between top-level fields 2018-10-25 15:48:42 +03:00
Roman Artemev 91ea377622 [JS IR BE] Fix translation for float literals 2018-10-25 15:48:42 +03:00
Roman Artemev 276000a974 [JS IR BE] Fix exceptions
* set message property in the correct way
 * set proper name for each Throwable successor
2018-10-25 15:48:42 +03:00
Roman Artemev 6a05b1eee5 [JS IR BE] Add noWhenBranchMatchedException
* refact exception helpers
2018-10-25 15:48:42 +03:00