GetDefines.hx 890 B

123456789101112131415161718192021222324252627
  1. function main() {
  2. final defines = haxe.macro.Context.getDefines();
  3. // -D f-dash
  4. if (!defines.exists("f-dash"))
  5. throw "`f-dash` flag is missing";
  6. if (!defines.exists("f_dash"))
  7. throw "`f_dash` flag is missing";
  8. // -D f_underscore
  9. if (!defines.exists("f-underscore"))
  10. throw "`f-underscore` flag is missing";
  11. if (!defines.exists("f_underscore"))
  12. throw "`f_underscore` flag is missing";
  13. // -D v-dash=value
  14. if (defines["v-dash"] != "value")
  15. throw "`v-dash` flag value is incorrect: " + defines["v-dash"];
  16. if (defines["v_dash"] != "value")
  17. throw "`v_dash` flag value is incorrect: " + defines["v_dash"];
  18. // -D v_underscore=value
  19. if (defines["v-underscore"] != "value")
  20. throw "`v-underscore` flag value is incorrect: " + defines["v-underscore"];
  21. if (defines["v_underscore"] != "value")
  22. throw "`v_underscore` flag value is incorrect: " + defines["v_underscore"];
  23. }