Define proxy methods for out / ref parameters
ParameterBuilder IsIn & IsOut need to be set correctly for functions with out / ref parameters, along with codegen to propagate values back to the caller. eg .ActLike<Microsoft.Office.Interop.Word.Range>()
Yeah looks like I don't have any code coverage for ref, out, or in.
Checking what the c# compiler does for out variables using the dlr, it looks like call site gets a ref parameter for any out, binder flags get CSharpArgumentInfoFlags.IsOut. From the description above sounds like the interface implementation doesn't get set correctly either but that should be the easiest part.
public bool TryGetValue(TKey key, out TValue value)
{
if (<>o__2.<>p__1 == null)
{
<>o__2.<>p__1 = CallSite<Func<CallSite, object, bool>>.Create(Binder.Convert(CSharpBinderFlags.None, typeof(bool), typeof(ManualProxy<TKey, TValue>)));
}
Func<CallSite, object, bool> target = <>o__2.<>p__1.Target;
CallSite<Func<CallSite, object, bool>> <>p__ = <>o__2.<>p__1;
if (<>o__2.<>p__0 == null)
{
<>o__2.<>p__0 = CallSite<<>F{00000008}<CallSite, object, TKey, TValue, object>>.Create(Binder.InvokeMember(CSharpBinderFlags.None, "TryGetValue", null, typeof(ManualProxy<TKey, TValue>), new CSharpArgumentInfo[3]
{
CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, null),
CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType | CSharpArgumentInfoFlags.IsOut, null)
}));
}
return target(<>p__, <>o__2.<>p__0.Target(<>o__2.<>p__0, _target, key, ref value));
}
- [ ] Add Test Coverage for ref/out/in
- [ ] fix issues related to failing tests (below are guesses)
- [ ] Make sure interface is implementation is emitted properly
- [ ] Make Sure callsite class is emitted with ref params
- [ ] Make sure CSharpArgumentInfo are setup correctly
- [ ] Make sure call site call is emitted to handle refs
Adding jump in tag, because i'm not sure when I'll have time to dive into this myself.