Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 27, 2026

  • Understand issue Add expression based CodeMatch.LoadField/StoreField #756: Add expression-based CodeMatch.LoadsField() and CodeMatch.StoresField() methods
  • Analyze existing code structure
  • Add GetFieldInfo<T> and GetFieldInfo(LambdaExpression) methods to SymbolExtensions class
  • Add expression-based LoadsField<T> and StoresField<T> overloads to CodeMatch class
  • Add expression-based LoadField<T> and StoreField<T> overloads to CodeInstruction class
  • Consolidate CodeInstruction.LoadField/StoreField to follow DRY principles:
    • Added LoadField(FieldInfo, bool) and StoreField(FieldInfo) base overloads
    • Type/string and expression overloads now delegate to base overloads
  • Add tests for all new methods (13 tests added)
  • Run tests to verify implementation (all pass)
  • Run dotnet format to fix formatting
  • Run code review (no issues)
  • Run CodeQL security check (no issues)
Original prompt

Can you implement #756


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…Instruction, and SymbolExtensions (issue #756)

Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement feature for issue #756 Add expression-based field access for CodeMatch and CodeInstruction Jan 27, 2026
Copilot AI requested a review from pardeike January 27, 2026 07:10
@pardeike
Copy link
Owner

@copilot Can you doublecheck if we created code that already exists or that can be consolidated? We need to adhere to DRY principles.

…ieldInfo-based overloads

Co-authored-by: pardeike <853584+pardeike@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 27, 2026

@copilot Can you doublecheck if we created code that already exists or that can be consolidated? We need to adhere to DRY principles.

Reviewed and consolidated CodeInstruction.LoadField/StoreField to follow DRY principles. The opcode selection logic was duplicated across Type/string and expression overloads.

Added new FieldInfo-based overloads (LoadField(FieldInfo, bool) and StoreField(FieldInfo)) that contain the core logic, and refactored existing overloads to delegate to these base methods. This also provides a useful new API surface for users who already have a FieldInfo. (a298a11)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants