Repository navigation
Conversation
Bastani
left a comment
There was a problem hiding this comment.
Thank you for your submission, I made a few comments about the changes, looks good otherwise!
| .Any(attr => attr.Name.ToString() == Constants.LOGIC_BLOCK_ATTRIBUTE_NAME); | ||
| } | ||
|
|
||
| private static bool InheritsFromLogicBlockState(INamedTypeSymbol symbol) => |
There was a problem hiding this comment.
I think this fix shows a bigger problem with CodeService.InheritsFromByName, it only checks within the same file. There's a similar bug with if you were to make a base LogicBlock.
I think the CodeService.InheritsFromByName should probably be removed to discourage people from using it.
If you're open to fixing that in this PR, that would be great, otherwise I can open another after this is merged.
There was a problem hiding this comment.
Done, fixing that also turned up two more partial-class bugs
- a Start call in a second file silently dropped the diagram
- every partial calling Start would have emitted its own diagram
Both are fixed
Thanks for the review! All three are addressed |
[StateDiagram]is silently ignored when the attributed record's base type is not literally namedLogicBlockStateand that base is not declared in the same file. The generator falls through to the unrelatedIsLogicBlockCandidatepath and writes a stub diagram containing only the initial state.Reproduction
Gives
Changing
: SharedBaseto: LogicBlockStateproduces the correct diagram with every state and transition.Fix
Move the inheritance check from the syntax predicate into the semantic transform .
IsStateDiagramCandidatenow only checks for the attribute.DiscoverStateGraphverifies inheritance viaCodeService.GetAllBaseTypes, the same helper it already uses a few lines further down, and returnsnullif the type is not a logic block state.