-
Notifications
You must be signed in to change notification settings - Fork 62
Started on V2, not using ASTs... #115
Conversation
alorenzen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, really like the new approach here. Obviously, it's still missing some features, like the scoping / imports, which was my favorite part of v1. But it's a great start.
| visitClass(Class spec, [StringSink output]) { | ||
| output ??= new StringBuffer(); | ||
| spec.docs.forEach(output.writeln); | ||
| spec.annotations.forEach((a) => visitAnnotation(a, output)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix style nits in next PR.
| } | ||
| output.write(' {'); | ||
| spec.constructors.forEach((c) => visitConstructor(c, spec.name, output)); | ||
| spec.fields.forEach((f) => visitField(f, output)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, just use a for-loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix style nits in next PR.
| T visitTypeParameters(Iterable<TypeReference> specs) => null; | ||
| } | ||
|
|
||
| class RecursiveSpecVisitor<T> extends SimpleSpecVisitor<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO here for implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix or remove in next PR.
|
@alorenzen Yeah, I think I can re-add scoping and imports in the next PR, just wanted to make sure I was covering all feature requirements for the injection package first so I can land this internally. |
* Initial 2.0. * Add some classes. * Start using BuiltCollection|Value. * Add generics, inheritance. * Add methods (without bodies). * Added method bodies. * Further augment methods. * Add method parameters. * Added methods, bodies, and constructors. * Fix travis. * Add annotation support. * Add fields and constructor initializers. * Add e2e example.
* Initial 2.0. * Add some classes. * Start using BuiltCollection|Value. * Add generics, inheritance. * Add methods (without bodies). * Added method bodies. * Further augment methods. * Add method parameters. * Added methods, bodies, and constructors. * Fix travis. * Add annotation support. * Add fields and constructor initializers. * Add e2e example.
... as requested by the Dart analyzer/front end team.
Started using built_value (since it gives it a nicer API anyway) and modeled method bodies as code blocks instead, since in reality it makes writing code generation that much easier if you only use typed structures for the API.
[I realize this change is scary, hence why it's going on the
V2branch instead until complete]