예제 #1
0
        public object Execute(object receiver, params object[] arguments)
        {
            IObject   self     = (IObject)receiver;
            IBehavior behavior = (IBehavior)self.Behavior;

            return(behavior.CreateDelegated().Allocate(self.Size));
        }
예제 #2
0
        public void LookupWithParent()
        {
            BaseBehavior baseBehavior  = new BaseBehavior();
            IBehavior    behavior      = baseBehavior.CreateDelegated();
            IObject      childBehavior = behavior.CreateDelegated();

            IMethod method = new MockMethod();

            behavior.Send("methodAt:put:", "aMethod", method);

            IMethod retrievedMethod = (IMethod)childBehavior.Send("lookup:", "aMethod");

            Assert.IsNotNull(retrievedMethod);
            Assert.AreEqual(method, retrievedMethod);
        }
예제 #3
0
        public IObject CreatePrototype(string prototypeName, string superName, List <string> variableNames)
        {
            IObject   super      = (IObject)this.globals[superName];
            IBehavior superclass = (IBehavior)super.Behavior;
            IClass    cls        = (IClass)superclass.CreateDelegated();

            if (variableNames != null)
            {
                foreach (string name in variableNames)
                {
                    cls.AddVariable(name);
                }
            }

            IObject obj = cls.CreateInstance();

            this.globals[prototypeName] = obj;
            return(obj);
        }
예제 #4
0
        public object Execute(object receiver, params object[] arguments)
        {
            IBehavior self = (IBehavior)receiver;

            return(self.CreateDelegated());
        }