本文整理汇总了C#中Expression.GetSignatureForError方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.GetSignatureForError方法的具体用法?C# Expression.GetSignatureForError怎么用?C# Expression.GetSignatureForError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Expression
的用法示例。
在下文中一共展示了Expression.GetSignatureForError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateNullConstant
//
// CSC 2 has this behavior, it allows structs to be compared
// with the null literal *outside* of a generics context and
// inlines that as true or false.
//
Expression CreateNullConstant (Expression expr)
{
// FIXME: Handle side effect constants
Constant c = new BoolConstant (Oper == Operator.Inequality, loc);
if ((Oper & Operator.EqualityMask) != 0) {
Report.Warning (472, 2, loc, "The result of comparing value type `{0}' with null is `{1}'",
expr.GetSignatureForError (), c.AsString ());
} else {
Report.Warning (464, 2, loc, "The result of comparing type `{0}' with null is always `{1}'",
expr.GetSignatureForError (), c.AsString ());
}
return ReducedExpression.Create (c, this);
}
示例2: Error_ConversionFailed
void Error_ConversionFailed (ResolveContext ec, MethodSpec method, Expression return_type)
{
var invoke_method = Delegate.GetInvokeMethod (type);
string member_name = method_group.InstanceExpression != null ?
Delegate.FullDelegateDesc (method) :
TypeManager.GetFullNameSignature (method);
ec.Report.SymbolRelatedToPreviousError (type);
ec.Report.SymbolRelatedToPreviousError (method);
if (ec.Module.Compiler.Settings.Version == LanguageVersion.ISO_1) {
ec.Report.Error (410, loc, "A method or delegate `{0} {1}' parameters and return type must be same as delegate `{2} {3}' parameters and return type",
method.ReturnType.GetSignatureForError (), member_name,
invoke_method.ReturnType.GetSignatureForError (), Delegate.FullDelegateDesc (invoke_method));
return;
}
if (return_type == null) {
ec.Report.Error (123, loc, "A method or delegate `{0}' parameters do not match delegate `{1}' parameters",
member_name, Delegate.FullDelegateDesc (invoke_method));
return;
}
ec.Report.Error (407, loc, "A method or delegate `{0} {1}' return type does not match delegate `{2} {3}' return type",
return_type.GetSignatureForError (), member_name,
invoke_method.ReturnType.GetSignatureForError (), Delegate.FullDelegateDesc (invoke_method));
}