本文整理汇总了C#中Mono.CSharp.Report.Error方法的典型用法代码示例。如果您正苦于以下问题:C# Report.Error方法的具体用法?C# Report.Error怎么用?C# Report.Error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.Report
的用法示例。
在下文中一共展示了Report.Error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Error_InvalidConstantType
public static void Error_InvalidConstantType(TypeSpec t, Location loc, Report Report)
{
if (t.IsGenericParameter) {
Report.Error (1959, loc,
"Type parameter `{0}' cannot be declared const", TypeManager.CSharpName (t));
} else {
Report.Error (283, loc,
"The type `{0}' cannot be declared const", TypeManager.CSharpName (t));
}
}
示例2: ErrorDuplicateName
protected virtual void ErrorDuplicateName (Parameter p, Report Report)
{
Report.Error (100, p.Location, "The parameter name `{0}' is a duplicate", p.Name);
}
示例3: Error1599
public static void Error1599 (Location loc, TypeSpec t, Report Report)
{
Report.Error (1599, loc, "Method or delegate cannot return type `{0}'", t.GetSignatureForError ());
}
示例4: Error_GlobalNamespaceRedefined
public static void Error_GlobalNamespaceRedefined(Report report, Location loc)
{
report.Error (1681, loc, "The global extern alias cannot be redefined");
}
示例5: CheckReachableExit
bool CheckReachableExit (Report report)
{
if (block.HasReachableClosingBrace && ReturnType.Kind != MemberKind.Void) {
// FIXME: Flow-analysis on MoveNext generated code
if (!IsIterator) {
report.Error (1643, StartLocation,
"Not all code paths return a value in anonymous method of type `{0}'", GetSignatureForError ());
return false;
}
}
return true;
}
示例6: Error_FriendAccessNameNotMatching
static void Error_FriendAccessNameNotMatching (string other_name, Report Report)
{
Report.Error (281,
"Friend access was granted to `{0}', but the output assembly is named `{1}'. Try adding a reference to `{0}' or change the output assembly name to match it",
other_name, CodeGen.Assembly.Name.FullName);
}
示例7: AddUsingExternalAlias
public void AddUsingExternalAlias (string alias, Location loc, Report Report)
{
// TODO: Do this in parser
bool not_first = using_clauses != null || DeclarationFound;
if (using_aliases != null && !not_first) {
foreach (UsingAliasEntry uae in using_aliases) {
if (uae is LocalUsingAliasEntry) {
not_first = true;
break;
}
}
}
if (not_first)
Report.Error (439, loc, "An extern alias declaration must precede all other elements");
if (alias == "global") {
Error_GlobalNamespaceRedefined (loc, Report);
return;
}
AddUsingAlias (new UsingAliasEntry (alias, loc));
}
示例8: Error_NamespaceDoesNotExist
public override void Error_NamespaceDoesNotExist (Location loc, string name, Report Report)
{
Report.Error (400, loc, "The type or namespace name `{0}' could not be found in the global namespace (are you missing an assembly reference?)",
name);
}
示例9: ErrorDuplicateName
protected override void ErrorDuplicateName (Parameter p, Report Report)
{
Report.Error (833, p.Location, "`{0}': An anonymous type cannot have multiple properties with the same name",
p.Name);
}
示例10: Error_FinallyClause
public virtual void Error_FinallyClause (Report Report)
{
Report.Error (157, loc, "Control cannot leave the body of a finally clause");
}
示例11: Report_ObsoleteMessage
/// <summary>
/// Common method for Obsolete error/warning reporting.
/// </summary>
public static void Report_ObsoleteMessage (ObsoleteAttribute oa, string member, Location loc, Report Report)
{
if (oa.IsError) {
Report.Error (619, loc, "`{0}' is obsolete: `{1}'", member, oa.Message);
return;
}
if (oa.Message == null || oa.Message.Length == 0) {
Report.Warning (612, 1, loc, "`{0}' is obsolete", member);
return;
}
Report.Warning (618, 2, loc, "`{0}' is obsolete: `{1}'", member, oa.Message);
}
示例12: Save
static public void Save (string name, bool saveDebugInfo, Report Report)
{
PortableExecutableKinds pekind;
ImageFileMachine machine;
switch (RootContext.Platform) {
case Platform.X86:
pekind = PortableExecutableKinds.Required32Bit;
machine = ImageFileMachine.I386;
break;
case Platform.X64:
pekind = PortableExecutableKinds.PE32Plus;
machine = ImageFileMachine.AMD64;
break;
case Platform.IA64:
pekind = PortableExecutableKinds.PE32Plus;
machine = ImageFileMachine.IA64;
break;
case Platform.AnyCPU:
default:
pekind = PortableExecutableKinds.ILOnly;
machine = ImageFileMachine.I386;
break;
}
try {
Assembly.Builder.Save (Basename (name), pekind, machine);
}
catch (COMException) {
if ((RootContext.StrongNameKeyFile == null) || (!RootContext.StrongNameDelaySign))
throw;
// FIXME: it seems Microsoft AssemblyBuilder doesn't like to delay sign assemblies
Report.Error (1548, "Couldn't delay-sign the assembly with the '" +
RootContext.StrongNameKeyFile +
"', Use MCS with the Mono runtime or CSC to compile this assembly.");
}
catch (System.IO.IOException io) {
Report.Error (16, "Could not write to file `"+name+"', cause: " + io.Message);
return;
}
catch (System.UnauthorizedAccessException ua) {
Report.Error (16, "Could not write to file `"+name+"', cause: " + ua.Message);
return;
}
catch (System.NotImplementedException nie) {
Report.RuntimeMissingSupport (Location.Null, nie.Message);
return;
}
//
// Write debuger symbol file
//
if (saveDebugInfo)
SymbolWriter.WriteSymbolFile ();
}
示例13: Parse
public void Parse (SourceFile file, ModuleContainer module, ParserSession session, Report report)
{
Stream input;
try {
input = File.OpenRead (file.Name);
} catch {
report.Error (2001, "Source file `{0}' could not be found", file.Name);
return;
}
// Check 'MZ' header
if (input.ReadByte () == 77 && input.ReadByte () == 90) {
report.Error (2015, "Source file `{0}' is a binary file and not a text file", file.Name);
input.Close ();
return;
}
input.Position = 0;
SeekableStreamReader reader = new SeekableStreamReader (input, ctx.Settings.Encoding, session.StreamReaderBuffer);
Parse (reader, file, module, session, report);
if (ctx.Settings.GenerateDebugInfo && report.Errors == 0 && !file.HasChecksum) {
input.Position = 0;
var checksum = session.GetChecksumAlgorithm ();
file.SetChecksum (checksum.ComputeHash (input));
}
reader.Dispose ();
input.Close ();
}
示例14: Error_InvalidModifier
static void Error_InvalidModifier (Modifiers mod, Location l, Report Report)
{
Report.Error (106, l, "The modifier `{0}' is not valid for this item",
Name (mod));
}
示例15: VerifyPendingMethods
/// <summary>
/// Verifies that any pending abstract methods or interface methods
/// were implemented.
/// </summary>
public bool VerifyPendingMethods(Report Report)
{
int top = pending_implementations.Length;
bool errors = false;
int i;
for (i = 0; i < top; i++){
TypeSpec type = pending_implementations [i].type;
int j = 0;
bool base_implements_type = type.IsInterface &&
container.BaseType != null &&
container.BaseType.ImplementsInterface (type);
foreach (var mi in pending_implementations [i].methods){
if (mi == null)
continue;
if (type.IsInterface){
var need_proxy =
pending_implementations [i].need_proxy [j];
if (need_proxy != null) {
DefineProxy (type, need_proxy, mi);
continue;
}
if (pending_implementations [i].optional)
continue;
MethodSpec candidate = null;
if (base_implements_type || BaseImplements (type, mi, out candidate))
continue;
if (candidate == null) {
MethodData md = pending_implementations [i].found [j];
if (md != null)
candidate = md.method.Spec;
}
Report.SymbolRelatedToPreviousError (mi);
if (candidate != null) {
Report.SymbolRelatedToPreviousError (candidate);
if (candidate.IsStatic) {
Report.Error (736, container.Location,
"`{0}' does not implement interface member `{1}' and the best implementing candidate `{2}' is static",
container.GetSignatureForError (), mi.GetSignatureForError (), TypeManager.CSharpSignature (candidate));
} else if ((candidate.Modifiers & Modifiers.PUBLIC) == 0) {
Report.Error (737, container.Location,
"`{0}' does not implement interface member `{1}' and the best implementing candidate `{2}' in not public",
container.GetSignatureForError (), mi.GetSignatureForError (), candidate.GetSignatureForError ());
} else {
Report.Error (738, container.Location,
"`{0}' does not implement interface member `{1}' and the best implementing candidate `{2}' return type `{3}' does not match interface member return type `{4}'",
container.GetSignatureForError (), mi.GetSignatureForError (), TypeManager.CSharpSignature (candidate),
TypeManager.CSharpName (candidate.ReturnType), TypeManager.CSharpName (mi.ReturnType));
}
} else {
Report.Error (535, container.Location, "`{0}' does not implement interface member `{1}'",
container.GetSignatureForError (), mi.GetSignatureForError ());
}
} else {
Report.SymbolRelatedToPreviousError (mi);
Report.Error (534, container.Location, "`{0}' does not implement inherited abstract member `{1}'",
container.GetSignatureForError (), mi.GetSignatureForError ());
}
errors = true;
j++;
}
}
return errors;
}