Przeglądaj źródła

[std] add a note that Compiler.getDefine is a macro

Simon Krajewski 6 lat temu
rodzic
commit
2a2420ab31
1 zmienionych plików z 4 dodań i 1 usunięć
  1. 4 1
      std/haxe/macro/Compiler.hx

+ 4 - 1
std/haxe/macro/Compiler.hx

@@ -41,9 +41,12 @@ class Compiler {
 		If the compiler flag is not defined, `Compiler.getDefine` returns
 		If the compiler flag is not defined, `Compiler.getDefine` returns
 		`null`.
 		`null`.
 
 
+		Note: This is a macro and cannot be called from within other macros. Refer
+		to `haxe.macro.Context.definedValue` to obtain defined values in macro context.
+
 		@see https://haxe.org/manual/lf-condition-compilation.html
 		@see https://haxe.org/manual/lf-condition-compilation.html
 	**/
 	**/
-	macro static public function getDefine( key : String ) {
+	macro /* <-- ! */ static public function getDefine( key : String ) {
 		return macro $v{haxe.macro.Context.definedValue(key)};
 		return macro $v{haxe.macro.Context.definedValue(key)};
 	}
 	}