New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extract non-polymer specific logic out of polymer's transformer #17706
Comments
Removed Type-Defect label. |
Added this to the Later milestone. |
Issue #18037 has been merged into this issue. |
Pasting here issue #7 to track it all in one place:
|
Added Pkg-Polymer label. |
Removed Pkg-Polymer label. |
Removed Library-PolymerBuild label. |
Removed Area-Polymer label. |
Removed Priority-Unassigned label. |
Added Polymer-P-2 label. |
Removed this from the Later milestone. |
Removed Polymer-P-2 label. |
Removed Polymer-Milestone-Later label. |
To make this extensible, one though is to include in the annotation the logic for how is the registration supposed to be done. For example, consider we rename @CustomTag to @RegisterElement, which has the following code: class RegisterElement { register(Type t) => document.registerElement(tagName, t); } A generic transformer can detect that if you have: @RegisterElement('x-foo') it can copy the annotation as a const expression and generate a registration call by invoking a method on that const object: const RegisterElement('x-foo').register(Foo); With this approach, it's easy to later add new kinds of registration calls. For example, Polymer can define a subclass of this annotation: class RegisterPolymerElement extends RegisterElement { @override So the generic transformer can detect that if you have: @RegisterPolymerElement('x-foo') it will correctly generate the following call: const RegisterPolymerElement('x-foo').register(Foo); |
This issue has been moved to dart-archive/polymer-dart#383. |
Justin brought up a good point: currently Polymer's transformer handles things such as:
Neither of those are really Polymer features. We should move them to another transformer.
The text was updated successfully, but these errors were encountered: