IfBlocks.hx 612 B

12345678910111213141516171819202122232425
  1. function throwInactive(flag:String) {
  2. throw '`$flag` block is not active';
  3. }
  4. function throwInactiveValue(flag:String, expected:String, value:String) {
  5. throw '`$flag` block is not active, as flag has value `$value` instead of `$expected`';
  6. }
  7. function main() {
  8. #if !f_dash
  9. throwInactive("f_dash");
  10. #end
  11. #if !f_underscore
  12. throwInactive("f_underscore");
  13. #end
  14. #if (v_dash!="value")
  15. throwInactiveValue("v_dash", "value", haxe.macro.Context.definedValue("v_dash"));
  16. #end
  17. #if (v_underscore!="value")
  18. throwInactiveValue("v_underscore", "value", haxe.macro.Context.definedValue("v_underscore"));
  19. #end
  20. }