本文整理汇总了C#中Mono.CSharp.TypeExpr.CanInheritFrom方法的典型用法代码示例。如果您正苦于以下问题:C# TypeExpr.CanInheritFrom方法的具体用法?C# TypeExpr.CanInheritFrom怎么用?C# TypeExpr.CanInheritFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.TypeExpr
的用法示例。
在下文中一共展示了TypeExpr.CanInheritFrom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveBaseTypes
protected override TypeExpr[] ResolveBaseTypes (out TypeExpr base_class)
{
TypeExpr[] ifaces = base.ResolveBaseTypes (out base_class);
if (base_class == null) {
if (RootContext.StdLib)
base_class = TypeManager.system_object_expr;
else if (Name != "System.Object")
base_class = TypeManager.system_object_expr;
} else {
if (Kind == Kind.Class && TypeManager.IsGenericParameter (base_class.Type)){
Report.Error (
689, base_class.Location,
"Cannot derive from `{0}' because it is a type parameter",
base_class.GetSignatureForError ());
return ifaces;
}
if (IsGeneric && TypeManager.IsAttributeType (base_class.Type)) {
Report.Error (698, base_class.Location,
"A generic type cannot derive from `{0}' because it is an attribute class",
base_class.GetSignatureForError ());
}
if (base_class.IsSealed){
Report.SymbolRelatedToPreviousError (base_class.Type);
if (base_class.Type.IsAbstract) {
Report.Error (709, Location, "`{0}': Cannot derive from static class `{1}'",
GetSignatureForError (), TypeManager.CSharpName (base_class.Type));
} else {
Report.Error (509, Location, "`{0}': cannot derive from sealed type `{1}'",
GetSignatureForError (), TypeManager.CSharpName (base_class.Type));
}
return ifaces;
}
if (!base_class.CanInheritFrom ()){
Report.Error (644, Location, "`{0}' cannot derive from special class `{1}'",
GetSignatureForError (), base_class.GetSignatureForError ());
return ifaces;
}
if (!IsAccessibleAs (base_class.Type)) {
Report.SymbolRelatedToPreviousError (base_class.Type);
Report.Error (60, Location, "Inconsistent accessibility: base class `{0}' is less accessible than class `{1}'",
TypeManager.CSharpName (base_class.Type), GetSignatureForError ());
}
}
if (PartialContainer.IsStaticClass) {
if (base_class.Type != TypeManager.object_type) {
Report.Error (713, Location, "Static class `{0}' cannot derive from type `{1}'. Static classes must derive from object",
GetSignatureForError (), base_class.GetSignatureForError ());
return ifaces;
}
if (ifaces != null) {
foreach (TypeExpr t in ifaces)
Report.SymbolRelatedToPreviousError (t.Type);
Report.Error (714, Location, "Static class `{0}' cannot implement interfaces", GetSignatureForError ());
}
}
return ifaces;
}