A game about forced loneliness, made by TACStudios
1using System;
2using System.IO;
3using Mono.Cecil;
4using Mono.Cecil.Cil;
5using Unity.CompilationPipeline.Common.Diagnostics;
6
7namespace Unity.Jobs.CodeGen
8{
9 static class InternalCompilerError
10 {
11 public static DiagnosticMessage DCICE300(TypeReference producerReference, TypeReference jobStructType, Exception ex)
12 {
13 return UserError.MakeError(nameof(DCICE300), $"Unexpected error while generating automatic registration for job provider {producerReference.FullName} via job struct {jobStructType.FullName}. Please report this error.\nException: {ex.Message}");
14 }
15 }
16
17 static class UserError
18 {
19 public static DiagnosticMessage DC3001(TypeReference type)
20 {
21 return MakeError(nameof(DC3001), $"{type.FullName}: [RegisterGenericJobType] requires an instance of a generic value type");
22 }
23
24 static DiagnosticMessage MakeInternal(DiagnosticType type, string errorCode, string messageData)
25 {
26 var result = new DiagnosticMessage {Column = 0, Line = 0, DiagnosticType = type, File = ""};
27
28 if (errorCode.Contains("ICE"))
29 {
30 messageData = messageData + " Seeing this error indicates a bug in the DOTS Job code-generators. We'd appreciate a bug report (About->Report a Bug...). Thnx! <3";
31 }
32
33 var errorType = type == DiagnosticType.Error ? "error" : "warning";
34 messageData = $"{errorType} {errorCode}: {messageData}";
35
36 result.MessageData = messageData;
37
38 return result;
39 }
40
41 public static DiagnosticMessage MakeError(string errorCode, string messageData)
42 {
43 return MakeInternal(DiagnosticType.Error, errorCode, messageData);
44 }
45 }
46}