-
Notifications
You must be signed in to change notification settings - Fork 48
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
Add logic to generate type forwarding information to ECMAXML #452
Conversation
I reused the methods in FXUtils to add/remove fx to/from list. Since the changes will be cached, I am not sure it will impact the results return by PreviouslyProcessedFXString. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, so in general, I would say that this code looks good ... however as discussed, there's a few improvements to the data and the algorithm:
- Add
FromVersion
andToVersion
parameters ... this will help in tracking down assembly resolution issues. - Currently, this is using the "Update" methodology, which tries to maintain the existing XML if it already exists. This logic is difficult to maintain and prone to issues with edge cases.
- Moving to a process more like how the MDocUpdater.MakeParameters function works would probably be ideal. The important stages in that process are as follows:
- return early if
typeEntry.TimesProcessed > 1
- this can be relevant when a type is forwarded in an assembly but that assembly is in the framework folder, rather than in the dependencies folder. What happens is that the same type is inevitably processed more than one time in the same framework, which can cause issues in some cases.
- delete the whole list if
typeEntry.Framework.IsFirstFrameworkForType(typeEntry)
is true- this lets the algorithm begin fresh without having to make a bunch of stateful decisions. Please note that this is only relevant for XML nodes that do not have user content. So because this is information that comes from the metadata, we can process it this way.
- prepare state data
- This is less of a technical reason, but more for making the algorithm easier to write.
- It begins by making a datastructure of all relevant data in the current type (in the case of make parameters, it's the list of parameters in this type instance in this framework).
- Then it gets a list of the current XML parameters (xdata) ... again, not really a technical reason other than organization
- syncing state
- with the data from the previous step, this one becomes as simplified as:
- If the data doesn't exist ... add it (with FrameworkAlternate)
- If it does exist ... add the current framework to the FrameworkAlternate parameter
- There's a step here in the MakeParameters method that probably isn't relevant ... this is necessary here because Parameters are kind of unique in that they have to sync with related
Docs/param
nodes - Lastly is the processing you do on the last instance of the type when
typeEntry.Framework.IsLastFrameworkForType(typeEntry)
is true- Here you just loop through all the XML elements, and compare the
FrameworkAlternate
value withtypeEntry.Framework.AllFrameworksWithType(typeEntry)
... if they match, then you can confidently remove theFrameworkAlternate
parameter from the XML node.
- Here you just loop through all the XML elements, and compare the
- return early if
Closing and re-opening to request new build after small update in develop branch for failing unit test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very close :) After you address the comment, please squash your commits and this will be ready to go. Thanks!
No description provided.