本文整理汇总了C#中Mono.CSharp.Argument.GetSignatureForError方法的典型用法代码示例。如果您正苦于以下问题:C# Argument.GetSignatureForError方法的具体用法?C# Argument.GetSignatureForError怎么用?C# Argument.GetSignatureForError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.Argument
的用法示例。
在下文中一共展示了Argument.GetSignatureForError方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Error_InvalidArguments
protected virtual void Error_InvalidArguments(ResolveContext ec, Location loc, int idx, MethodSpec method,
Argument a, AParametersCollection expected_par, TypeSpec paramType)
{
ExtensionMethodGroupExpr emg = this as ExtensionMethodGroupExpr;
if (a is CollectionElementInitializer.ElementInitializerArgument) {
ec.Report.SymbolRelatedToPreviousError (method);
if ((expected_par.FixedParameters [idx].ModFlags & Parameter.Modifier.ISBYREF) != 0) {
ec.Report.Error (1954, loc, "The best overloaded collection initalizer method `{0}' cannot have 'ref', or `out' modifier",
TypeManager.CSharpSignature (method));
return;
}
ec.Report.Error (1950, loc, "The best overloaded collection initalizer method `{0}' has some invalid arguments",
TypeManager.CSharpSignature (method));
} else if (TypeManager.IsDelegateType (method.DeclaringType)) {
ec.Report.Error (1594, loc, "Delegate `{0}' has some invalid arguments",
TypeManager.CSharpName (method.DeclaringType));
} else {
ec.Report.SymbolRelatedToPreviousError (method);
if (emg != null) {
ec.Report.Error (1928, loc,
"Type `{0}' does not contain a member `{1}' and the best extension method overload `{2}' has some invalid arguments",
emg.ExtensionExpression.GetSignatureForError (),
emg.Name, TypeManager.CSharpSignature (method));
} else {
ec.Report.Error (1502, loc, "The best overloaded method match for `{0}' has some invalid arguments",
TypeManager.CSharpSignature (method));
}
}
Parameter.Modifier mod = idx >= expected_par.Count ? 0 : expected_par.FixedParameters [idx].ModFlags;
string index = (idx + 1).ToString ();
if (((mod & (Parameter.Modifier.REF | Parameter.Modifier.OUT)) ^
(a.Modifier & (Parameter.Modifier.REF | Parameter.Modifier.OUT))) != 0) {
if ((mod & Parameter.Modifier.ISBYREF) == 0)
ec.Report.Error (1615, loc, "Argument `#{0}' does not require `{1}' modifier. Consider removing `{1}' modifier",
index, Parameter.GetModifierSignature (a.Modifier));
else
ec.Report.Error (1620, loc, "Argument `#{0}' is missing `{1}' modifier",
index, Parameter.GetModifierSignature (mod));
} else {
string p1 = a.GetSignatureForError ();
string p2 = TypeManager.CSharpName (paramType);
if (p1 == p2) {
ec.Report.ExtraInformation (loc, "(equally named types possibly from different assemblies in previous ");
ec.Report.SymbolRelatedToPreviousError (a.Expr.Type);
ec.Report.SymbolRelatedToPreviousError (paramType);
}
if (idx == 0 && emg != null) {
ec.Report.Error (1929, loc,
"Extension method instance type `{0}' cannot be converted to `{1}'", p1, p2);
} else {
ec.Report.Error (1503, loc,
"Argument `#{0}' cannot convert `{1}' expression to type `{2}'", index, p1, p2);
}
}
}