public bool isDerivedFromAnonymous(Context context, CategoryDeclaration thisDecl, CategoryDeclaration otherDecl) { // an anonymous category extends 1 and only 1 category String baseName = otherDecl.getDerivedFrom()[0]; // check we derive from root category (if not extending 'any') if (!"any".Equals(baseName) && !thisDecl.isDerivedFrom(context, new CategoryType(baseName))) { return(false); } foreach (String attribute in otherDecl.GetAllAttributes(context)) { if (!thisDecl.hasAttribute(context, attribute)) { return(false); } } return(true); }
public override bool isMoreSpecificThan(Context context, IType other) { if (other is NullType || other is AnyType || other is MissingType) { return(true); } if (!(other is CategoryType)) { return(false); } CategoryType otherCat = (CategoryType)other; if (otherCat.isAnonymous()) { return(true); } CategoryDeclaration thisDecl = context.getRegisteredDeclaration <CategoryDeclaration>(this.GetTypeName()); if (thisDecl.isDerivedFrom(context, otherCat)) { return(true); } return(false); }