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

🐛 Point all transforms to same id #27

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/Bang.Generator/Templating/Templates.ComponentTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,19 @@ public ComponentIdSubstitution() : base("<component_id_list>") { }
// This is mostly so hot reload is happy whenever we add more components to the project.
// If this is ever a problem, we can revisit this.
protected override string ProcessComponent(TypeMetadata.Component metadata)
=> $"""

/// <summary>
/// Unique Id used for the lookup of components with type <see cref="{metadata.FullyQualifiedName}"/>.
/// </summary>
public static int {metadata.FriendlyName} => global::Bang.{ParentProjectPrefix}ComponentsLookup.{ParentProjectPrefix}NextLookupId + {metadata.Index};
{
var id = metadata.IsTransformComponent
? "global::Bang.Entities.BangComponentTypes.Transform"
: $"global::Bang.{ParentProjectPrefix}ComponentsLookup.{ParentProjectPrefix}NextLookupId + {metadata.Index}";

""";
return $"""

/// <summary>
/// Unique Id used for the lookup of components with type <see cref="{metadata.FullyQualifiedName}"/>.
/// </summary>
public static int {metadata.FriendlyName} => {id};

""";
}
}
}