Exemplo n.º 1
0
        public UserClass(string className, string parentClassName)
        {
            this.className       = className;
            this.parentClassName = parentClassName;

            parentClass = maybe(this.parentClassName.IsNotEmpty(), () => Module.Global.Class(parentClassName)).Map(bc => (UserClass)bc);
            signatures  = new Set <Selector>();
            metaObject  = none <UserObject>();
            mixins      = new SelectorHash <UserClass>();
        }
Exemplo n.º 2
0
 public BaseClass()
 {
     messages           = new SelectorHash <Func <IObject, Message, IObject> >();
     classMessages      = new SelectorHash <Func <BaseClass, Message, IObject> >();
     registered         = false;
     classRegistered    = false;
     alternateMessages  = new SelectorSet();
     dynamicInvoke      = (obj, _) => throw messageNotFound(classOf(obj), _.Selector);
     classDynamicInvoke = _ => throw messageNotFound(this, _.Selector);
     classFields        = new Fields();
 }
Exemplo n.º 3
0
        protected IObject invokeClassMessage(Message message)
        {
            var selector = message.Selector;

            if (ClassRespondsTo(selector))
            {
                return(classMessages.ContainsKey(selector) ? classMessages[selector](this, message) : ClassDynamicInvoke(message));
            }
            else
            {
                throw messageNotFound(this, selector);
            }
        }
Exemplo n.º 4
0
        protected IObject invokeMessage(IObject obj, Message message)
        {
            var selector = message.Selector;

            if (RespondsTo(selector))
            {
                return(messages.ContainsKey(selector) ? messages[selector](obj, message) : DynamicInvoke(obj, message));
            }
            else
            {
                throw messageNotFound(classOf(obj), selector);
            }
        }