Exemple #1
0
        private IDeclaration resolveUnresolvedMember(InstanceContext context, String name)
        {
            ConcreteCategoryDeclaration decl    = context.getRegisteredDeclaration <ConcreteCategoryDeclaration>(context.getInstanceType().GetTypeName());
            MethodDeclarationMap        methods = decl.getMemberMethods(context, name);

            if (methods != null && methods.Count > 0)
            {
                return(methods);
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
 public override T getRegisteredDeclaration <T>(string name)
 {
     if (typeof(T) == typeof(MethodDeclarationMap))
     {
         ConcreteCategoryDeclaration decl = getDeclaration();
         if (decl != null)
         {
             MethodDeclarationMap methods = decl.getMemberMethods(this, name);
             if (methods != null && methods.Count > 0)
             {
                 return(TypeUtils.downcast <T>(methods));
             }
         }
     }
     return(base.getRegisteredDeclaration <T>(name));
 }
Exemple #3
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());
            }
        }