Ffigen transformer refactor
- Dominant language
- Dart
- Stars
- 275
- Forks
- 144
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 47
Description
As ffigen has developed we've gradually added more and more complexity to the `addDependencies` and `toBindingString` methods of the bindings classes. We should add a transformation step to the pipeline, before `addDependencies`, and move any logic that modifies the AST into this step.
It will probably be cleanest to have multiple separate transformations, rather than one big one. So we'll use a similar [transformer](https://github.com/dart-lang/sdk/blob/main/pkg/kernel/lib/visitor.dart#L1767) pattern to the Dart CFE. This will also allow custom transformation steps in future. We'll probably also need to formalize/cleanup the AST representation a bit.
1: Clean up AST
2: Write transformer boilerplate
3 to N: Add a seperate transformer implementation for each of the AST modifying actions that currently happens in `addDependencies` and `toBindingString`. Could probably also port addDependencies to a transformer/visitor.
Contributor guide
Assessment
This issue has not been assessed yet.