本文整理匯總了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;
}