82 Commits

Author SHA1 Message Date
Sergej Jaskiewicz a84277782a [IR generator] Don't use kotlinpoet for auto-generating IrFactory
KT-61970
2023-11-06 09:47:22 +00:00
Sergej Jaskiewicz 54de11cb58 [FIR/IR generator] Generate kDocs for visitor classes 2023-11-02 23:05:18 +00:00
Sergej Jaskiewicz 570422dbd4 [FIR/IR generator] Print visitor method expression bodies on new line
This helps to avoid long lines in visitor classes.
2023-11-02 23:05:18 +00:00
Sergej Jaskiewicz c5f519f7c7 [FIR/IR generator] Commonize visitor printing logic
This is a step towards commonizing the code generator between
FIR and IR: KT-61970

Also, don't use kotlinpoet for generating IR visitors (KT-61703)
2023-11-02 23:05:18 +00:00
Sergej Jaskiewicz 325b152efa [FIR generator] Remove unused class ImplementationWithArg 2023-10-26 17:33:59 +00:00
Sergej Jaskiewicz 7b7bcb8ffa [FIR/IR generator] Introduce ImportCollector
This class enables printing the import list in generated files
in a smarter way.

Also, refactor `Importable` interface hierarchy, namely, don't inherit
`TypeRef` from `Importable`, since we have types like `TypeRef.Star`
which are not really importable.

Replace the `Importable#typeWithArguments` property with
the `TypeRef#render` method to utilize `ImportCollector` while rendering
types.
2023-10-26 17:33:59 +00:00
Sergej Jaskiewicz 9eacdb3314 [FIR generator] Print builder property name in generated classes' KDocs
Just like we do when generating the IR tree
2023-10-24 10:29:43 +00:00
Sergej Jaskiewicz 7e7f4811bd [FIR/IR generator] Add kDoc property to AbstractElement & AbstractField 2023-10-24 10:29:43 +00:00
Sergej Jaskiewicz f2bb988e68 [FIR/IR generator] Replace getTypeWithArguments with a property
The `notNull` of that method was never used.
2023-10-20 10:49:20 +00:00
Sergej Jaskiewicz de4e39906c [FIR/IR generator] Use TypeRef for working with types in fields
- Don't inherit `AbstractField` from `Importable`, because it really
  is not
- Remove the `arguments` and `nullable` properties from `AbstractField`.
  Both properties can be derived from the field's `typeRef`.
- Make `AbstractField`'s `typeRef` property of type
  `TypeRefWithNullability` instead of just `TypeRef`, because fields
  can always be nullable.
2023-10-20 10:49:20 +00:00
Sergej Jaskiewicz 75b509c185 [FIR/IR generator] Share visitor-related properties between FIR & IR 2023-10-20 06:41:12 +00:00
Sergej Jaskiewicz 04c5ac0eb6 [FIR/IR generator] Factor out adding pure abstract element as parent 2023-10-19 12:00:25 +00:00
Sergej Jaskiewicz 5798021e4b [FIR/IR generator] Refactor element parents
- Move `elementParents` and `otherParents` properties
  to `AbstractElement`
- Use `elementParents` instead of `parentRefs` where needed
2023-10-19 12:00:25 +00:00
Sergej Jaskiewicz 417aa236fb [FIR/IR generator] Factor out printing the preamble in generated files 2023-10-18 18:42:40 +00:00
Sergej Jaskiewicz 8c6da9fddb [FIR/IR generator] Deduplicate interface/abstract class configuration 2023-10-18 12:39:39 +00:00
Sergej Jaskiewicz 9a4c28498c [FIR generator] Deduplicate the logic of needPureAbstractElement 2023-10-18 11:12:55 +00:00
Sergej Jaskiewicz 7ab4ca6f51 [IR generator] Inherit Element from AbstractElement
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-10-16 22:56:36 +00:00
Sergej Jaskiewicz f9d17a2d51 [IR generator] Inherit Field from AbstractField
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-10-16 22:56:36 +00:00
Sergej Jaskiewicz 15751333e3 [IR generator] Introduce constants for List-like types 2023-10-16 22:56:36 +00:00
Sergej Jaskiewicz df0f86bf8d [FIR generator] Use a single list of parent TypeRefs for elements
(Instead of storing the list of parent elements + the map of parent
arguments)
2023-10-13 10:11:38 +00:00
Sergej Jaskiewicz 04ac4b71a3 [FIR generator] Replace AbstractElement with ElemenOrRef
In the FIR generator, the `AbstractElement` class was used to
represent either an element type without type arguments applied
(using the `Element` subclass), or an element type with applied type
arguments (using the `ElementWithArguments` subclass).

Instead, it is more logical to use the `Element` class to always
represent a non-parameterized element type, and for a parameterized
element type use the `ElementRef` class, just like we do
in the IR generator.
2023-10-12 11:36:20 +00:00
Sergej Jaskiewicz a909a28f29 [FIR generator] Use more type-safe field builders 2023-10-12 08:24:12 +00:00
Sergej Jaskiewicz 8be455649c [FIR generator] Use TypeVariable instead of TypeArgument for TPs
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-10-12 08:24:12 +00:00
Sergej Jaskiewicz 8798fdeb82 [FIR generator] Use TypeRef for denoting types
(instead of `Type` and `Importable`)

This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-10-11 11:16:08 +00:00
Sergej Jaskiewicz 3a5e69d651 [FIR/IR generator] Inherit TypeRef from Importable
This is the first step to replace the usages of `Importable`
in the FIR generator with `TypeRef`.

This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-09-22 19:46:14 +00:00
Sergej Jaskiewicz a995c522f7 [IR generator] Factor out TypeRef to common module
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-09-22 19:46:14 +00:00
Sergej Jaskiewicz d5394db185 [FIR generator] Factor out AbstractElement to common module
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-09-22 19:46:14 +00:00
Sergej Jaskiewicz 977e316489 [FIR generator] Factor out TypeArgument to common module
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-09-22 19:46:14 +00:00
Sergej Jaskiewicz 0dd01279da [FIR generator] Move Implementation.Kind to common module
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-09-19 22:19:37 +00:00
Sergej Jaskiewicz e62343427d [FIR generator] Move Field and FieldContainer to common module
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-09-19 22:19:37 +00:00
Sergej Jaskiewicz 982b9221b4 [FIR generator] Move ArbitrarilyImportable class to common module
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-09-19 22:19:37 +00:00
Sergej Jaskiewicz 7a6bffaabb [FIR generator] Move Importable interface to common module
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-09-19 22:19:37 +00:00