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