Init.hx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package hxtest;
  2. import haxe.macro.Compiler;
  3. import haxe.macro.PlatformConfig;
  4. class Init {
  5. // Default, except everything has been set to `true`.
  6. public static var intendedConfig: PlatformConfig = {
  7. supportsAtomics: true,
  8. thisBeforeSuper: true,
  9. scoping: {
  10. scope: BlockScope,
  11. flags: []
  12. },
  13. exceptions: {
  14. nativeThrows: [],
  15. avoidWrapping: true,
  16. baseThrow: {
  17. name: "Dynamic",
  18. pack: ["StdTypes"]
  19. },
  20. nativeCatches: [],
  21. wildcardCatch: {
  22. name: "Dynamic",
  23. pack: ["StdTypes"]
  24. }
  25. },
  26. supportsRestArgs: true,
  27. overloadFunctions: true,
  28. capturePolicy: None,
  29. staticTypeSystem: true,
  30. supportsUnicode: true,
  31. supportsFunctionEquality: true,
  32. reservedTypePaths: [],
  33. addFinalReturn: true,
  34. supportsThreads: true,
  35. sys: true,
  36. usesUtf16: true,
  37. padNulls: true
  38. }
  39. public static function init() {
  40. Sys.println("hxtest.Init.init()");
  41. haxe.macro.Compiler.setPlatformConfiguration(intendedConfig);
  42. // Check the config that was just set.
  43. final intended = Std.string(intendedConfig);
  44. final currentConfig = Std.string(Compiler.getConfiguration().platformConfig);
  45. Sys.println("[Init] Config correct: " + (intended == currentConfig));
  46. }
  47. }