本文整理汇总了C#中Mono.CSharp.FullNamedExpression.GetSignatureForError方法的典型用法代码示例。如果您正苦于以下问题:C# FullNamedExpression.GetSignatureForError方法的具体用法?C# FullNamedExpression.GetSignatureForError怎么用?C# FullNamedExpression.GetSignatureForError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.FullNamedExpression
的用法示例。
在下文中一共展示了FullNamedExpression.GetSignatureForError方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveBaseTypes
/// <summary>
/// This function computes the Base class and also the
/// list of interfaces that the class or struct @c implements.
///
/// The return value is an array (might be null) of
/// interfaces implemented (as Types).
///
/// The @base_class argument is set to the base object or null
/// if this is `System.Object'.
/// </summary>
protected virtual TypeSpec[] ResolveBaseTypes (out FullNamedExpression base_class)
{
base_class = null;
if (type_bases == null)
return null;
int count = type_bases.Count;
TypeSpec[] ifaces = null;
var base_context = new BaseContext (this);
for (int i = 0, j = 0; i < count; i++){
FullNamedExpression fne = type_bases [i];
var fne_resolved = fne.ResolveAsType (base_context);
if (fne_resolved == null)
continue;
if (i == 0 && Kind == MemberKind.Class && !fne_resolved.IsInterface) {
if (fne_resolved.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
Report.Error (1965, Location, "Class `{0}' cannot derive from the dynamic type",
GetSignatureForError ());
continue;
}
base_type = fne_resolved;
base_class = fne;
continue;
}
if (ifaces == null)
ifaces = new TypeSpec [count - i];
if (fne_resolved.IsInterface) {
for (int ii = 0; ii < j; ++ii) {
if (fne_resolved == ifaces [ii]) {
Report.Error (528, Location, "`{0}' is already listed in interface list",
fne_resolved.GetSignatureForError ());
break;
}
}
if (Kind == MemberKind.Interface && !IsAccessibleAs (fne_resolved)) {
Report.Error (61, fne.Location,
"Inconsistent accessibility: base interface `{0}' is less accessible than interface `{1}'",
fne_resolved.GetSignatureForError (), GetSignatureForError ());
}
} else {
Report.SymbolRelatedToPreviousError (fne_resolved);
if (Kind != MemberKind.Class) {
Report.Error (527, fne.Location, "Type `{0}' in interface list is not an interface", fne_resolved.GetSignatureForError ());
} else if (base_class != null)
Report.Error (1721, fne.Location, "`{0}': Classes cannot have multiple base classes (`{1}' and `{2}')",
GetSignatureForError (), base_class.GetSignatureForError (), fne_resolved.GetSignatureForError ());
else {
Report.Error (1722, fne.Location, "`{0}': Base class `{1}' must be specified as first",
GetSignatureForError (), fne_resolved.GetSignatureForError ());
}
}
ifaces [j++] = fne_resolved;
}
return ifaces;
}
示例2: Error_TypeArgumentsCannotBeUsed
public static void Error_TypeArgumentsCannotBeUsed (FullNamedExpression expr, Location loc)
{
if (expr is TypeExpr) {
RootContext.ToplevelTypes.Compiler.Report.SymbolRelatedToPreviousError (expr.Type);
Error_TypeArgumentsCannotBeUsed (loc, "type", expr.GetSignatureForError ());
} else {
RootContext.ToplevelTypes.Compiler.Report.Error (307, loc, "The {0} `{1}' cannot be used with type arguments",
expr.ExprClassName, expr.GetSignatureForError ());
}
}
示例3: Error_AmbiguousReference
void Error_AmbiguousReference(string name, FullNamedExpression a, FullNamedExpression b, Location loc)
{
var report = Compiler.Report;
report.SymbolRelatedToPreviousError (a.Type);
report.SymbolRelatedToPreviousError (b.Type);
report.Error (104, loc, "`{0}' is an ambiguous reference between `{1}' and `{2}'",
name, a.GetSignatureForError (), b.GetSignatureForError ());
}
示例4: Error_AmbiguousTypeReference
void Error_AmbiguousTypeReference (Location loc, string name, FullNamedExpression t1, FullNamedExpression t2)
{
Compiler.Report.SymbolRelatedToPreviousError (t1.Type);
Compiler.Report.SymbolRelatedToPreviousError (t2.Type);
Compiler.Report.Error (104, loc, "`{0}' is an ambiguous reference between `{1}' and `{2}'",
name, t1.GetSignatureForError (), t2.GetSignatureForError ());
}
示例5: Resolve
// <summary>
// Resolve is used in method definitions
// </summary>
public virtual TypeSpec Resolve (IMemberContext rc, int index)
{
if (parameter_type != null)
return parameter_type;
if (attributes != null)
attributes.AttachTo (this, rc);
var expr = texpr.ResolveAsTypeTerminal (rc, false);
if (expr == null)
return null;
this.idx = index;
texpr = expr;
parameter_type = texpr.Type;
if ((modFlags & Parameter.Modifier.ISBYREF) != 0 &&
TypeManager.IsSpecialType (parameter_type)) {
rc.Compiler.Report.Error (1601, Location, "Method or delegate parameter cannot be of type `{0}'",
GetSignatureForError ());
return null;
}
TypeManager.CheckTypeVariance (parameter_type,
(modFlags & Parameter.Modifier.ISBYREF) != 0 ? Variance.None : Variance.Contravariant,
rc);
if (parameter_type.IsStatic) {
rc.Compiler.Report.Error (721, Location, "`{0}': static types cannot be used as parameters",
texpr.GetSignatureForError ());
return parameter_type;
}
if ((modFlags & Modifier.This) != 0 && (parameter_type.IsPointer || parameter_type == InternalType.Dynamic)) {
rc.Compiler.Report.Error (1103, Location, "The extension method cannot be of type `{0}'",
TypeManager.CSharpName (parameter_type));
}
return parameter_type;
}
示例6: Error_IdentifierNotFound
protected virtual void Error_IdentifierNotFound (IMemberContext rc, FullNamedExpression expr_type, string identifier)
{
Expression member_lookup = MemberLookup (rc.Compiler,
rc.CurrentType, expr_type.Type, expr_type.Type, SimpleName.RemoveGenericArity (identifier),
MemberTypes.NestedType, BindingFlags.Public | BindingFlags.NonPublic, loc);
if (member_lookup != null) {
expr_type = member_lookup.ResolveAsTypeTerminal (rc, false);
if (expr_type == null)
return;
Namespace.Error_TypeArgumentsCannotBeUsed (expr_type, loc);
return;
}
member_lookup = MemberLookup (rc.Compiler,
rc.CurrentType, expr_type.Type, expr_type.Type, identifier,
MemberTypes.All, BindingFlags.Public | BindingFlags.NonPublic, loc);
if (member_lookup == null) {
rc.Compiler.Report.Error (426, loc, "The nested type `{0}' does not exist in the type `{1}'",
Name, expr_type.GetSignatureForError ());
} else {
// TODO: Report.SymbolRelatedToPreviousError
member_lookup.Error_UnexpectedKind (rc.Compiler.Report, null, "type", loc);
}
}
示例7: Resolve
public override FullNamedExpression Resolve (IResolveContext rc)
{
if (resolved != null || value == null)
return resolved;
resolved = value.GetTypeExpression ().ResolveAsTypeStep (rc, false);
if (resolved == null) {
value = null;
return null;
}
TypeExpr te = resolved as TypeExpr;
if (te != null) {
if (!te.CheckAccessLevel (rc.DeclContainer)) {
Report.SymbolRelatedToPreviousError (te.Type);
Expression.ErrorIsInaccesible (resolved.Location, resolved.GetSignatureForError ());
}
}
return resolved;
}
示例8: Error_TypeArgumentsCannotBeUsed
public static void Error_TypeArgumentsCannotBeUsed (FullNamedExpression expr, Location loc)
{
if (expr is TypeExpr) {
Report.SymbolRelatedToPreviousError (expr.Type);
Error_TypeArgumentsCannotBeUsed (loc, "type", expr.GetSignatureForError ());
} else {
expr.Error_ExpressionCannotBeGeneric (loc);
}
}