@@ -27,7 +27,7 @@ internal class CallableMethod
2727 {
2828 private readonly BslNativeMethodInfo _method ;
2929
30- private delegate BslValue NativeCallable ( NativeClassInstanceWrapper target , BslValue [ ] args , IBslProcess process ) ;
30+ private delegate BslValue NativeCallable ( IAttachableContext target , BslValue [ ] args , IBslProcess process ) ;
3131
3232 private NativeCallable _delegate ;
3333
@@ -47,23 +47,16 @@ public BslValue Invoke(IBslProcess process, object target, BslValue[] args)
4747 return _delegate . Invoke ( callableWrapper , args , process ) ;
4848 }
4949
50- private NativeClassInstanceWrapper GetCallableWrapper ( object obj )
50+ private IAttachableContext GetCallableWrapper ( object obj )
5151 {
52- NativeClassInstanceWrapper callableWrapper ;
52+ IAttachableContext callableWrapper ;
5353 if ( _method . IsInstance )
5454 {
5555 if ( obj == null )
5656 throw new InvalidOperationException ( $ "Method { _method . Name } is not static and requires target") ;
57- if ( obj is NativeClassInstanceWrapper w )
57+ if ( obj is IAttachableContext context )
5858 {
59- callableWrapper = w ;
60- }
61- else if ( obj is IAttachableContext context )
62- {
63- callableWrapper = new NativeClassInstanceWrapper
64- {
65- Context = context
66- } ;
59+ callableWrapper = context ;
6760 }
6861 else
6962 {
@@ -86,7 +79,7 @@ private static NativeCallable CreateDelegate(BslNativeMethodInfo method)
8679 if ( method . Implementation == default )
8780 throw new InvalidOperationException ( "Method has no implementation" ) ;
8881
89- var targetParam = Expression . Parameter ( typeof ( NativeClassInstanceWrapper ) ) ;
82+ var targetParam = Expression . Parameter ( typeof ( IAttachableContext ) ) ;
9083 var arrayOfValuesParam = Expression . Parameter ( typeof ( BslValue [ ] ) ) ;
9184 var processParam = Expression . Parameter ( typeof ( IBslProcess ) ) ;
9285 var convertedAccessList = new List < Expression > ( ) ;
0 commit comments