DescriptionMojom frontend: Detect Ill-founded Types
This patch adds the functionality to detect user-defined types that are unserializable because every instance of the type would contain a cycle.
We use the ill-founded node detection algorithm from https://codereview.chromium.org/1908273003/ by having UserDefinedTypeBase implement the |Node| interface.
- In mojom_descriptor.go we add the method DetectIllFoundedTypes()
- We Invoke DetectIllFoundedTypes()in parse_driver.go after ComputeFinalData()
- We add the method NonAvoidableUserDefinedType() to the TypeRef interface to capture the notion that a type reference unavoidably entails a non-null pointer to a struct or union.
-We fixed up some ill-founded types that appeared in serialization_test.go because now we would be detecting them and failing before serialization.
- We enhanced the ill-founded graph detection library (in wellfounded_graphs.go) by introducing the ability for the client to add labels to the edges. The labels are opaque to the algorithm but we use them to maintain enough information to generate a useful error message. For example we use them to capture the name of the struct or union field corresponding to a graph edge.
- See illfounded_types_test.go to see the format of the error messages we will emit when an ill-founded type is detected.
BUG= fixes #694
R=azani@chromium.org
Committed: https://chromium.googlesource.com/external/mojo/+/4c234209f3b34950d174f76c22c4ca8d20a49b9f
Patch Set 1 #
Total comments: 9
Patch Set 2 : Fix comments as per code review. #
Messages
Total messages: 16 (11 generated)
|