暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.IO;
  3. using Mono.Cecil;
  4. using Mono.Cecil.Cil;
  5. using Unity.CompilationPipeline.Common.Diagnostics;
  6. namespace Unity.Jobs.CodeGen
  7. {
  8. static class InternalCompilerError
  9. {
  10. public static DiagnosticMessage DCICE300(TypeReference producerReference, TypeReference jobStructType, Exception ex)
  11. {
  12. 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}");
  13. }
  14. }
  15. static class UserError
  16. {
  17. public static DiagnosticMessage DC3001(TypeReference type)
  18. {
  19. return MakeError(nameof(DC3001), $"{type.FullName}: [RegisterGenericJobType] requires an instance of a generic value type");
  20. }
  21. static DiagnosticMessage MakeInternal(DiagnosticType type, string errorCode, string messageData)
  22. {
  23. var result = new DiagnosticMessage {Column = 0, Line = 0, DiagnosticType = type, File = ""};
  24. if (errorCode.Contains("ICE"))
  25. {
  26. 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";
  27. }
  28. var errorType = type == DiagnosticType.Error ? "error" : "warning";
  29. messageData = $"{errorType} {errorCode}: {messageData}";
  30. result.MessageData = messageData;
  31. return result;
  32. }
  33. public static DiagnosticMessage MakeError(string errorCode, string messageData)
  34. {
  35. return MakeInternal(DiagnosticType.Error, errorCode, messageData);
  36. }
  37. }
  38. }