public override IType check(Context context) { CategoryDeclaration cd = context.getRegisteredDeclaration <CategoryDeclaration>(this.type.GetTypeName()); if (cd == null) { throw new SyntaxError("Unknown category " + this.type.GetTypeName()); } checkFirstHomonym(context, cd); cd.checkConstructorContext(context); if (copyFrom != null) { IType cft = copyFrom.check(context); if (!(cft is CategoryType) && (cft != DocumentType.Instance)) { throw new SyntaxError("Cannot copy from " + cft.GetTypeName()); } } if (arguments != null) { foreach (Argument argument in arguments) { if (!cd.hasAttribute(context, argument.GetName())) { throw new SyntaxError("\"" + argument.GetName() + "\" is not an attribute of " + type.GetTypeName()); } argument.check(context); } } return(((CategoryType)cd.GetIType(context)).AsMutable(context, type.Mutable)); }