コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: IodineProperty.cs プロジェクト: josh-127/Iodine
 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]));
 }
コード例 #3
0
ファイル: IodineProperty.cs プロジェクト: josh-127/Iodine
        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 }));
        }
コード例 #4
0
ファイル: IodineContext.cs プロジェクト: parhelia512/nginz
 /// <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));
 }