Skip to content

Mustachio: add SimpleRenderer and demote many classes from using full renderers #2458

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

Merged
merged 4 commits into from
Dec 16, 2020

Conversation

srawlins
Copy link
Member

Renderers were getting unwieldy and were only going to grow more. This introduces a SimpleRenderer for most classes.

If a class is not specified with @Renderer, we can also annotate a class with @visibleToMustache. Otherwise, it will use a SimpleRenderer. For example, if String does not use a full renderer, then we cannot access it's fields (String.length, etc).

This change highlighted some issues with InterfaceType vs ClassElement and we've mostly changed to us Element, and I think the code is much cleaner.

This deletes almost 4000 lines from templates.renderers.dart, haha.

@google-cla google-cla bot added the cla: yes Google CLA check succeeded. label Dec 11, 2020
@srawlins srawlins requested a review from jcollins-g December 11, 2020 23:24
@srawlins
Copy link
Member Author

This is ready for review again; concept of "visible" to mustache has changed.

Copy link
Contributor

@jcollins-g jcollins-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you can, resync this PR first to pick up the latest travis (or maybe even Github Actions) changes and retest before merging.

/// A set of types which are "visible" to Mustache. Mustache rendering has
/// access to all of a type's public getters if it is visible to Mustache.
///
/// Note that all subtypes and supertypes of a "visible" type are also visible
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@srawlins srawlins merged commit ab96e93 into dart-lang:master Dec 16, 2020
@srawlins srawlins deleted the mustachio-a branch December 16, 2020 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google CLA check succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants