public override bool TryInvoke(InvokeBinder binder, object[] args, out object result) { IodineObject[] arguments = new IodineObject[args.Length]; for (int i = 0; i < args.Length; i++) { arguments [i] = typeRegistry.ConvertToIodineObject(args [i]); } IodineObject returnVal = internalObject.Invoke(internalVm, arguments); result = typeRegistry.ConvertToNativeObject(returnVal); return(true); }
public IodineObject Get(VirtualMachine vm) { if (Getter is IodineMethod) { return(vm.InvokeMethod((IodineMethod)Getter, self, new IodineObject[0])); } else if (Getter is IodineBoundMethod) { return(vm.InvokeMethod(((IodineBoundMethod)Getter).Method, self, new IodineObject[0])); } return(Getter.Invoke(vm, new IodineObject[0])); }
public IodineObject Set(VirtualMachine vm, IodineObject value) { if (Setter is IodineMethod) { return(vm.InvokeMethod((IodineMethod)Setter, self, new IodineObject[] { value })); } if (Setter is IodineBoundMethod) { return(vm.InvokeMethod(((IodineBoundMethod)Setter).Method, self, new IodineObject[] { value })); } return(Setter.Invoke(vm, new IodineObject[] { value })); }
/// <summary> /// Invokes an IodineObject (Calling its __invoke__ method) under this /// context /// </summary> /// <param name="obj">The object to invoke.</param> /// <param name="args">Arguments.</param> public IodineObject Invoke(IodineObject obj, IodineObject[] args) { return(obj.Invoke(VirtualMachine, args)); }