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()); } }
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); } }