Sergej Jaskiewicz
c379fd7fa1
[tree generator] Allow adding kDocs to implementation classes
2024-03-14 23:19:40 +00:00
Wojciech Litewka
c1266daf73
[tree generator] Remove AbstractField.defaultValueInBase
...
It is now unneeded, and future needs should be possible to
be resolved otherwise.
Removing it will simplify further changes to tree generator,
especially for IR.
2024-03-14 17:07:02 +00:00
Kirill Rakhman
b74dcb77e3
[FIR] Add opt-in to replaceIsTrailingLambda
...
#KT-66553
2024-03-13 17:05:48 +00:00
Wojciech Litewka
eec14f0054
[tree generator] Remove Suppress("unused") from implementation classes
...
Those only implement base classes, their members are not supposed
to be referenced directly (those sometimes they are).
So unused code in there can be suspicious.
On the other hand, some generated builders are truly unused, so leave
the suppression for them.
2024-03-05 13:06:03 +00:00
Wojciech Litewka
105ffb15a5
[FIR generator] Remove FirField
...
To simplify tree generator for further development and align it
with IR and SIR generators.
2024-02-29 15:48:58 +00:00
Wojciech Litewka
6cdddaacb0
[IR] Final preparation to autogenerate IR declaration implementations
...
IR expressions are left out for now, because unlike declarations,
which are mostly created via IrFactory, expressions' constructors are
widely used, and it's hard to replicate the exact signatures of those
constructors with the tree generator.
Therefore, some other approach is expected to be taken when generating
them in the future.
^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka
4d9d1974ec
[IR generator] Better support for fields' default value in base classes
...
- Allows using those with the incoming IR implementation printer.
- Moves the logic to common tree generator, so other trees can specify
default values in base classes as well, if needed.
^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka
288351d733
[tree generator] Rename AbstractImplementation.fieldsWith(out)Default
...
to better describe their intended usage, see also next commit.
^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka
6fadc51856
[tree generator] Minor: pass model inside ImplementationConfigurator
...
Needed for config across many elements in subsequent commits.
^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka
e737320d01
[FIR generator] Specify Field.isChild in base tree configuration
...
instead of inside implementation configuration.
Whether a field is a child element is a core concept of the tree,
not a matter of particular implementation class.
It is especially visible in IR tree, where the base classes implement the
acceptChildren method. It will also be more relevant in the future.
This also aligns the config style between IR and FIR tree generators.
^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka
6d5b07ebe9
[tree generator] Add AbstractElement#subElements, drop semantic leaves
...
The notion of IR element class being 'semantically leaf' is rather hacky.
Instead, now we only distinguish whether an element has its
implementation class, which is what this notion was actually trying to
represent.
^KT-65773 In Progress
2024-02-28 09:29:56 +00:00
Wojciech Litewka
7e01fc5906
[IR] Drop "leaf/non-leaf" comment from generated IR classes
...
As it is not much useful, and the current wording does not represent its
intended wording.
2024-02-28 09:29:56 +00:00
Wojciech Litewka
d904ce0939
[tree generator] Merge default and custom implementations
2024-02-28 09:29:56 +00:00
Wojciech Litewka
665bd5153a
[tree generator] Make defaultEmptyList#withGetter false by default
...
to align it with other default* methods.
This will be helpful for configuring IR implementation,
where there are many such empty lists.
2024-02-28 09:29:56 +00:00
Wojciech Litewka
5d7a5245ff
[tree generator] Extract printPropertyDeclaration util
...
analogous to printFunctionDeclaration.
This decouples the printing logic from handling IR elements' fields,
and makes it easier to directly print arbitrary fields.
2024-02-28 09:29:56 +00:00
Andrey Yastrebov
9d30fb1b1c
KT-65741 Fix SIR visitor parameter name & fix typo
2024-02-22 18:46:01 +00:00
Nikolay Lunyak
389f02b016
[FIR] Let FirErrorExpression have a working type if possible
...
^KT-65337 Fixed
2024-02-14 09:57:12 +00:00
Sergej Jaskiewicz
f844a86057
[utils] Introduce the bind function and use it throughout
2023-12-13 10:04:45 +00:00
Sergej Jaskiewicz
cab87eba21
[SIR, FIR generators] Add KDocs for visitor-related methods of elements
2023-12-12 14:27:57 +00:00
Sergej Jaskiewicz
1bed6a063f
[SIR] Add SirTransformerVoid class
...
This is convenient for cases when the transformer has no context to pass
to each method
2023-12-12 14:27:57 +00:00
Sergej Jaskiewicz
80847b9ee2
[SIR generator] Add SirVisitorVoid class
...
This is convenient for cases when the visitor has no context to pass to
each method
2023-12-12 14:27:57 +00:00
Sergej Jaskiewicz
80c9eae409
[tree generators] Factor out common transformer printing logic
2023-12-12 14:27:57 +00:00
Sergej Jaskiewicz
0d2032f3ef
[SIR] Auto-generate the Swift IR tree
...
Co-authored-by: Gleb Lukianets <gleb.lukianets@jetbrains.com >
2023-12-08 10:09:09 +00:00
Sergej Jaskiewicz
39c84bca06
[tree generators] Add a method for configuring all leaf builders
...
It will be used in the new Swift IR tree that will be added in the next
commit.
2023-12-08 10:09:09 +00:00
Sergej Jaskiewicz
8d1907e2f5
[FIR/IR generator] Introduce the common entry point for tree generators
...
This reduces code duplication.
2023-12-05 20:30:22 +00:00
Sergej Jaskiewicz
19ff050eae
[FIR/IR generator] Move usedTypes to AbstractElement, rename it
2023-12-05 20:30:22 +00:00
Sergej Jaskiewicz
d0f87f9aba
[FIR/IR generator] Rename field's needAcceptAndTransform to isChild
...
This better describes the semantics.
2023-12-05 11:41:02 +00:00
Sergej Jaskiewicz
f46a14522f
[FIR generator] Remove unused notNull property
2023-12-01 12:06:06 +00:00
Sergej Jaskiewicz
f3016e1dcb
[FIR generator] Avoid FIR-specific code in AbstractBuilderPrinter
2023-12-01 12:06:06 +00:00
Sergej Jaskiewicz
cae4a9930b
[FIR generator] Extract the Builder class to a common module
...
We want to use it to generate builder classes for other
trees, just like we already do with elements (see `AbstractElement` and
`AbsractImplementation`).
2023-12-01 12:06:06 +00:00
Sergej Jaskiewicz
91b5a71f1a
[FIR generator] Extract the Implementation class to a common module
...
We want to use it to generate implementation classes for other
trees, just like we already do with elements (see `AbstractElement`).
2023-12-01 12:06:06 +00:00
Sergej Jaskiewicz
7bd4de65f8
[IR generator] Deduplicate field copying logic
2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz
5f04bc8a27
[IR generator] Simplify computation of walkable children
...
Don't require to specify them explicitly via `isChild` in IR generator,
instead test the field type whether it is an element.
2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz
ad4e97154f
[FIR/IR generator] Factor out allFields to AbstractElement
2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz
38ee477ab4
[FIR/IR generator] Make AbstractField generic over itself
...
This will make some code more type-safe.
2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz
c6eb7d6c21
[FIR/IR generator] Factor out walkableChildren and transformableChildren
2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz
13ae129505
[FIR/IR generator] Move isSealed property to AbstractElement
2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz
0465c6d0ee
[FIR/IR generator] Make InterfaceAndAbstractClassConfigurator open
2023-11-28 16:24:40 +00:00
Sergej Jaskiewicz
4307e76f15
[FIR/IR generator] Remove visitSuperTypeByDefault from visitor printers
...
This property is FIR-specific, no need to use it in the generic printer.
2023-11-24 17:29:58 +00:00
Sergej Jaskiewicz
a5b5492b2d
[IR generator] Simplify configuration of visitor parents
...
Don't specify a visitor parent manually for each IR node,
use an algorithm instead.
2023-11-24 17:29:58 +00:00
Sergej Jaskiewicz
62d32471e1
[FIR generator] Extract BaseTransformerTypeFinder into the common module
...
We want to use it in other tree generators.
2023-11-24 17:29:58 +00:00
Sergej Jaskiewicz
8eefb210f9
[FIR/IR generator] Introduce the shared Model class
2023-11-22 15:10:16 +00:00
Sergej Jaskiewicz
9a11208e67
[FIR/IR generator] Extract visitFunctionName to AbstractElement
2023-11-22 15:10:16 +00:00
Sergej Jaskiewicz
fab63e38aa
[FIR/IR generator] Reduce duplication when printing curly-braced blocks
2023-11-21 01:15:10 +00:00
Sergej Jaskiewicz
18ed85c26e
[IR generator] Auto-generate IrElementTransformerVoid
2023-11-21 01:15:10 +00:00
Sergej Jaskiewicz
02c12ae26f
[FIR generator] Write kDocs for accept & transform methods in FirElement
2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz
ed28923282
[IR generator] Don't use kotlinpoet for auto-generating IR tree classes
...
KT-61970 Fixed
KT-61703 Fixed
2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz
63e9dd588c
[FIR generator] Factor out element printer to common module
...
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz
84bd12c667
[FIR generator] Factor out field printer into the common code
...
This is a step towards commonizing the code generator between
FIR and IR: KT-61970
2023-11-09 13:30:25 +00:00
Sergej Jaskiewicz
bca35c0015
[FIR/IR generator] Add default arguments to TypeVariable constructor
2023-11-09 13:30:25 +00:00