Skip to content
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

Type hierarchy use type #123

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

davidmorgan
Copy link
Contributor

No description provided.

}

bool get isMember => wireType == WireType.member;
Member? get maybeMember => isMember ? asMember : null;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe ifMember? I don't feel strongly either way though.

We probably also want to avoid looking up wireType twice here.

final path = MacroScope.current.model.pathOf(node)!;
final secondLast = path[path.length - 2];
switch (secondLast) {
case 'members':
Copy link
Contributor

Choose a reason for hiding this comment

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

I definitely would want something more robust here, it needs to be something we can auto-generate as well I think.

In general, I don't love the idea of using the path to the node for this this, it feels sketchy and I worry about the backwards compatibility of it if the schema changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, I'm happy to drop the path idea in favour of putting "static fields" in schemas, that seems much better and can be used for any of the approaches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants