示例#1
0
 public IodineObject Get(VirtualMachine vm)
 {
     if (Getter is IodineMethod) {
         return vm.InvokeMethod ((IodineMethod)Getter, self, new IodineObject[0]);
     } else if (Getter is IodineInstanceMethodWrapper) {
         return vm.InvokeMethod (((IodineInstanceMethodWrapper)Getter).Method, self,
             new IodineObject[0]);
     }
     return Getter.Invoke (vm, new IodineObject[0]);
 }
示例#2
0
 public IodineObject Set(VirtualMachine vm, IodineObject value)
 {
     if (Setter is IodineMethod) {
         return vm.InvokeMethod ((IodineMethod)Setter, self, new IodineObject[] { value });
     } else if (Setter is IodineInstanceMethodWrapper) {
         return vm.InvokeMethod (((IodineInstanceMethodWrapper)Setter).Method, self,
             new IodineObject[] { value });
     }
     return Setter.Invoke (vm, new IodineObject[] { value });
 }
示例#3
0
 public IodineObject Set(VirtualMachine vm, IodineObject value)
 {
     if (Setter is IodineMethod)
     {
         return(vm.InvokeMethod((IodineMethod)Setter, self, new IodineObject[] { value }));
     }
     else if (Setter is IodineBoundMethod)
     {
         return(vm.InvokeMethod(((IodineBoundMethod)Setter).Method, self,
                                new IodineObject[] { value }));
     }
     return(Setter.Invoke(vm, new IodineObject[] { value }));
 }
示例#4
0
 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]));
 }
示例#5
0
 public override bool IterMoveNext(VirtualMachine vm)
 {
     if (stackFrame.AbortExecution) {
         return false;
     }
     value = vm.InvokeMethod (baseMethod, stackFrame, self, arguments);
     return stackFrame.Yielded;
 }
示例#6
0
 public override IodineObject Invoke(VirtualMachine vm, IodineObject[] arguments)
 {
     if (Method.Generator)
     {
         return(new IodineGenerator(vm.Top, this, arguments));
     }
     return(vm.InvokeMethod(Method, Self, arguments));
 }
示例#7
0
 public override bool IterMoveNext(VirtualMachine vm)
 {
     if (stackFrame.AbortExecution)
     {
         return(false);
     }
     value = vm.InvokeMethod(baseMethod, stackFrame, self, arguments);
     return(stackFrame.Yielded);
 }
示例#8
0
		public override IodineObject Invoke (VirtualMachine vm, IodineObject[] arguments)
		{
			if (!initializerInvoked) {
				initializerInvoked = true;
				Initializer.Invoke (vm, new IodineObject[] { });
			}
			IodineObject obj = new IodineObject (this);
			BindAttributes (obj);
			vm.InvokeMethod (Constructor, obj, arguments);
			return obj;
		}
示例#9
0
        public override IodineObject Invoke(VirtualMachine vm, IodineObject[] arguments)
        {
            StackFrame   newFrame     = frame.Duplicate(vm.Top);
            IodineObject initialValue = vm.InvokeMethod(Target, newFrame, frame.Self, arguments);

            if (newFrame.Yielded)
            {
                return(new IodineGenerator(newFrame, Target, arguments, initialValue));
            }
            return(initialValue);
        }
示例#10
0
        public override IodineObject Invoke(VirtualMachine vm, IodineObject[] arguments)
        {
            if (!initializerInvoked)
            {
                initializerInvoked = true;
                Initializer.Invoke(vm, new IodineObject[] { });
            }
            IodineObject obj = new IodineObject(this);

            BindAttributes(obj);
            vm.InvokeMethod(Constructor, obj, arguments);
            return(obj);
        }
        /// <summary>
        /// Invoke the specified vm and arguments.
        /// </summary>
        /// <param name="vm">Vm.</param>
        /// <param name="arguments">Arguments.</param>
        public override IodineObject Invoke(VirtualMachine vm, IodineObject[] arguments)
        {
            StackFrame frame = new StackFrame(Method.Module,
                                              Method,
                                              vm.Top == null ? new IodineObject[] {} : vm.Top.Arguments,
                                              vm.Top,
                                              Self
                                              );

            IodineObject initialValue = vm.InvokeMethod(Method, frame, Self, arguments);

            if (frame.Yielded)
            {
                return(new IodineGenerator(frame, this, arguments, initialValue));
            }
            return(initialValue);
        }
示例#12
0
        public override IodineObject Invoke(VirtualMachine vm, IodineObject [] arguments)
        {
            if (!initializerInvoked)
            {
                initializerInvoked = true;
                //Initializer.Invoke (vm, new IodineObject[] { });
            }
            var obj = new IodineObject(this);

            BindAttributes(obj);

            if (BaseClass != null)
            {
                //BaseClass.Inherit (vm, obj, new IodineObject[] { });
            }
            vm.InvokeMethod(Constructor, obj, arguments);
            return(obj);
        }
        public override bool IterMoveNext(VirtualMachine vm)
        {
            if (stackFrame.AbortExecution)
            {
                return(false);
            }

            if (initialAccess)
            {
                value = vm.InvokeMethod(baseMethod, stackFrame, self, arguments);

                return(stackFrame.Yielded);
            }
            else
            {
                initialAccess = true;
                return(true);
            }
        }
示例#14
0
        /// <summary>
        /// Invoke the specified vm and arguments.
        /// </summary>
        /// <param name="vm">Vm.</param>
        /// <param name="arguments">Arguments.</param>
        public override IodineObject Invoke(VirtualMachine vm, IodineObject[] arguments)
        {
            /*
             * If this method happens to be a generator method (Which just means it has
             * a yield statement in it), we will attempt to invoke it in the VM and check
             * if the method yielded or not. If the method did yield, we must return a
             * generator so the caller can iterate over any other items which this method
             * may yield. If the method did not yield, we just return the original value
             * returned
             */
            StackFrame   frame        = new StackFrame(this.Module, this, vm.Top.Arguments, vm.Top, null);
            IodineObject initialValue = vm.InvokeMethod(this, frame, null, arguments);

            if (frame.Yielded)
            {
                return(new IodineGenerator(frame, this, arguments, initialValue));
            }
            return(initialValue);
        }
示例#15
0
		public override IodineObject Invoke (VirtualMachine vm, IodineObject[] arguments)
		{
			return vm.InvokeMethod (Target, frame.Duplicate (vm.Top, Target.LocalCount),
				frame.Self, arguments);
		}
示例#16
0
		public override IodineObject Invoke (VirtualMachine vm, IodineObject[] arguments)
		{
			if (Method.Generator)
				return new IodineGenerator (vm.Top, this, arguments);
			return vm.InvokeMethod (Method, Self, arguments);
		}
示例#17
0
		public override IodineObject Invoke (VirtualMachine vm, IodineObject[] arguments)
		{
			if (Generator) {
				return new IodineGenerator (vm.Top, this, arguments);
			}
			return vm.InvokeMethod (this, null, arguments);
		}
示例#18
0
 public override IodineObject Invoke(VirtualMachine vm, IodineObject[] arguments)
 {
     return(vm.InvokeMethod(Target, frame.Duplicate(vm.Top, Target.LocalCount),
                            frame.Self, arguments));
 }