public bool isDerivedFrom(Context context, CategoryType other) { try { IDeclaration thisDecl = getDeclaration(context); if (thisDecl is CategoryDeclaration) { return(isDerivedFrom(context, (CategoryDeclaration)thisDecl, other)); } } catch (SyntaxError) { } return(false); // TODO }
public bool isDerivedFrom(Context context, CategoryDeclaration decl, CategoryType other) { if (decl.getDerivedFrom() == null) { return(false); } foreach (String derived in decl.getDerivedFrom()) { CategoryType ct = new CategoryType(derived); if (ct.Equals(other) || ct.isDerivedFrom(context, other)) { return(true); } } return(false); }
public override bool Equals(Object obj) { if (obj == this) { return(true); } if (obj == null) { return(false); } if (!(obj is CategoryType)) { return(false); } CategoryType other = (CategoryType)obj; return(this.GetTypeName().Equals(other.GetTypeName())); }
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); }
public bool isDerivedFromAnonymous(Context context, CategoryDeclaration thisDecl, CategoryType other) { if (!other.isAnonymous()) { return(false); } try { IDeclaration otherDecl = other.getDeclaration(context); if (otherDecl is CategoryDeclaration) { return(isDerivedFromAnonymous(context, thisDecl, (CategoryDeclaration)otherDecl)); } } catch (SyntaxError) { } return(false); // TODO }
public bool isAssignableFrom(Context context, CategoryType other) { return("Any" == this.typeName || other.isDerivedFrom(context, this) || other.isDerivedFromAnonymous(context, this)); }
public CategoryType(CategoryType source, bool mutable) : base(source.GetFamily()) { this.typeName = source.typeName; this.Mutable = mutable; }