private void SetProperty(String name, MethodInfo getter, MethodInfo setter, DomPutForwardsAttribute putsForward)
        {
            FastSetProperty(name, new PropertyDescriptor(
                                new DomDelegateInstance(_instance, name, (obj, values) =>
                                                        _instance.Call(getter, obj, values)),
                                new DomDelegateInstance(_instance, name, (obj, values) =>
            {
                if (putsForward != null)
                {
                    var ep       = Array.Empty <Object>();
                    var that     = obj.AsObject() as DomNodeInstance;
                    var target   = getter.Invoke(that.Value, ep);
                    var propName = putsForward.PropertyName;
                    var prop     = getter.ReturnType
                                   .GetInheritedProperties()
                                   .FirstOrDefault(m => m.GetCustomAttributes <DomNameAttribute>().Any(n => n.OfficialName.Is(propName)));
                    var args = _instance.BuildArgs(prop.SetMethod, values);
                    prop.SetMethod.Invoke(target, args);
                    return(prop.GetMethod.Invoke(target, ep).ToJsValue(_instance));
                }

                return(_instance.Call(setter, obj, values));
            }), false, false));
        }
Exemplo n.º 2
0
 public override JsValue Call(JsValue thisObject, JsValue[] arguments) =>
 _instance.Call(_method, thisObject, arguments);