Browse Source

bugfix for Context.defined

Nicolas Cannasse 14 years ago
parent
commit
e94ace3e79
2 changed files with 3 additions and 1 deletions
  1. 2 1
      interp.ml
  2. 1 0
      typer.ml

+ 2 - 1
interp.ml

@@ -87,6 +87,7 @@ type locals = (string, value ref) PMap.t
 
 type extern_api = {
 	pos : Ast.pos;
+	defined : string -> bool;
 	get_type : string -> Type.t option;
 	get_module : string -> Type.t list;
 	on_generate : (Type.t list -> unit) -> unit;
@@ -1559,7 +1560,7 @@ let macro_lib =
 		);
 		"defined", Fun1 (fun s ->
 			match s with
-			| VString s -> VBool (Common.defined (get_ctx()).com s)
+			| VString s -> VBool ((get_ctx()).curapi.defined s)
 			| _ -> error();
 		);
 		"get_type", Fun1 (fun s ->

+ 1 - 0
typer.ml

@@ -1900,6 +1900,7 @@ let make_macro_api ctx p =
 	in
 	{
 		Interp.pos = p;
+		Interp.defined = Common.defined ctx.com;
 		Interp.get_type = (fun s ->
 			let path = parse_path s in
 			try