Repository navigation
Resolve an MCOS object nested in a struct field or cell element - #65
Merged
Merged
Conversation
An MCOS object saved inside a struct field, a struct-array element or a cell element of a .mat file or a model workspace now becomes the node the same object gets at the top level. A nested Simulink.Parameter is a Parameter node with its Value and properties, a nested string shows its text, and a nested Bus lists its elements. Until now such an object was never decoded, and showed as <1x1 Simulink.Parameter> or <1x1 string> with nothing under it. Every class-17 element carries its own object handle as its fourth part. The parser now keeps that handle: integer storage only, read in stored order, and bounded to its own part and its container. The decoder resolves every opaque in a file against the one shared MCOS heap in a single pass, keyed by variable rather than by name, and keeps the results in a side table rather than on the parsed variables. parseMatVariable's opaque arm builds a resolved object through the same factory top-level objects use, reached through NodeRegistry so that no module-load cycle is added. An object that cannot be resolved stays exactly as it was. Unchanged on purpose: a cell's one-line summary and its grid still spell an object element as <1x1 Class>, and a decoded object in a MAT struct field refuses a rename, as its sibling fields do. .sldd handling is untouched. The fixtures are written by MATLAB R2027a: test/fixtures/mcos/nested_objects.mat and nested_ws.slx, generated by make_nested_fixtures.m, with MATLAB's answers in two truth files. Each nested object is graded against a separately built top-level twin and against MATLAB's recorded values.
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.
An MCOS object saved inside a struct field, a struct-array element or a cell element of a
.matfile or a model workspace now becomes the node the same object gets at the top level. Until now it was never decoded:strings_nested.matmixStruct.p<1x1 Simulink.Parameter>, no children7strings_nested.matmixStruct.s<1x1 string>"inStruct"strings_nested.matmixCell{2}<1x1 string>"inCell"How
parseOpaquenow keeps it: integer storage only, read in stored order (as MATLAB reads it), and bounded to its own part and its container. A malformed handle is recorded as refused, and the variable degrades exactly as before.decodeMcosVariablesresolves every opaque in a file, at any depth, against the one shared MCOS heap in a single pass, keyed by variable rather than by name. The existing range and class-match checks are unchanged.decodeMcosBlobkeeps its by-name contract as a wrapper.MatNodeandModelNodeattach the results in a side table (mcosDecodedTable.ts, a WeakMap), so the parsed variables themselves are untouched.parseMatVariable's opaque arm, the one dispatch every nested value goes through, builds a resolved object withmodelOpaqueMcosVariable, the factory top-level objects use, throughNodeRegistry, so no module-load cycle is added.Unchanged on purpose
<1x1 Class>. Across 93 files, every container summary and cell grid is unchanged.fixesChildNames). This changes 11 nodes in.matfiles and models and 0 in dictionaries..slddhandling is untouched.-v7.3stays refused.Tests
test/fixtures/mcos/nested_objects.matandnested_ws.slx, generated bymake_nested_fixtures.m, with MATLAB's answers in two truth files.test/nestedMcos.test.tscovers the parser, the decoder, the hand-built malformed handles, and the handle read order against MATLAB.test/matStringOpaque.test.ts's nested-string pins are flipped deliberately.npm run verifyis green: typecheck, build, smoke, 5,417 tests passed, 0 failed,check:pack,check:leak,check:browser.