-
Notifications
You must be signed in to change notification settings - Fork 121
Update AsmResolver and use auto-import in 'cswinrtgen' #2140
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
base: staging/3.0
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR updates the AsmResolver library and leverages its new auto-import functionality to significantly simplify code throughout the cswinrtgen project. The changes remove manual calls to .Import(module) across numerous files, as the updated AsmResolver version now handles imports automatically.
Key Changes:
- Updated AsmResolver.DotNet from version 6.0.0-development.282 to 6.0.0-development.317
- Removed all manual
.Import(module)calls throughout the codebase - Eliminated the
moduleparameter from several method signatures where it's no longer needed - Deleted the entire
ImportExtensions.csfile which provided manual import helper methods
Reviewed changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Directory.Packages.props | Updated AsmResolver.DotNet package version |
| InteropGenerator.Emit.cs | Removed module parameter from multiple method calls |
| InteropGenerator.Discover.cs | Removed .Import(module) calls for assembly references |
| WellKnownTypeDefinitionFactory.cs | Removed .Import(module) calls throughout type and field definitions |
| WellKnownTypeDefinitionFactory.IgnoreAccessChecksToAttribute.cs | Removed .Import(module) calls in attribute creation |
| WellKnownMemberDefinitionFactory.cs | Removed module parameter from method signatures and .Import(module) calls |
| WellKnownCilMethodBodyFactory.cs | Removed .Import(module) calls in method body construction |
| InteropMethodRewriteFactory.ReturnValue.cs | Removed .Import(module) calls in method rewriting |
| InteropMethodRewriteFactory.RetVal.cs | Removed .Import(module) calls in return value handling |
| InteropMethodDefinitionFactory.*.cs (multiple files) | Removed .Import(module) calls throughout method definitions |
| InteropMemberDefinitionFactory.cs | Removed .Import(module) calls in member creation |
| InteropCustomAttributeFactory.cs | Removed .Import(module) calls in custom attribute creation |
| MethodDefinitionExtensions.cs | Removed .Import(module) call in constructor creation |
| ImportExtensions.cs | Deleted entire file containing manual import helper methods |
| WindowsRuntimeTypeHierarchyBuilder.cs | Removed .Import(module) calls in type hierarchy construction |
| InteropTypeDefinitionBuilder.*.cs (multiple files) | Removed module parameter from method signatures and .Import(module) calls throughout |
| DynamicCustomMappedTypeMapEntriesBuilder.cs | Removed .Import(module) call in type resolution |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d7e8792 to
1dfcb04
Compare
8394812 to
49f1f3d
Compare
Bumps the AsmResolver.DotNet package version from 6.0.0-development.282 to 6.0.0-development.317 for improved features and bug fixes.
Refactored code to eliminate redundant .Import(module) calls on type and method references throughout builder and factory classes. This simplifies the codebase and ensures references are used directly, improving maintainability and clarity.
Updated assembly reference creation to use the ImportWith method with DefaultImporter in both InteropGenerator.Discover and InteropReferences. This ensures references are properly imported into the target module context.
Introduced a new Import extension method for AssemblyReference that accepts an IResolutionScope, simplifying the import process. Updated InteropReferences to use the new method, improving code clarity and reducing direct dependency on ContextModule.DefaultImporter.
Added remarks to clarify that assembly references use the same scope as the core library type factory to ensure correct resolution. Also added comments in InteropGenerator.Discover.cs to explain the need for importing both assembly references for accurate signature comparisons during discovery.
Deleted several Import extension methods for types, methods, signatures, and member references that are no longer used. This streamlines the ImportExtensions class and removes unnecessary code.
Bumped AsmResolver.DotNet from 6.0.0-development.317 to 6.0.0-refs-pull-697-merge.322 to incorporate the latest changes and improvements.
49f1f3d to
421756b
Compare
Title. This also simplifies code a lot.