Exemple #1
0
        public override INamed getRegistered(string name)
        {
            if (widgetFields != null)
            {
                WidgetField field = null;
                if (widgetFields.TryGetValue(name, out field))
                {
                    return(field);
                }
            }
            INamed actual = base.getRegistered(name);

            if (actual != null)
            {
                return(actual);
            }
            ConcreteCategoryDeclaration decl    = getDeclaration();
            MethodDeclarationMap        methods = decl.getMemberMethods(this, name);

            if (methods != null && methods.Count > 0)
            {
                return(methods);
            }
            else if (decl.hasAttribute(this, name))
            {
                return(getRegisteredDeclaration <AttributeDeclaration>(name));
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
        protected override IValue readValue(String name, Func <IValue> supplier)
        {
            ConcreteCategoryDeclaration decl = getDeclaration();

            if (decl.hasAttribute(this, name))
            {
                IValue value = instance.GetMemberValue(calling, name, false);
                return(value != null ? value : supplier.Invoke());
            }
            else if (decl.hasMethod(this, name))
            {
                IMethodDeclaration method = decl.getMemberMethods(this, name).GetFirst();
                return(new ClosureValue(this, new MethodType(method)));
            }
            else
            {
                return(supplier.Invoke());
            }
        }
Exemple #3
0
        public override Context contextForValue(String name)
        {
            // params and variables have precedence over members
            // so first look in context values
            Context context = base.contextForValue(name);

            if (context != null)
            {
                return(context);
            }
            ConcreteCategoryDeclaration decl = getDeclaration();

            if (decl.hasAttribute(this, name) || decl.hasMethod(this, name))
            {
                return(this);
            }
            else
            {
                return(null);
            }
        }