refactor(scripting): collapse step POCOs onto virtual dispatch - #244
Merged
Conversation
- StepRegistry falls back to shape-driven parsing (StepXmlParser / StepDisplayParser) when a step's FromXml/FromDisplay is null - Add ScriptStep<TSelf>, a CRTP base supplying shape-driven ToXml/ToDisplayLine/Parse defaults - Per-step delegates stay explicit for now; trampolines get deleted mechanically next
- StepMetadata drops FromXml/FromDisplay entirely; nothing outside StepRegistry's own bridge ever read them - ScriptStep gains PopulateFromXml/PopulateFromDisplay; ScriptStep<TSelf> supplies shape-driven defaults and a typed static Parse - StepRegistry registers one uniform construction closure per step; customization is ordinary virtual dispatch, not a delegate lookup - StepXmlParser/StepDisplayParser expose Populate(instance, ...) to populate an existing instance, used by both the typed Parse path and the registry's closure
- Every step now derives ScriptStep<TSelf>, including the 7 previously hand-XML steps (CommentStep, GoToLayoutStep, PerformScript family, TruncateTableStep) that used to stay on plain ScriptStep - Deleted boilerplate ToXml/ToDisplayLine overrides and FromXml/ FromDisplayParams trampolines wherever shape-driven defaults suffice - Converted hand-written FromXml/FromDisplayParams into PopulateFromXml/PopulateFromDisplay overrides that mutate the constructed instance instead of returning a new one - One rule replaces the old 3-category (5-bucket) decision tree: derive the generic base, override only non-boilerplate members
- Replace direct Metadata.FromXml!/FromDisplay! calls (unsafe now that they're gone from StepMetadata) with X.Parse(...) and StepDisplayFactory.TryCreate(...) - NoInteractSemanticTests goes through StepXmlFactory.Create instead of a per-metadata delegate lookup - Add trivial PopulateFromXml/PopulateFromDisplay stubs to the plain- ScriptStep test doubles in StepXmlParserTests/StepDisplayRendererTests/ StepXmlRendererTests, which exercise the shape engine directly and never go through virtual dispatch
Advanced FileMaker Scripting Syntax reference still named the deleted static method; update to match the virtual PopulateFromDisplay override.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ScriptStep<TSelf>and overrides only the members whose behavior isn't shape-driven boilerplate (ToXml,ToDisplayLine,PopulateFromXml,PopulateFromDisplay) — collapsing what used to be a 3-category decision tree of hand-wired static factories into one ruleStepMetadata.FromXml/FromDisplaydelegate properties are gone;StepRegistryregisters a single uniform construction closure per step and lets ordinary virtual dispatch pick the right behaviorParse/StepDisplayFactory.TryCreatepaths instead of calling the now-deleted metadata delegates directlyTest plan
dotnet build SharpFM.sln— no errorsdotnet test SharpFM.sln— 2222 passed (106 + 2116), matching the pre-refactor baselineSteps/for stalestatic new/FromXml =/FromDisplayParamsreferences — clean