Skip to content

Support bound dot calls for LuaObject instance methods - #390

Merged
akeit0 merged 2 commits into
mainfrom
codex/bound-instance-methods
Oct 29, 2026
Merged

akeit0 merged 2 commits into
mainfrom
codex/bound-instance-methods

Conversation

@akeit0

@akeit0 akeit0 commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Add [LuaObject(BindInstanceMethods = true)] so obj.Method(...) and saved method references use the originating instance through cached BoundClosure<T> functions.

The option defaults to false, preserving explicit-receiver calls. Bound calls treat every supplied argument as a method parameter, including the bound object itself. Static methods and metamethods keep their existing conventions.

Class bindings use a lazy per-object array. Record bindings use weak-keyed arrays to preserve record equality and clone behavior.

Validation: solution build; 1,606 runtime tests on each .NET 8/10 and 73 generator tests (excluding ExpectedFailure); CSharpier. Tests cover receiver identity, inherited methods, async argument views and cancellation, ref/out, metamethods, record cloning, and argument errors.

@akeit0
akeit0 marked this pull request as ready for review October 29, 2026 12:56
@akeit0
akeit0 merged commit 50d867c into main Oct 29, 2026
2 checks passed
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.

1 participant