ソースを参照

remove define-in-module code for define_type

I don't know why this was here but it doesn't make any sense to use defineType on an existing module. That's what defineModule is for.
Simon Krajewski 10 年 前
コミット
c4ed12aa18
1 ファイル変更1 行追加11 行削除
  1. 1 11
      typer.ml

+ 1 - 11
typer.ml

@@ -4644,19 +4644,9 @@ let make_macro_api ctx p =
 		Interp.define_type = (fun v ->
 			let m, tdef, pos = (try Interp.decode_type_def v with Interp.Invalid_expr -> Interp.exc (Interp.VString "Invalid type definition")) in
 			let add ctx =
-				let prev = (try Some (Hashtbl.find ctx.g.modules m) with Not_found -> None) in
 				let mnew = Typeload.type_module ctx m ctx.m.curmod.m_extra.m_file [tdef,pos] pos in
-				add_dependency mnew ctx.m.curmod;
-				(* if we defined a type in an existing module, let's move the types here *)
-				(match prev with
-				| None ->
 					mnew.m_extra.m_kind <- MFake;
-				| Some mold ->
-					Hashtbl.replace ctx.g.modules mnew.m_path mold;
-					mold.m_types <- mold.m_types @ mnew.m_types;
-					mnew.m_extra.m_kind <- MSub;
-					add_dependency mold mnew;
-				);
+				add_dependency mnew ctx.m.curmod;
 			in
 			add ctx;
 			(* if we are adding a class which has a macro field, we also have to add it to the macro context (issue #1497) *)