private object InternalInvokeTarget(NSJSFunction function, DynamicMetaObject[] args, Type returnType, ref Exception exception) { object results = null; do { if (function == null) { exception = new InvalidOperationException("The called method is not defined correctly"); break; } if (returnType == null) { returnType = typeof(object); } NSJSVirtualMachine machine = GetVirtualMachine(this.Value); IList <NSJSValue> s = new List <NSJSValue>(); for (int i = 0; i < args.Length; i++) { DynamicMetaObject mo = args[i]; s.Add(this.ToValue(machine, mo.Value)); } results = this.Convert(returnType, function.Call(s)); } while (false); return(results); }
private static bool nsjs_localvalue_instanceof(NSJSValue instance, NSJSValue type) { if (instance == null || type == null) { return(false); } NSJSFunction __instanceof = instance.GetFrameworkFunction(RUNTIME_INSTANCEOF_PROPERTYKEY); return((__instanceof.Call(new NSJSValue[] { instance, type }) as NSJSInt32)?.Value == 1); }
public virtual bool IsDefined(string key) { if (string.IsNullOrEmpty(key)) { return(false); } NSJSFunction function = this.GetFrameworkFunction(RUNTIME_ISDEFINED_PROPERTYKEY); return((function.Call(new NSJSValue[] { this, NSJSString.New(this.VirtualMachine, key) }) as NSJSInt32)?.Value == 1); }
public virtual NSJSObject GetPropertyDescriptor(string key) { if (string.IsNullOrEmpty(key)) { return(null); } NSJSFunction function = this.GetFrameworkFunction(RUNTIME_GETPROPERTYDESCRIPTOR_PROPERTYKEY); return(function.Call(new NSJSValue[] { this, NSJSString.New(this.VirtualMachine, key) }) as NSJSObject); }
public virtual NSJSValue RemoveAt(int index) { if (index < 0 || index >= this.Length) { throw new ArgumentOutOfRangeException("value"); } NSJSFunction splice = (NSJSFunction)base.Get("splice"); return(splice.Call(NSJSInt32.New(this.VirtualMachine, index))); }
public virtual void Add(NSJSValue value) { if (value == null) { value = NSJSValue.Null(this.VirtualMachine); } NSJSFunction push = (NSJSFunction)base.Get("push"); push.Call(value); }
public virtual int IndexOf(NSJSValue value) { if (value == null) { return(-1); } NSJSFunction indexOf = (NSJSFunction)base.Get("indexOf"); NSJSInt32 result = indexOf.Call(value) as NSJSInt32; if (result == null) { return(-1); } return(result.Value); }
public virtual IEnumerable <string> GetPropertyNames() { NSJSFunction function = this.GetFrameworkFunction(RUNTIME_GETPROPERTYNAMES_PROPERTYKEY); return(ArrayAuxiliary.ToStringList(function.Call(this))); }
public virtual NSJSValue Clear() { NSJSFunction splice = (NSJSFunction)base.Get("splice"); return(splice.Call(NSJSInt32.New(this.VirtualMachine, 0), NSJSInt32.New(this.VirtualMachine, this.Length))); }