本文整理汇总了C#中Mono.CSharp.MemberCore.IsAccessibleAs方法的典型用法代码示例。如果您正苦于以下问题:C# MemberCore.IsAccessibleAs方法的具体用法?C# MemberCore.IsAccessibleAs怎么用?C# MemberCore.IsAccessibleAs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.MemberCore
的用法示例。
在下文中一共展示了MemberCore.IsAccessibleAs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Resolve
/// <summary>
/// Resolve the constraints - but only resolve things into Expression's, not
/// into actual types.
/// </summary>
public bool Resolve (MemberCore ec, TypeParameter tp, Report Report)
{
if (resolved)
return true;
if (ec == null)
return false;
iface_constraints = new ArrayList (2); // TODO: Too expensive allocation
type_param_constraints = new ArrayList ();
foreach (object obj in constraints) {
if (HasConstructorConstraint) {
Report.Error (401, loc,
"The new() constraint must be the last constraint specified");
return false;
}
if (obj is SpecialConstraint) {
SpecialConstraint sc = (SpecialConstraint) obj;
if (sc == SpecialConstraint.Constructor) {
if (!HasValueTypeConstraint) {
attrs |= GenericParameterAttributes.DefaultConstructorConstraint;
continue;
}
Report.Error (451, loc, "The `new()' constraint " +
"cannot be used with the `struct' constraint");
return false;
}
if ((num_constraints > 0) || HasReferenceTypeConstraint || HasValueTypeConstraint) {
Report.Error (449, loc, "The `class' or `struct' " +
"constraint must be the first constraint specified");
return false;
}
if (sc == SpecialConstraint.ReferenceType)
attrs |= GenericParameterAttributes.ReferenceTypeConstraint;
else
attrs |= GenericParameterAttributes.NotNullableValueTypeConstraint;
continue;
}
int errors = Report.Errors;
FullNamedExpression fn = ((Expression) obj).ResolveAsTypeStep (ec, false);
if (fn == null) {
if (errors != Report.Errors)
return false;
NamespaceEntry.Error_NamespaceNotFound (loc, ((Expression)obj).GetSignatureForError (), Report);
return false;
}
TypeExpr expr;
GenericTypeExpr cexpr = fn as GenericTypeExpr;
if (cexpr != null) {
expr = cexpr.ResolveAsBaseTerminal (ec, false);
} else
expr = ((Expression) obj).ResolveAsTypeTerminal (ec, false);
if ((expr == null) || (expr.Type == null))
return false;
if (!ec.IsAccessibleAs (fn.Type)) {
Report.SymbolRelatedToPreviousError (fn.Type);
Report.Error (703, loc,
"Inconsistent accessibility: constraint type `{0}' is less accessible than `{1}'",
fn.GetSignatureForError (), ec.GetSignatureForError ());
return false;
}
if (TypeManager.IsGenericParameter (expr.Type))
type_param_constraints.Add (expr);
else if (expr.IsInterface)
iface_constraints.Add (expr);
else if (class_constraint != null || iface_constraints.Count != 0) {
Report.Error (406, loc,
"The class type constraint `{0}' must be listed before any other constraints. Consider moving type constraint to the beginning of the constraint list",
expr.GetSignatureForError ());
return false;
} else if (HasReferenceTypeConstraint || HasValueTypeConstraint) {
Report.Error (450, loc, "`{0}': cannot specify both " +
"a constraint class and the `class' " +
"or `struct' constraint", expr.GetSignatureForError ());
return false;
} else
class_constraint = expr;
//
// Checks whether each generic method parameter constraint type
// is valid with respect to T
//
//.........这里部分代码省略.........