2
0
Эх сурвалжийг харах

add __LOC__ to "die" calls for exact failure positions even if "die" is inlined

Aleksandr Kuzmenko 5 жил өмнө
parent
commit
d5487c452c
100 өөрчлөгдсөн 819 нэмэгдсэн , 818 устгасан
  1. 2 2
      src-prebuild/prebuild.ml
  2. 8 8
      src/codegen/codegen.ml
  3. 2 2
      src/codegen/dotnet.ml
  4. 1 1
      src/codegen/gencommon/arrayDeclSynf.ml
  5. 11 11
      src/codegen/gencommon/castDetect.ml
  6. 11 11
      src/codegen/gencommon/closuresToClass.ml
  7. 4 4
      src/codegen/gencommon/dynamicFieldAccess.ml
  8. 4 4
      src/codegen/gencommon/dynamicOperators.ml
  9. 1 1
      src/codegen/gencommon/enumToClass.ml
  10. 1 1
      src/codegen/gencommon/enumToClass2.ml
  11. 8 8
      src/codegen/gencommon/expressionUnwrap.ml
  12. 3 3
      src/codegen/gencommon/fixOverrides.ml
  13. 15 15
      src/codegen/gencommon/gencommon.ml
  14. 1 1
      src/codegen/gencommon/hardNullableSynf.ml
  15. 3 3
      src/codegen/gencommon/initFunction.ml
  16. 1 1
      src/codegen/gencommon/objectDeclMap.ml
  17. 4 4
      src/codegen/gencommon/overloadingConstructor.ml
  18. 8 8
      src/codegen/gencommon/realTypeParams.ml
  19. 3 3
      src/codegen/gencommon/reflectionCFs.ml
  20. 1 1
      src/codegen/gencommon/renameTypeParameters.ml
  21. 1 1
      src/codegen/gencommon/switchToIf.ml
  22. 7 7
      src/codegen/java.ml
  23. 3 3
      src/codegen/overloads.ml
  24. 9 9
      src/codegen/swfLoader.ml
  25. 3 3
      src/compiler/displayOutput.ml
  26. 9 9
      src/compiler/haxe.ml
  27. 4 4
      src/context/abstractCast.ml
  28. 7 7
      src/context/common.ml
  29. 1 1
      src/context/compilationServer.ml
  30. 2 2
      src/context/display/displayException.ml
  31. 1 1
      src/context/display/displayJson.ml
  32. 1 1
      src/context/display/displayPath.ml
  33. 1 1
      src/context/display/displayToplevel.ml
  34. 1 1
      src/context/display/importHandling.ml
  35. 2 2
      src/context/sourcemaps.ml
  36. 6 6
      src/context/typecore.ml
  37. 1 1
      src/core/ast.ml
  38. 2 2
      src/core/display/completionItem.ml
  39. 1 1
      src/core/error.ml
  40. 3 2
      src/core/globals.ml
  41. 1 1
      src/core/json/genjson.ml
  42. 1 1
      src/core/meta.ml
  43. 3 3
      src/core/path.ml
  44. 7 7
      src/core/tFunctions.ml
  45. 4 4
      src/core/tOther.ml
  46. 1 1
      src/core/tPrinting.ml
  47. 2 2
      src/core/tUnification.ml
  48. 2 2
      src/core/texpr.ml
  49. 3 3
      src/core/timer.ml
  50. 2 2
      src/filters/ES6Ctors.ml
  51. 2 2
      src/filters/capturedVars.ml
  52. 2 2
      src/filters/defaultArguments.ml
  53. 2 2
      src/filters/exceptions.ml
  54. 2 2
      src/filters/filters.ml
  55. 1 1
      src/filters/renameVars.ml
  56. 1 1
      src/filters/tre.ml
  57. 15 15
      src/generators/gencpp.ml
  58. 38 38
      src/generators/gencs.ml
  59. 75 75
      src/generators/genhl.ml
  60. 1 1
      src/generators/genhxold.ml
  61. 31 31
      src/generators/genjava.ml
  62. 6 6
      src/generators/genjs.ml
  63. 30 30
      src/generators/genjvm.ml
  64. 10 10
      src/generators/genlua.ml
  65. 8 8
      src/generators/genneko.ml
  66. 51 51
      src/generators/genphp7.ml
  67. 29 29
      src/generators/genpy.ml
  68. 7 7
      src/generators/genshared.ml
  69. 25 25
      src/generators/genswf9.ml
  70. 24 24
      src/generators/hl2c.ml
  71. 1 1
      src/generators/hlcode.ml
  72. 167 167
      src/generators/hlinterp.ml
  73. 8 8
      src/generators/hlopt.ml
  74. 3 3
      src/generators/jvm/jvmCode.ml
  75. 1 1
      src/generators/jvm/jvmFunctions.ml
  76. 17 17
      src/generators/jvm/jvmMethod.ml
  77. 1 1
      src/generators/jvm/jvmVerificationTypeInfo.ml
  78. 1 1
      src/macro/eval/evalContext.ml
  79. 3 3
      src/macro/eval/evalDebugMisc.ml
  80. 1 1
      src/macro/eval/evalDebugSocket.ml
  81. 1 1
      src/macro/eval/evalEmitter.ml
  82. 1 1
      src/macro/eval/evalExceptions.ml
  83. 11 11
      src/macro/eval/evalJit.ml
  84. 3 3
      src/macro/eval/evalJitContext.ml
  85. 7 7
      src/macro/eval/evalMain.ml
  86. 1 1
      src/macro/eval/evalMisc.ml
  87. 1 1
      src/macro/eval/evalPrinting.ml
  88. 1 1
      src/macro/eval/evalPrototype.ml
  89. 16 16
      src/macro/eval/evalStdLib.ml
  90. 1 1
      src/macro/eval/evalString.ml
  91. 3 3
      src/macro/macroApi.ml
  92. 4 4
      src/optimization/analyzer.ml
  93. 1 1
      src/optimization/analyzerTexpr.ml
  94. 8 8
      src/optimization/analyzerTexprTransformer.ml
  95. 3 3
      src/optimization/analyzerTypes.ml
  96. 4 4
      src/optimization/inline.ml
  97. 1 1
      src/optimization/inlineConstructors.ml
  98. 2 2
      src/optimization/optimizer.ml
  99. 2 2
      src/optimization/optimizerTexpr.ml
  100. 2 2
      src/syntax/grammar.mly

+ 2 - 2
src-prebuild/prebuild.ml

@@ -205,7 +205,7 @@ match Array.to_list (Sys.argv) with
 		Printf.printf "\n\t| Last\n\n"; (* must be last *)
 		Printf.printf "let infos = function\n";
 		Printf.printf "%s" (gen_define_info defines);
-		Printf.printf "\n\t| Last -> die \"\"\n"
+		Printf.printf "\n\t| Last -> die \"\" __LOC__\n"
 	| [_; "meta"; meta_path]->
 		let metas = parse_file_array meta_path parse_meta in
 		Printf.printf "%s" meta_header;
@@ -214,7 +214,7 @@ match Array.to_list (Sys.argv) with
 		Printf.printf "\n\t| Last\n\t| Dollar of string\n\t| Custom of string\n\n";
 		Printf.printf "let get_info = function\n";
 		Printf.printf "%s" (gen_meta_info metas);
-		Printf.printf "\n\t| Last -> die \"\"\n\t| Dollar s -> \"$\" ^ s,(\"\",[])\n\t| Custom s -> s,(\"\",[])\n"
+		Printf.printf "\n\t| Last -> die \"\" __LOC__\n\t| Dollar s -> \"$\" ^ s,(\"\",[])\n\t| Custom s -> s,(\"\",[])\n"
 	| _ :: "libparams" :: params ->
 		Printf.printf "(%s)" (String.concat " " (List.map (fun s -> Printf.sprintf "\"%s\"" s) params))
 	| [_ ;"version";add_revision;branch;sha] ->

+ 8 - 8
src/codegen/codegen.ml

@@ -154,7 +154,7 @@ let fix_override com c f fd =
 	let f2 = (try Some (find_field com c f) with Not_found -> None) in
 	match f2,fd with
 		| Some (f2), Some(fd) ->
-			let targs, tret = (match follow f2.cf_type with TFun (args,ret) -> args, ret | _ -> die "") in
+			let targs, tret = (match follow f2.cf_type with TFun (args,ret) -> args, ret | _ -> die "" __LOC__) in
 			let changed_args = ref [] in
 			let prefix = "_tmp_" in
 			let nargs = List.map2 (fun ((v,ct) as cur) (_,_,t2) ->
@@ -190,11 +190,11 @@ let fix_override com c f fd =
 				);
 			} in
 			let targs = List.map (fun(v,c) -> (v.v_name, Option.is_some c, v.v_type)) nargs in
-			let fde = (match f.cf_expr with None -> die "" | Some e -> e) in
+			let fde = (match f.cf_expr with None -> die "" __LOC__ | Some e -> e) in
 			f.cf_expr <- Some { fde with eexpr = TFunction fd2 };
 			f.cf_type <- TFun(targs,tret);
 		| Some(f2), None when c.cl_interface ->
-			let targs, tret = (match follow f2.cf_type with TFun (args,ret) -> args, ret | _ -> die "") in
+			let targs, tret = (match follow f2.cf_type with TFun (args,ret) -> args, ret | _ -> die "" __LOC__) in
 			f.cf_type <- TFun(targs,tret)
 		| _ ->
 			()
@@ -455,18 +455,18 @@ let default_cast ?(vtmp="$t") com e texpr t p =
 		| TClassDecl c -> mk_anon (ref (Statics c))
 		| TEnumDecl e -> mk_anon (ref (EnumStatics e))
 		| TAbstractDecl a -> mk_anon (ref (AbstractStatics a))
-		| TTypeDecl _ -> die ""
+		| TTypeDecl _ -> die "" __LOC__
 	in
 	let vtmp = alloc_var VGenerated vtmp e.etype e.epos in
 	let var = mk (TVar (vtmp,Some e)) api.tvoid p in
 	let vexpr = mk (TLocal vtmp) e.etype p in
 	let texpr = mk (TTypeExpr texpr) (mk_texpr texpr) p in
-	let std = (try List.find (fun t -> t_path t = ([],"Std")) com.types with Not_found -> die "") in
+	let std = (try List.find (fun t -> t_path t = ([],"Std")) com.types with Not_found -> die "" __LOC__) in
 	let fis = (try
-			let c = (match std with TClassDecl c -> c | _ -> die "") in
+			let c = (match std with TClassDecl c -> c | _ -> die "" __LOC__) in
 			FStatic (c, PMap.find "isOfType" c.cl_statics)
 		with Not_found ->
-			die ""
+			die "" __LOC__
 	) in
 	let std = mk (TTypeExpr std) (mk_texpr std) p in
 	let is = mk (TField (std,fis)) (tfun [t_dynamic;t_dynamic] api.tbool) p in
@@ -509,7 +509,7 @@ module UnificationCallback = struct
 		in
 		let check e = match e.eexpr with
 			| TBinop((OpAssign | OpAssignOp _),e1,e2) ->
-				die ""; (* this trigger #4347, to be fixed before enabling
+				die "" __LOC__; (* this trigger #4347, to be fixed before enabling
 				let e2 = f e2 e1.etype in
 				{e with eexpr = TBinop(op,e1,e2)} *)
 			| TVar(v,Some ev) ->

+ 2 - 2
src/codegen/dotnet.ml

@@ -577,12 +577,12 @@ let convert_ilprop ctx p prop is_explicit_impl =
 		cff_kind = kind;
 	}
 
-let get_type_path ctx ct = match ct with | CTPath p -> p | _ -> die ""
+let get_type_path ctx ct = match ct with | CTPath p -> p | _ -> die "" __LOC__
 
 let is_explicit ctx ilcls i =
 	let s = match i with
 		| LClass(path,_) | LValueType(path,_) -> ilpath_s path
-		| _ -> die ""
+		| _ -> die "" __LOC__
 	in
 	let len = String.length s in
 	List.exists (fun m ->

+ 1 - 1
src/codegen/gencommon/arrayDeclSynf.ml

@@ -33,7 +33,7 @@ let init (native_array_cl : tclass) (change_type_params : module_type -> t list
 			let cl, params = match follow e.etype with
 				| TInst(({ cl_path = ([], "Array") } as cl), ( _ :: _  as params)) -> cl, params
 				| TInst(({ cl_path = ([], "Array") } as cl), []) -> cl, [t_dynamic]
-				| _ -> Globals.die ""
+				| _ -> Globals.die "" __LOC__
 			in
 			let params = change_type_params (TClassDecl cl) params in
 			let e_inner_decl = mk (TArrayDecl (List.map run el)) (TInst (native_array_cl, params)) e.epos in

+ 11 - 11
src/codegen/gencommon/castDetect.ml

@@ -86,7 +86,7 @@ struct
 			match e.eexpr with
 			| TReturn (eopt) ->
 				(* a return must be inside a function *)
-				let ret_type = match !current_ret_type with | Some(s) -> s | None -> gen.gcon.error "Invalid return outside function declaration." e.epos; die "" in
+				let ret_type = match !current_ret_type with | Some(s) -> s | None -> gen.gcon.error "Invalid return outside function declaration." e.epos; die "" __LOC__ in
 				(match eopt with
 				| None when not (ExtType.is_void ret_type) ->
 					Texpr.Builder.mk_return (null ret_type e.epos)
@@ -428,7 +428,7 @@ let rec handle_cast gen e real_to_t real_from_t =
 			in
 			let tclass = match get_type gen ([],"Class") with
 			| TAbstractDecl(a) -> a
-			| _ -> die "" in
+			| _ -> die "" __LOC__ in
 			handle_cast gen e real_to_t (gen.greal_type (TAbstract(tclass, [p2])))
 		with | Not_found ->
 			mk_cast false to_t e)
@@ -570,13 +570,13 @@ let select_overload gen applied_f overloads types params =
 						cf,t,true (* no compatible overload was found *)
 					else
 						check_overload overloads
-			| [] -> die ""
+			| [] -> die "" __LOC__
 		in
 		check_overload overloads
 	| _ -> match overloads with  (* issue #1742 *)
 	| (t,cf) :: [] -> cf,t,true
 	| (t,cf) :: _ -> cf,t,false
-	| _ -> die ""
+	| _ -> die "" __LOC__
 
 let rec cur_ctor c tl =
 	match c.cl_constructor with
@@ -890,7 +890,7 @@ let handle_type_parameter gen e e1 ef ~clean_ef ~overloads_cast_to_base f elist
 	| FClassField (cl,params,_,cf,_,actual_t,_) ->
 		return_var (handle_cast gen { e1 with eexpr = TField({ ef with etype = t_dynamic }, f) } e1.etype t_dynamic) (* force dynamic and cast back to needed type *)
 	| FEnumField (en, efield, true) ->
-		let ecall = match e with | None -> trace (field_name f); trace efield.ef_name; gen.gcon.error "This field should be called immediately" ef.epos; die "" | Some ecall -> ecall in
+		let ecall = match e with | None -> trace (field_name f); trace efield.ef_name; gen.gcon.error "This field should be called immediately" ef.epos; die "" __LOC__ | Some ecall -> ecall in
 		(match en.e_params with
 			(*
 			| [] ->
@@ -900,7 +900,7 @@ let handle_type_parameter gen e e1 ef ~clean_ef ~overloads_cast_to_base f elist
 		*)
 			| _ ->
 				let pt = match e with | None -> real_type | Some _ -> snd (get_fun e1.etype) in
-				let _params = match follow pt with | TEnum(_, p) -> p | _ -> gen.gcon.warning (debug_expr e1) e1.epos; die "" in
+				let _params = match follow pt with | TEnum(_, p) -> p | _ -> gen.gcon.warning (debug_expr e1) e1.epos; die "" __LOC__ in
 				let args, ret = get_fun efield.ef_type in
 				let actual_t = TFun(List.map (fun (n,o,t) -> (n,o,gen.greal_type t)) args, gen.greal_type ret) in
 				(*
@@ -919,7 +919,7 @@ let handle_type_parameter gen e e1 ef ~clean_ef ~overloads_cast_to_base f elist
 
 				handle_cast gen new_ecall (gen.greal_type ecall.etype) (gen.greal_type ret)
 		)
-	| FEnumField _ when is_some e -> die ""
+	| FEnumField _ when is_some e -> die "" __LOC__
 	| FEnumField (en,efield,_) ->
 			return_var { e1 with eexpr = TField({ ef with eexpr = TTypeExpr( TEnumDecl en ); },FEnum(en,efield)) }
 	(* no target by date will uses this.so this code may not be correct at all *)
@@ -1051,7 +1051,7 @@ let configure gen ?(overloads_cast_to_base = false) maybe_empty_t calls_paramete
 					| TInt _ -> gen.gcon.basic.tint
 					| TFloat _ -> gen.gcon.basic.tfloat
 					| TBool _ -> gen.gcon.basic.tbool
-					| _ -> die ""
+					| _ -> die "" __LOC__
 				in
 				handle e t real_t
 			| TCast( { eexpr = TConst TNull }, _ ) ->
@@ -1088,7 +1088,7 @@ let configure gen ?(overloads_cast_to_base = false) maybe_empty_t calls_paramete
 						(match gen.gcurrent_class with
 							| Some cl -> print_endline (s_type_path cl.cl_path)
 							| _ -> ());
-						die ""
+						die "" __LOC__
 				in
 				let base_type = List.hd base_type in
 				{ e with eexpr = TArrayDecl( List.map (fun e -> handle (run e) base_type e.etype) el ); etype = et }
@@ -1096,7 +1096,7 @@ let configure gen ?(overloads_cast_to_base = false) maybe_empty_t calls_paramete
 				let et = e.etype in
 				let base_type = match follow et with
 					| TInst(cl, bt) -> gen.greal_type_param (TClassDecl cl) bt
-					| _ -> die ""
+					| _ -> die "" __LOC__
 				in
 				let base_type = List.hd base_type in
 				{ e with eexpr = TCall(arr_local, List.map (fun e -> handle (run e) base_type e.etype) el ); etype = et }
@@ -1109,7 +1109,7 @@ let configure gen ?(overloads_cast_to_base = false) maybe_empty_t calls_paramete
 				let cl, tparams = match follow ef.etype with
 				| TInst(cl,p) ->
 					cl,p
-				| _ -> die "" in
+				| _ -> die "" __LOC__ in
 				(try
 					let is_overload, cf, sup, stl = choose_ctor gen cl tparams (List.map (fun e -> e.etype) eparams) maybe_empty_t e.epos in
 					let handle e t1 t2 =

+ 11 - 11
src/codegen/gencommon/closuresToClass.ml

@@ -200,7 +200,7 @@ let traverse gen ?tparam_anon_decl ?tparam_anon_acc (handle_anon_func:texpr->tfu
 					)
 			| TBinop(OpAssign, { eexpr = TLocal({ v_extra = Some(_ :: _, _) } as v)}, ({ eexpr= TFunction tf } as f)) when is_some tparam_anon_decl ->
 				(match tparam_anon_decl with
-					| None -> die ""
+					| None -> die "" __LOC__
 					| Some tparam_anon_decl ->
 						tparam_anon_decl v f { tf with tf_expr = run tf.tf_expr };
 						{ e with eexpr = TBlock([]) }
@@ -291,7 +291,7 @@ let rec get_type_params acc t =
 			PMap.fold (fun cf acc ->
 				let params = List.map (fun (_,t) -> match follow t with
 					| TInst(c,_) -> c
-					| _ -> die "") cf.cf_params
+					| _ -> die "" __LOC__) cf.cf_params
 				in
 				List.filter (fun t -> not (List.memq t params)) (get_type_params acc cf.cf_type)
 			) a.a_fields acc
@@ -392,7 +392,7 @@ let configure gen ft =
 		let captured = List.sort (fun e1 e2 -> match e1, e2 with
 			| { eexpr = TLocal v1 }, { eexpr = TLocal v2 } ->
 				compare v1.v_name v2.v_name
-			| _ -> die "") captured
+			| _ -> die "" __LOC__) captured
 		in
 
 		(*let cltypes = List.map (fun cl -> (snd cl.cl_path, TInst(map_param cl, []) )) tparams in*)
@@ -448,7 +448,7 @@ let configure gen ft =
 
 					let ctor_v = alloc_var v.v_name v.v_type in
 					((ctor_v, None) :: ctor_args, (v.v_name, false, v.v_type) :: ctor_sig, (mk_this_assign v cls.cl_pos) :: ctor_exprs)
-				| _ -> die ""
+				| _ -> die "" __LOC__
 		) ([],[],[]) captured in
 
 		(* change all captured variables to this.capturedVariable *)
@@ -593,11 +593,11 @@ let configure gen ft =
 			let captured = List.sort (fun e1 e2 -> match e1, e2 with
 				| { eexpr = TLocal v1 }, { eexpr = TLocal v2 } ->
 					compare v1.v_name v2.v_name
-				| _ -> die "") captured
+				| _ -> die "" __LOC__) captured
 			in
 			let types = match v.v_extra with
 				| Some(t,_) -> t
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			in
 			let monos = List.map (fun _ -> mk_mono()) types in
 			let vt = match follow v.v_type with
@@ -741,7 +741,7 @@ struct
 			in
 
 			if arity >= max_arity then begin
-				let varray = match changed_args with | [v,_] -> v | _ -> die "" in
+				let varray = match changed_args with | [v,_] -> v | _ -> die "" __LOC__ in
 				let varray_local = mk_local varray pos in
 				let mk_varray i = { eexpr = TArray(varray_local, make_int gen.gcon.basic i pos); etype = t_dynamic; epos = pos } in
 				let el =
@@ -773,7 +773,7 @@ struct
 									epos = pos
 								} )); etype = basic.tvoid; epos = pos } :: acc in
 							loop acc args fargs dargs
-						| _ -> die ""
+						| _ -> die "" __LOC__
 				in
 
 				loop [] args float_args dyn_args
@@ -797,7 +797,7 @@ struct
 					let ret_t = if is_dynamic_func then t_dynamic else ret_t in
 
 					(TFun(args_real_to_func_sig _sig, ret_t), arity, type_n, ret_t, ExtType.is_void ret, is_dynamic_func)
-				| _ -> (print_endline (s_type (print_context()) (follow old_sig) )); die ""
+				| _ -> (print_endline (s_type (print_context()) (follow old_sig) )); die "" __LOC__
 			in
 
 			let tf_expr = if is_void then begin
@@ -810,7 +810,7 @@ struct
 				let e = mk_block (map tfunc.tf_expr) in
 				match e.eexpr with
 					| TBlock bl -> { e with eexpr = TBlock (bl @ [mk_return (null t_dynamic e.epos)]) }
-					| _ -> die ""
+					| _ -> die "" __LOC__
 			end else tfunc.tf_expr in
 
 			let changed_sig_ret = if is_dynamic_func then t_dynamic else changed_sig_ret in
@@ -854,7 +854,7 @@ struct
 		let dynamic_fun_call call_expr =
 			let tc, params = match call_expr.eexpr with
 				| TCall(tc, params) -> tc, params
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			in
 			let ct = gen.greal_type call_expr.etype in
 			let postfix, ret_t =

+ 4 - 4
src/codegen/gencommon/dynamicFieldAccess.ml

@@ -71,7 +71,7 @@ let configure gen (is_dynamic:texpr->Type.tfield_access->bool) (change_expr:texp
 				| TInst( ({ cl_kind = KTypeParameter(tl) } as tp_cl), tp_tl) ->
 					let t = apply_params tp_cl.cl_params tp_tl (List.find (fun t -> not (is_dynamic { fexpr with etype = t } f)) tl) in
 					{ e with eexpr = TField(mk_cast t (run fexpr), f) }
-				| _ -> Globals.die "")
+				| _ -> Globals.die "" __LOC__)
 
 		| TField(fexpr, f) when is_some (anon_class fexpr.etype) ->
 			let decl = get (anon_class fexpr.etype) in
@@ -86,7 +86,7 @@ let configure gen (is_dynamic:texpr->Type.tfield_access->bool) (change_expr:texp
 					{ e with eexpr = TField ({ fexpr with eexpr = TTypeExpr decl }, FEnum (en, ef)) }
 				| TAbstractDecl _ (* abstracts don't have TFields *)
 				| TTypeDecl _ -> (* anon_class doesn't return TTypeDecl *)
-					Globals.die ""
+					Globals.die "" __LOC__
 			with Not_found ->
 				match f with
 				| FStatic (cl, cf) when has_class_field_flag cf CfExtern ->
@@ -118,10 +118,10 @@ let configure gen (is_dynamic:texpr->Type.tfield_access->bool) (change_expr:texp
 				Type.map_expr run e)
 
 		| TBinop (OpAssignOp _, { eexpr = TField (fexpr, f) }, _) when is_dynamic fexpr f ->
-			Globals.die "" (* this case shouldn't happen *)
+			Globals.die "" __LOC__ (* this case shouldn't happen *)
 		| TUnop (Increment, _, { eexpr = TField (({ eexpr = TLocal _ } as fexpr), f)})
 		| TUnop (Decrement, _, { eexpr = TField (({ eexpr = TLocal _ } as fexpr), f)}) when is_dynamic fexpr f ->
-			Globals.die "" (* this case shouldn't happen *)
+			Globals.die "" __LOC__ (* this case shouldn't happen *)
 
 		| TCall ({ eexpr = TField (fexpr, f) }, params) when is_dynamic fexpr f && (not (is_nondynamic_tparam fexpr f)) ->
 			call_expr e (run fexpr) (field_name f) (List.map run params)

+ 4 - 4
src/codegen/gencommon/dynamicOperators.ml

@@ -89,11 +89,11 @@ let init com handle_strings (should_change:texpr->bool) (equals_handler:texpr->t
 							(mk (TVar (v, Some (run e1a))) com.basic.tvoid e1.epos);
 							(mk (TVar (v2, Some (run e2a))) com.basic.tvoid e1.epos)
 						]
-					| _ -> Globals.die ""
+					| _ -> Globals.die "" __LOC__
 				in
 				{ e with eexpr = TBlock (rest @ [{ e with eexpr = TBinop (OpAssign, eleft, run { e with eexpr = TBinop (op, eleft, e2) }) }]) }
 			| _ ->
-				Globals.die "")
+				Globals.die "" __LOC__)
 
 		| TBinop (OpAssign, e1, e2)
 		| TBinop (OpInterval, e1, e2) ->
@@ -120,7 +120,7 @@ let init com handle_strings (should_change:texpr->bool) (equals_handler:texpr->t
 			| OpAnd | OpOr | OpXor | OpShl | OpShr | OpUShr ->
 				{ e with eexpr = TBinop (op, mk_cast com.basic.tint (run e1), mk_cast com.basic.tint (run e2)) }
 			| OpAssign | OpAssignOp _ | OpInterval | OpArrow | OpIn ->
-				Globals.die "")
+				Globals.die "" __LOC__)
 
 		| TUnop (Increment as op, flag, e1)
 		| TUnop (Decrement as op, flag, e1) when should_change e ->
@@ -137,7 +137,7 @@ let init com handle_strings (should_change:texpr->bool) (equals_handler:texpr->t
 			*)
 			let one = get_etype_one e in
 			let etype = one.etype in
-			let op = (match op with Increment -> OpAdd | Decrement -> OpSub | _ -> Globals.die "") in
+			let op = (match op with Increment -> OpAdd | Decrement -> OpSub | _ -> Globals.die "" __LOC__) in
 
 			let block =
 				let vars, getvar =

+ 1 - 1
src/codegen/gencommon/enumToClass.ml

@@ -154,7 +154,7 @@ struct
 				| _ ->
 					let actual_t = match follow ef.ef_type with
 						| TEnum(e, p) -> TEnum(e, List.map (fun _ -> t_dynamic) p)
-						| _ -> die ""
+						| _ -> die "" __LOC__
 					in
 					let cf = mk_class_field name actual_t true pos (Var { v_read = AccNormal; v_write = AccNever }) [] in
 					let args = if has_params then

+ 1 - 1
src/codegen/gencommon/enumToClass2.ml

@@ -379,7 +379,7 @@ module EnumToClass2Exprf = struct
 				| TFun (params, _) ->
 					let fname, _, _ = List.nth params i in
 					field ecast fname e.etype e.epos
-				| _ -> Globals.die "")
+				| _ -> Globals.die "" __LOC__)
 			| _ ->
 				Type.map_expr run e
 		in

+ 8 - 8
src/codegen/gencommon/expressionUnwrap.ml

@@ -157,7 +157,7 @@ let rec expr_stat_map fn (expr:texpr) =
 		| TBinop ( (OpAssign as op), left_e, right_e )
 		| TBinop ( (OpAssignOp _ as op), left_e, right_e ) ->
 			{ expr with eexpr = TBinop(op, fn left_e, fn right_e) }
-		| TParenthesis _ -> Globals.die ""
+		| TParenthesis _ -> Globals.die "" __LOC__
 		| TCall(left_e, params) ->
 			{ expr with eexpr = TCall(fn left_e, List.map fn params) }
 		| TNew(cl, tparams, params) ->
@@ -184,7 +184,7 @@ let rec expr_stat_map fn (expr:texpr) =
 		| TBlock _ -> expr (* there is no expected expression here. Only statements *)
 		| TMeta(m,e) ->
 			{ expr with eexpr = TMeta(m,expr_stat_map fn e) }
-		| _ -> Globals.die "" (* we only expect valid statements here. other expressions aren't valid statements *)
+		| _ -> Globals.die "" __LOC__ (* we only expect valid statements here. other expressions aren't valid statements *)
 
 let is_expr = function | Expression _ -> true | _ -> false
 
@@ -293,7 +293,7 @@ and expr_kind expr =
 			aggregate true (List.map snd sel)
 		| TCast (e,_) ->
 			aggregate false [e]
-		| _ -> trace (debug_expr expr); Globals.die "" (* should have been read as Statement by shallow_expr_type *)
+		| _ -> trace (debug_expr expr); Globals.die "" __LOC__ (* should have been read as Statement by shallow_expr_type *)
 
 let get_kinds (statement:texpr) =
 	let kinds = ref [] in
@@ -381,7 +381,7 @@ let rec apply_assign assign_fun right =
 			match follow right.etype with
 				| TAbstract ({ a_path = ([], "Void") },[]) ->
 					right
-				| _ -> trace (debug_expr right); Globals.die "" (* a statement is required *)
+				| _ -> trace (debug_expr right); Globals.die "" __LOC__ (* a statement is required *)
 
 let short_circuit_op_unwrap com add_statement expr :texpr =
 	let do_not expr =
@@ -413,7 +413,7 @@ let short_circuit_op_unwrap com add_statement expr :texpr =
 				add_statement tvars;
 
 				({ expr with eexpr = TBinop(op, left, local) }, [ do_not left, { right with eexpr = TBinop(OpAssign, local, right) } ])
-			| _ when acc = [] -> Globals.die ""
+			| _ when acc = [] -> Globals.die "" __LOC__
 			| _ ->
 				let var = mk_temp "boolv" expr.etype in
 				let tvars = { expr with eexpr = TVar(var, Some( { expr with etype = com.basic.tbool } )); etype = com.basic.tvoid } in
@@ -444,7 +444,7 @@ let short_circuit_op_unwrap com add_statement expr :texpr =
 						epos = assign.epos;
 					},
 				None); etype = com.basic.tvoid; epos = assign.epos }
-			| [] -> Globals.die ""
+			| [] -> Globals.die "" __LOC__
 	in
 
 	add_statement (loop local_assign_list);
@@ -478,7 +478,7 @@ let try_call_unwrap_statement com handle_cast problematic_expression_unwrap (add
 		match expr_kind left with
 			| KExprWithStatement ->
 				problematic_expression_unwrap add_statement left KExprWithStatement
-			| KStatement -> Globals.die "" (* doesn't make sense a KStatement as a left side expression *)
+			| KStatement -> Globals.die "" __LOC__ (* doesn't make sense a KStatement as a left side expression *)
 			| _ -> left
 	in
 
@@ -606,7 +606,7 @@ let configure gen =
 												problematic_expression_unwrap process_statement e hd
 											end else
 												e
-										| [] -> Globals.die ""
+										| [] -> Globals.die "" __LOC__
 								) e in
 
 								new_block := (traverse new_e) :: !new_block

+ 3 - 3
src/codegen/gencommon/fixOverrides.ml

@@ -109,7 +109,7 @@ let run ~explicit_fn_name ~get_vmtype gen =
 									(* override return type and cast implemented function *)
 									let args, newr = match follow t2, follow (apply_params f.cf_params (List.map snd f2.cf_params) real_ftype) with
 										| TFun(a,_), TFun(_,r) -> a,r
-										| _ -> Globals.die ""
+										| _ -> Globals.die "" __LOC__
 									in
 									f2.cf_type <- TFun(args,newr);
 									(match f2.cf_expr with
@@ -153,7 +153,7 @@ let run ~explicit_fn_name ~get_vmtype gen =
 								with | Not_found ->
 									c.cl_fields <- PMap.add name newf c.cl_fields;
 									c.cl_ordered_fields <- newf :: c.cl_ordered_fields)
-							| _ -> Globals.die ""
+							| _ -> Globals.die "" __LOC__
 						end
 					with | Not_found -> ()
 				in
@@ -201,7 +201,7 @@ let run ~explicit_fn_name ~get_vmtype gen =
 											with Unify_error _ ->
 												true
 										with Unify_error _ -> false) current_args original_args
-								| _ -> Globals.die ""
+								| _ -> Globals.die "" __LOC__
 							in
 							if (not (Meta.has Meta.Overload f.cf_meta) && has_contravariant_args) then
 								f.cf_meta <- (Meta.Overload, [], f.cf_pos) :: f.cf_meta;

+ 15 - 15
src/codegen/gencommon/gencommon.ml

@@ -163,10 +163,10 @@ let anon_class t =
 			| EnumStatics e -> TEnumDecl e
 			| Statics cl -> TClassDecl cl
 			| AbstractStatics a -> TAbstractDecl a
-			| _ -> die "")
+			| _ -> die "" __LOC__)
 	| TLazy f -> t_to_md (lazy_type f)
-	| TMono r -> (match r.tm_type with | Some t -> t_to_md t | None -> die "")
-	| _ -> die ""
+	| TMono r -> (match r.tm_type with | Some t -> t_to_md t | None -> die "" __LOC__)
+	| _ -> die "" __LOC__
 
 
 let get_cl mt = match mt with TClassDecl cl -> cl | _ -> failwith (Printf.sprintf "Unexpected module type (class expected) for %s: %s" (s_type_path (t_path mt)) (s_module_type_kind mt))
@@ -175,7 +175,7 @@ let get_abstract mt = match mt with TAbstractDecl a -> a | _ -> failwith (Printf
 let get_fun t =
 	match follow t with
 	| TFun (args, ret) -> args, ret
-	| t -> (trace (debug_type t)); die ""
+	| t -> (trace (debug_type t)); die "" __LOC__
 
 let mk_cast t e = Type.mk_cast e t e.epos
 
@@ -568,7 +568,7 @@ let new_ctx con =
 		| TClassDecl c -> c
 		| TAbstractDecl a ->
 				mk_class a.a_module ([], "Dynamic") a.a_pos null_pos
-		| _ -> die ""
+		| _ -> die "" __LOC__
 	in
 
 	let rec gen = {
@@ -579,9 +579,9 @@ let new_ctx con =
 			cl_type = get_cl (get_type ([], "Type"));
 			cl_dyn = cl_dyn;
 
-			nativearray = (fun _ -> die "");
-			nativearray_type = (fun _ -> die "");
-			nativearray_len = (fun _ -> die "");
+			nativearray = (fun _ -> die "" __LOC__);
+			nativearray_type = (fun _ -> die "" __LOC__);
+			nativearray_len = (fun _ -> die "" __LOC__);
 		};
 		gtools = {
 			r_fields = (fun is_used_only_by_iteration expr ->
@@ -600,7 +600,7 @@ let new_ctx con =
 				mk_cast t { eexpr = TCall(fieldcall, [obj; field]); etype = t_dynamic; epos = obj.epos }
 			);
 
-			r_create_empty = (fun _ _ pos -> gen.gcon.error "r_create_empty implementation is not provided" pos; die "");
+			r_create_empty = (fun _ _ pos -> gen.gcon.error "r_create_empty implementation is not provided" pos; die "" __LOC__);
 		};
 		gexpr_filters = new rule_map_dispatcher "gexpr_filters";
 		gmodule_filters = new rule_map_dispatcher "gmodule_filters";
@@ -1013,7 +1013,7 @@ let follow_module follow_func md = match md with
 		| TEnum(e,_) -> TEnumDecl e
 		| TType(t,_) -> TTypeDecl t
 		| TAbstract(a,_) -> TAbstractDecl a
-		| _ -> die ""
+		| _ -> die "" __LOC__
 
 (*
 	hxgen means if the type was generated by haxe. If a type was generated by haxe, it means
@@ -1048,14 +1048,14 @@ let mt_to_t mt params =
 		| TClassDecl (cl) -> TInst(cl, params)
 		| TEnumDecl (e) -> TEnum(e, params)
 		| TAbstractDecl a -> TAbstract(a, params)
-		| _ -> die ""
+		| _ -> die "" __LOC__
 
 let t_to_mt t =
 	match follow t with
 		| TInst(cl, _) -> TClassDecl(cl)
 		| TEnum(e, _) -> TEnumDecl(e)
 		| TAbstract(a, _) -> TAbstractDecl a
-		| _ -> die ""
+		| _ -> die "" __LOC__
 
 let rec get_last_ctor cl =
 	Option.map_default (fun (super,_) -> if is_some super.cl_constructor then Some(get super.cl_constructor) else get_last_ctor super) None cl.cl_super
@@ -1102,7 +1102,7 @@ let map_param cl =
 	ret
 
 let get_cl_t t =
-	match follow t with | TInst (cl,_) -> cl | _ -> die ""
+	match follow t with | TInst (cl,_) -> cl | _ -> die "" __LOC__
 
 let mk_class m path pos =
 	let cl = Type.mk_class m path pos null_pos in
@@ -1226,7 +1226,7 @@ let rec field_access gen (t:t) (field:string) : (tfield_access) =
 			   but for now, we're going to find the generated class and make a field access to it instead. *)
 			(try
 				let cl_enum = List.find (function TClassDecl cl when cl.cl_path = en.e_path && Meta.has Meta.Enum cl.cl_meta -> true | _ -> false) gen.gtypes_list in
-				let cl_enum = match cl_enum with TClassDecl cl -> TInst (cl,params) | _ -> die "" in
+				let cl_enum = match cl_enum with TClassDecl cl -> TInst (cl,params) | _ -> die "" __LOC__ in
 				field_access gen cl_enum field
 			with Not_found ->
 				FNotFound)
@@ -1277,7 +1277,7 @@ let mk_field_access gen expr field pos =
 				{ eexpr = TField(expr, FDynamic field); etype = t; epos = pos }
 		| FNotFound ->
 				{ eexpr = TField(expr, FDynamic field); etype = t_dynamic; epos = pos }
-		| FEnumField _ -> die ""
+		| FEnumField _ -> die "" __LOC__
 
 (* ******************************************* *)
 (* Module dependency resolution *)

+ 1 - 1
src/codegen/gencommon/hardNullableSynf.ml

@@ -200,7 +200,7 @@ let configure gen unwrap_null wrap_val null_to_dynamic has_value opeq_handler =
 													{ e with eexpr = TBinop( Ast.OpAssign, e1, handle_wrap { e with eexpr = TBinop (op, handle_unwrap t1 e1, handle_unwrap t2 (run e2) ) } t1 ) }
 												]) }
 										)
-									| _ -> Globals.die ""
+									| _ -> Globals.die "" __LOC__
 								)
 
 							| _ ->

+ 3 - 3
src/codegen/gencommon/initFunction.ml

@@ -57,11 +57,11 @@ let handle_override_dynfun acc e this field =
 		match e.eexpr with
 		| TField ({ eexpr = TConst TSuper }, f) ->
 			let n = field_name f in
-			if n <> field then Globals.die "";
+			if n <> field then Globals.die "" __LOC__;
 			if Option.is_none !add_expr then
 				add_expr := Some { e with eexpr = TVar(v, Some this) };
 			mk_local v e.epos
-		| TConst TSuper -> Globals.die ""
+		| TConst TSuper -> Globals.die "" __LOC__
 		| _ -> Type.map_expr loop e
 	in
 	let e = loop e in
@@ -217,7 +217,7 @@ let handle_class com cl =
 					let tf_expr = add_fn (mk_block tf.tf_expr) in
 					{ e with eexpr = TFunction { tf with tf_expr = tf_expr } }
 				| _ ->
-					Globals.die ""
+					Globals.die "" __LOC__
 			in
 			ctor.cf_expr <- Some func
 		in

+ 1 - 1
src/codegen/gencommon/objectDeclMap.ml

@@ -30,7 +30,7 @@ let configure gen map_fn =
 		match e.eexpr with
 		| TObjectDecl odecl ->
 			let e = Type.map_expr run e in
-			(match e.eexpr with TObjectDecl odecl -> map_fn e odecl | _ -> Globals.die "")
+			(match e.eexpr with TObjectDecl odecl -> map_fn e odecl | _ -> Globals.die "" __LOC__)
 		| _ ->
 			Type.map_expr run e
 	in

+ 4 - 4
src/codegen/gencommon/overloadingConstructor.ml

@@ -132,7 +132,7 @@ let create_static_ctor com ~empty_ctor_expr cl ctor follow_type =
 		let fn_type = TFun((me.v_name,false, me.v_type) :: List.map (fun (n,o,t) -> (n,o,apply_params cl.cl_params ctor_params t)) fn_args, com.basic.tvoid) in
 		let cur_tf_args = match ctor.cf_expr with
 		| Some { eexpr = TFunction(tf) } -> tf.tf_args
-		| _ -> Globals.die ""
+		| _ -> Globals.die "" __LOC__
 		in
 
 		let changed_tf_args = List.map (fun (v,_) -> (v,None)) cur_tf_args in
@@ -185,7 +185,7 @@ let create_static_ctor com ~empty_ctor_expr cl ctor follow_type =
 		let expr = match expr.eexpr with
 		| TFunction(tf) ->
 			{ expr with etype = fn_type; eexpr = TFunction({ tf with tf_args = static_tf_args }) }
-		| _ -> Globals.die "" in
+		| _ -> Globals.die "" __LOC__ in
 		static_ctor.cf_expr <- Some expr;
 		(* add to the statics *)
 		(try
@@ -217,7 +217,7 @@ let create_static_ctor com ~empty_ctor_expr cl ctor follow_type =
 				epos = p
 			}] in
 			ctor.cf_expr <- Some { e with eexpr = TFunction({ tf with tf_expr = { tf.tf_expr with eexpr = TBlock block_contents }; tf_args = changed_tf_args }) }
-		| _ -> Globals.die ""
+		| _ -> Globals.die "" __LOC__
 
 (* makes constructors that only call super() for the 'ctor' argument *)
 let clone_ctors com ctor sup stl cl =
@@ -257,7 +257,7 @@ let clone_ctors com ctor sup stl cl =
 	match clones with
 	| [] ->
 		(* raise Not_found *)
-		Globals.die "" (* should never happen *)
+		Globals.die "" __LOC__ (* should never happen *)
 	| cf :: [] -> cf
 	| cf :: overl ->
 		cf.cf_meta <- (Meta.Overload,[],cf.cf_pos) :: cf.cf_meta;

+ 8 - 8
src/codegen/gencommon/realTypeParams.ml

@@ -279,7 +279,7 @@ let rec set_hxgeneric gen mds isfirst md =
 								Some true
 							end
 				end
-			| _ -> Globals.die ""
+			| _ -> Globals.die "" __LOC__
 	end
 
 let path_s = function
@@ -294,7 +294,7 @@ let set_hxgeneric gen md =
 					let md = match t with
 						| TInst(cl,_) -> TClassDecl cl
 						| TEnum(e,_) -> TEnumDecl e
-						| _ -> Globals.die ""
+						| _ -> Globals.die "" __LOC__
 					in
 					let ret = set_hxgeneric gen [] true md in
 					if ret = None then get (set_hxgeneric gen [] false md) else get ret)
@@ -341,7 +341,7 @@ let set_hxgeneric gen md =
 				"because it explicitly has the metadata @:nativeGeneric set"
 		in
 		gen.gcon.error (reason) pos;
-		Globals.die ""
+		Globals.die "" __LOC__
 
 let params_has_tparams params =
 	List.fold_left (fun acc t -> acc || has_type_params t) false params
@@ -506,7 +506,7 @@ struct
 				| TEnum (e,_) -> e.e_path
 				| TAbstract (a,_) -> a.a_path
 				| TMono _ | TDynamic _ -> ([], "Dynamic")
-				| _ -> Globals.die ""
+				| _ -> Globals.die "" __LOC__
 			in
 			List.map (fun (cf, t_cl, t_cf) ->
 				let t_cf = follow (gen.greal_type t_cf) in
@@ -518,7 +518,7 @@ struct
 						(try (Hashtbl.find gen.gtparam_cast (get_path t_cf)) this_field t_cf with Not_found ->
 							(* if not found tparam cast, it shouldn't be a valid hxgeneric *)
 							print_endline ("Could not find a gtparam_cast for " ^ (String.concat "." (fst (get_path t_cf)) ^ "." ^ (snd (get_path t_cf))));
-							Globals.die "")
+							Globals.die "" __LOC__)
 						t_cf
 						pos
 				in
@@ -543,8 +543,8 @@ struct
 				| (TInst(cl1,[]) as v), (TInst(cl2,[]) as v2) ->
 					mk_typehandle_cond (v :: hd) (v2 :: hd2)
 				| _ ->
-					Globals.die "")
-			| _ -> Globals.die ""
+					Globals.die "" __LOC__)
+			| _ -> Globals.die "" __LOC__
 		in
 		let fn = {
 			tf_args = [];
@@ -712,7 +712,7 @@ struct
 							let cf_type = if is_override && not (Meta.has Meta.Overload cf.cf_meta) then
 								match find_first_declared_field gen cl cf.cf_name with
 									| Some(_,_,declared_t,_,_,_,_) -> declared_t
-									| _ -> Globals.die ""
+									| _ -> Globals.die "" __LOC__
 							else
 								cf.cf_type
 							in

+ 3 - 3
src/codegen/gencommon/reflectionCFs.ml

@@ -536,7 +536,7 @@ let get_delete_field ctx cl is_dynamic =
 		] in
 
 		if ctx.rcf_optimize then
-			let v_name = match tf_args with (v,_) :: _ -> v | _ -> Globals.die "" in
+			let v_name = match tf_args with (v,_) :: _ -> v | _ -> Globals.die "" __LOC__ in
 			let local_name = mk_local v_name pos in
 			let conflict_ctx = Option.get ctx.rcf_hash_conflict_ctx in
 			let ehead = mk_this (mk_internal_name "hx" "conflicts") conflict_ctx.t in
@@ -647,7 +647,7 @@ let implement_dynamic_object_ctor ctx cl =
 			match e1.eexpr, e2.eexpr with
 				| TConst(TInt i1), TConst(TInt i2) -> compare i1 i2
 				| TConst(TString s1), TConst(TString s2) -> compare s1 s2
-				| _ -> Globals.die ""
+				| _ -> Globals.die "" __LOC__
 		in
 
 		let odecl, odecl_f = List.sort sort_fn odecl, List.sort sort_fn odecl_f in
@@ -999,7 +999,7 @@ let implement_get_set ctx cl =
 			in
 			(if fields <> [] then has_fields := true);
 			let cases = List.map (fun (names, cf) ->
-				(if names = [] then Globals.die "");
+				(if names = [] then Globals.die "" __LOC__);
 				(List.map (switch_case ctx pos) names, do_field cf cf.cf_type)
 			) fields in
 			let default = Some(do_default()) in

+ 1 - 1
src/codegen/gencommon/renameTypeParameters.ml

@@ -44,7 +44,7 @@ let run types =
 	let get_cls t =
 		match follow t with
 		| TInst(cl,_) -> cl
-		| _ -> Globals.die ""
+		| _ -> Globals.die "" __LOC__
 	in
 
 	let iter_types (nt,t) =

+ 1 - 1
src/codegen/gencommon/switchToIf.ml

@@ -81,7 +81,7 @@ let configure gen (should_convert:texpr->bool) =
 					| cond :: tl ->
 						mk (TBinop (Ast.OpBoolOr, mk_eq (run cond), mk_many_cond tl)) basic.tbool cond.epos
 					| [] ->
-						Globals.die ""
+						Globals.die "" __LOC__
 				in
 
 				let mk_many_cond conds =

+ 7 - 7
src/codegen/java.ml

@@ -152,9 +152,9 @@ and convert_signature ctx p jsig =
 	| TObjectInner (pack, (name, params) :: inners) ->
 			let actual_param = match List.rev inners with
 			| (_, p) :: _ -> p
-			| _ -> die "" in
+			| _ -> die "" __LOC__ in
 			mk_type_path ctx (pack, name ^ "$" ^ String.concat "$" (List.map fst inners)) (List.map (fun param -> convert_arg ctx p param) actual_param)
-	| TObjectInner (pack, inners) -> die ""
+	| TObjectInner (pack, inners) -> die "" __LOC__
 	| TArray (jsig, _) -> mk_type_path ctx (["java"], "NativeArray") [ TPType (convert_signature ctx p jsig,null_pos) ]
 	| TMethod _ -> JReader.error "TMethod cannot be converted directly into Complex Type"
 	| TTypeParameter s -> (match ctx.jtparams with
@@ -205,7 +205,7 @@ let convert_param ctx p parent param =
 			tp_meta = [];
 		}
 
-let get_type_path ctx ct = match ct with | CTPath p -> p | _ -> die ""
+let get_type_path ctx ct = match ct with | CTPath p -> p | _ -> die "" __LOC__
 
 let is_override field =
 	List.exists (function | AttrVisibleAnnotations [{ ann_type = TObject( (["java";"lang"], "Override"), _ ) }] -> true | _ -> false) field.jf_attributes
@@ -472,7 +472,7 @@ let convert_java_enum ctx p pe =
 						| CTPath path ->
 							let pos = { p with pfile = p.pfile ^ " (" ^ f.jf_name ^" @:throws)" } in
 							EImport( List.map (fun s -> s,pos) (path.tpackage @ [path.tname]), INormal )
-						| _ -> die ""
+						| _ -> die "" __LOC__
 				) f.jf_throws
 			) jc.cmethods) in
 
@@ -638,7 +638,7 @@ let compare_type com s1 s2 =
 					p1, p2
 				| TObjectInner(_, npl1), TObjectInner(_, npl2) ->
 					snd (List.hd (List.rev npl1)), snd (List.hd (List.rev npl2))
-				| _ -> die "" (* not tobject *)
+				| _ -> die "" __LOC__ (* not tobject *)
 				in
 				let p1, p2 = simplify_args p1, simplify_args p2 in
 				let lp1 = List.length p1 in
@@ -697,7 +697,7 @@ let select_best com flist =
 					if com.verbose then print_endline (f.jf_name ^ ": The types " ^ (s_sig r) ^ " and " ^ (s_sig r2) ^ " are incompatible");
 					(* bet that the current best has "beaten" other types *)
 					loop cur_best flist
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			with | Exit -> (* incompatible type parameters *)
 				(* error mode *)
 				if com.verbose then print_endline (f.jf_name ^ ": Incompatible argument return signatures: " ^ (s_sig r) ^ " and " ^ (s_sig r2));
@@ -994,7 +994,7 @@ class virtual java_library com name file_path = object(self)
 									match ncls with
 									| EClass c :: imports ->
 										(EClass { c with d_name = (fst c.d_name ^ "_Statics"),snd c.d_name }, pos) :: inner @ List.map (fun i -> i,pos) imports
-									| _ -> die ""
+									| _ -> die "" __LOC__
 								with | Not_found ->
 									inner
 								in

+ 3 - 3
src/codegen/overloads.ml

@@ -66,7 +66,7 @@ let compare_overload_args ?(get_vmtype) ?(ctx) t1 t2 f1 f2 =
 					| result -> result
 			in
 			loop a1 a2
-		| _ -> die ""
+		| _ -> die "" __LOC__
 
 let same_overload_args ?(get_vmtype) t1 t2 f1 f2 =
 	compare_overload_args ?get_vmtype t1 t2 f1 f2 <> Different
@@ -263,7 +263,7 @@ struct
 							mk_rate ((max_int - 1, 0) :: acc) elist args
 						| _ ->
 							mk_rate (rate_conv 0 t e.etype :: acc) elist args)
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			in
 
 			let rated = ref [] in
@@ -271,7 +271,7 @@ struct
 				| (elist,TFun(args,ret),d) -> (try
 					rated := ( (elist,TFun(args,ret),d), mk_rate [] elist args ) :: !rated
 					with | Not_found -> ())
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			) compatible;
 
 			let rec loop best rem = match best, rem with

+ 9 - 9
src/codegen/swfLoader.ml

@@ -102,17 +102,17 @@ let rec make_tpath = function
 			tsub = None;
 		}
 	| HMMultiName _ ->
-		die ""
+		die "" __LOC__
 	| HMRuntimeName _ ->
-		die ""
+		die "" __LOC__
 	| HMRuntimeNameLate ->
-		die ""
+		die "" __LOC__
 	| HMMultiNameLate _ ->
-		die ""
+		die "" __LOC__
 	| HMAttrib _ ->
-		die ""
+		die "" __LOC__
 	| HMAny ->
-		die ""
+		die "" __LOC__
 	| HMParams (t,params) ->
 		let params = List.map (fun t -> TPType (CTPath (make_tpath t),null_pos)) params in
 		{ (make_tpath t) with tparams = params }
@@ -173,7 +173,7 @@ let build_class com c file =
 				in
 				loop ns
 			| HMPath _ -> i
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		) in
 		if c.hlc_interface then HExtends (make_tpath i,null_pos) else HImplements (make_tpath i,null_pos)
 	) (Array.to_list c.hlc_implements) @ flags in
@@ -298,7 +298,7 @@ let build_class com c file =
 				Hashtbl.add getters (name,stat) (m.hlm_type.hlmt_ret,mk_meta());
 				acc
 			| MK3Setter ->
-				Hashtbl.add setters (name,stat) ((match m.hlm_type.hlmt_args with [t] -> t | _ -> die ""),mk_meta());
+				Hashtbl.add setters (name,stat) ((match m.hlm_type.hlmt_args with [t] -> t | _ -> die "" __LOC__),mk_meta());
 				acc
 			)
 		| _ -> acc
@@ -318,7 +318,7 @@ let build_class com c file =
 	let fields = Array.fold_left (make_field true) fields c.hlc_static_fields in
 	let make_get_set name stat tget tset =
 		let get, set, t, meta = (match tget, tset with
-			| None, None -> die ""
+			| None, None -> die "" __LOC__
 			| Some (t,meta), None -> true, false, t, meta
 			| None, Some (t,meta) -> false, true, t, meta
 			| Some (t1,meta1), Some (t2,meta2) -> true, true, (if t1 <> t2 then None else t1), meta1 @ (List.filter (fun m -> not (List.mem m meta1)) meta2)

+ 3 - 3
src/compiler/displayOutput.ml

@@ -78,7 +78,7 @@ let print_fields fields =
 			"literal",s,s_type (print_context()) t,None
 		| ITLocal v -> "local",v.v_name,s_type (print_context()) v.v_type,None
 		| ITKeyword kwd -> "keyword",Ast.s_keyword kwd,"",None
-		| ITExpression _ | ITAnonymous _ | ITTypeParameter _ | ITDefine _ -> die ""
+		| ITExpression _ | ITAnonymous _ | ITTypeParameter _ | ITDefine _ -> die "" __LOC__
 	in
 	let fields = List.sort (fun k1 k2 -> compare (legacy_sort k1) (legacy_sort k2)) fields in
 	let fields = List.map convert fields in
@@ -354,7 +354,7 @@ let process_display_file com classes =
 						classes := path :: !classes;
 						DPKNormal path
 					| e ->
-						die ""
+						die "" __LOC__
 				in
 				path
 			| None ->
@@ -490,7 +490,7 @@ let handle_syntax_completion com kind subj =
 			Buffer.add_string b "<il>\n";
 			List.iter (fun item -> match item.ci_kind with
 				| ITKeyword kwd -> Buffer.add_string b (Printf.sprintf "<i k=\"keyword\">%s</i>" (s_keyword kwd));
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			) l;
 			Buffer.add_string b "</il>";
 			let s = Buffer.contents b in

+ 9 - 9
src/compiler/haxe.ml

@@ -273,7 +273,7 @@ module Initialize = struct
 				"python"
 			| Hl ->
 				add_std "hl";
-				if not (Common.defined com Define.HlVer) then Define.define_value com.defines Define.HlVer (try Std.input_file (Common.find_file com "hl/hl_version") with Not_found -> die "");
+				if not (Common.defined com Define.HlVer) then Define.define_value com.defines Define.HlVer (try Std.input_file (Common.find_file com "hl/hl_version") with Not_found -> die "" __LOC__);
 				"hl"
 			| Eval ->
 				add_std "eval";
@@ -334,7 +334,7 @@ let generate tctx ext interp swf_header =
 		| Eval ->
 			(fun _ -> MacroContext.interpret tctx),"eval"
 		| Cross ->
-			die ""
+			die "" __LOC__
 		in
 		Common.log com ("Generating " ^ name ^ ": " ^ com.file);
 		let t = Timer.timer ["generate";name] in
@@ -394,7 +394,7 @@ let setup_common_context ctx com =
 	) (List.rev ctx.messages))) in
 	com.get_messages <- (fun () -> (List.map (fun msg ->
 		(match msg with
-		| CMError(_,_) -> die "";
+		| CMError(_,_) -> die "" __LOC__;
 		| CMInfo(_,_) | CMWarning(_,_) -> msg;)
 	) (filter_messages false (fun _ -> true))));
 	com.filter_messages <- (fun predicate -> (ctx.messages <- (List.rev (filter_messages true predicate))));
@@ -809,7 +809,7 @@ try
 			List.iter (fun msg -> ctx.com.print (msg ^ "\n")) all;
 			did_something := true
 		),"","print help for all compiler metadatas");
-		("Misc",["--run"],[], Arg.Unit (fun() -> die ""), "<module> [args...]","compile and execute a Haxe module with command line arguments");
+		("Misc",["--run"],[], Arg.Unit (fun() -> die "" __LOC__), "<module> [args...]","compile and execute a Haxe module with command line arguments");
 	] in
 	let adv_args_spec = [
 		("Optimization",["--dce"],["-dce"],Arg.String (fun mode ->
@@ -881,8 +881,8 @@ try
 		),"<command>","run the specified command after successful compilation");
 		(* FIXME: replace with -D define *)
 		("Optimization",["--no-traces"],[], define Define.NoTraces, "","don't compile trace calls in the program");
-		("Batch",["--next"],[], Arg.Unit (fun() -> die ""), "","separate several haxe compilations");
-		("Batch",["--each"],[], Arg.Unit (fun() -> die ""), "","append preceding parameters to all Haxe compilations separated by --next");
+		("Batch",["--next"],[], Arg.Unit (fun() -> die "" __LOC__), "","separate several haxe compilations");
+		("Batch",["--each"],[], Arg.Unit (fun() -> die "" __LOC__), "","append preceding parameters to all Haxe compilations separated by --next");
 		("Services",["--display"],[], Arg.String (fun input ->
 			let input = String.trim input in
 			if String.length input > 0 && (input.[0] = '[' || input.[0] = '{') then begin
@@ -929,7 +929,7 @@ try
 			wait_loop process_params com.verbose accept
 		),"[host:]port]","connect to the given port and wait for commands to run");
 		("Compilation Server",["--connect"],[],Arg.String (fun _ ->
-			die ""
+			die "" __LOC__
 		),"<[host:]port>","connect on the given port and run commands there");
 		("Compilation",["-C";"--cwd"],[], Arg.String (fun dir ->
 			(* This is handled by process_params, but passed through so we know we did something. *)
@@ -1104,7 +1104,7 @@ with
 			| Some api ->
 				let ctx = DisplayJson.create_json_context api.jsonrpc (match de with DisplayFields _ -> true | _ -> false) in
 				api.send_result (DisplayException.to_json ctx de)
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		end
 	(* | Parser.TypePath (_,_,_,p) when ctx.com.json_out <> None ->
 		begin match com.json_out with
@@ -1113,7 +1113,7 @@ with
 			let fields = DisplayToplevel.collect tctx true Typecore.NoValue in
 			let jctx = Genjson.create_context Genjson.GMMinimum in
 			f (DisplayException.fields_to_json jctx fields CRImport (Some (Parser.cut_pos_at_display p)) false)
-		| _ -> die ""
+		| _ -> die "" __LOC__
 		end *)
 	| DisplayException(DisplayPackage pack) ->
 		DisplayPosition.display_position#reset;

+ 4 - 4
src/context/abstractCast.ml

@@ -21,7 +21,7 @@ let rec make_static_call ctx c cf a pl args t p =
 				let e = try cast_or_unify_raise ctx t e p with Error(Unify _,_) -> raise Not_found in
 				f();
 				e
-			| _ -> die ""
+			| _ -> die "" __LOC__
 	end else
 		Typecore.make_static_call ctx c cf (apply_params a.a_params pl) args t p
 
@@ -49,7 +49,7 @@ and do_check_cast ctx tleft eright p =
 				let ret = make_static_call ctx c cf a tl [eright] tleft p in
 				{ ret with eexpr = TMeta( (Meta.ImplicitCast,[],ret.epos), ret) }
 			)
-			| None -> die ""
+			| None -> die "" __LOC__
 	in
 	if type_iseq tleft eright.etype then
 		eright
@@ -204,7 +204,7 @@ let find_multitype_specialization com a pl p =
 						end
 					in
 					ignore(loop t1)
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			end;
 			tl
 	in
@@ -246,7 +246,7 @@ let handle_abstract_casts ctx e =
 						e
 					end
 				| _ ->
-					die ""
+					die "" __LOC__
 			end
 		| TCall(e1, el) ->
 			begin try

+ 7 - 7
src/context/common.ml

@@ -646,9 +646,9 @@ let create version s_version args =
 			values = defines;
 		};
 		get_macros = (fun() -> None);
-		info = (fun _ _ -> die "");
-		warning = (fun _ _ -> die "");
-		error = (fun _ _ -> die "");
+		info = (fun _ _ -> die "" __LOC__);
+		warning = (fun _ _ -> die "" __LOC__);
+		error = (fun _ _ -> die "" __LOC__);
 		get_messages = (fun() -> []);
 		filter_messages = (fun _ -> ());
 		pass_debug_messages = DynArray.create();
@@ -657,9 +657,9 @@ let create version s_version args =
 			tint = m;
 			tfloat = m;
 			tbool = m;
-			tnull = (fun _ -> die "");
+			tnull = (fun _ -> die "" __LOC__);
 			tstring = m;
-			tarray = (fun _ -> die "");
+			tarray = (fun _ -> die "" __LOC__);
 		};
 		file_lookup_cache = Hashtbl.create 0;
 		readdir_cache = Hashtbl.create 0;
@@ -782,7 +782,7 @@ let rec has_feature com f =
 	with Not_found ->
 		if com.types = [] then not (has_dce com) else
 		match List.rev (ExtString.String.nsplit f ".") with
-		| [] -> die ""
+		| [] -> die "" __LOC__
 		| [cl] -> has_feature com (cl ^ ".*")
 		| field :: cl :: pack ->
 			let r = (try
@@ -984,7 +984,7 @@ let utf16_to_utf8 str =
 				add (c lsr 8);
 				loop (i + 2);
 			end else
-				die "";
+				die "" __LOC__;
 		end
 	in
 	loop 0;

+ 1 - 1
src/context/compilationServer.ml

@@ -269,7 +269,7 @@ let get () =
 let runs () =
 	!instance <> None
 
-let force () = match !instance with None -> die "" | Some i -> i
+let force () = match !instance with None -> die "" __LOC__ | Some i -> i
 
 let get_module_name_of_cfile file cfile = match cfile.c_module_name with
 	| None ->

+ 2 - 2
src/context/display/displayException.ml

@@ -174,7 +174,7 @@ let to_json ctx de =
 	match de with
 	| Statistics _
 	| ModuleSymbols _
-	| Metadata _ -> die ""
+	| Metadata _ -> die "" __LOC__
 	| DisplaySignatures None ->
 		jnull
 	| DisplayDiagnostics dctx ->
@@ -203,7 +203,7 @@ let to_json ctx de =
 		let named_source_kind = function
 			| WithType.FunctionArgument name -> (0, name)
 			| WithType.StructureField name -> (1, name)
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		in
 		let ctx = Genjson.create_context GMFull in
 		let generate_name kind =

+ 1 - 1
src/context/display/displayJson.ml

@@ -89,7 +89,7 @@ let handler =
 			supports_resolve := hctx.jsonrpc#get_opt_param (fun () -> hctx.jsonrpc#get_bool_param "supportsResolve") false;
 			DisplayException.max_completion_items := hctx.jsonrpc#get_opt_param (fun () -> hctx.jsonrpc#get_int_param "maxCompletionItems") 0;
 			let exclude = hctx.jsonrpc#get_opt_param (fun () -> hctx.jsonrpc#get_array_param "exclude") [] in
-			DisplayToplevel.exclude := List.map (fun e -> match e with JString s -> s | _ -> die "") exclude;
+			DisplayToplevel.exclude := List.map (fun e -> match e with JString s -> s | _ -> die "" __LOC__) exclude;
 			let methods = Hashtbl.fold (fun k _ acc -> (jstring k) :: acc) h [] in
 			hctx.send_result (JObject [
 				"methods",jarray methods;

+ 1 - 1
src/context/display/displayPath.ml

@@ -183,7 +183,7 @@ let handle_path_display ctx path p =
 		| (IDKPackage sl,p),DMDefault ->
 			let sl = match List.rev sl with
 				| s :: sl -> List.rev sl
-				| [] -> die ""
+				| [] -> die "" __LOC__
 			in
 			raise (Parser.TypePath(sl,None,true,p))
 		| (IDKPackage _,_),_ ->

+ 1 - 1
src/context/display/displayToplevel.ml

@@ -422,7 +422,7 @@ let collect ctx tk with_type sort =
 	List.iter (fun (s,t) -> match follow t with
 		| TInst(c,_) ->
 			add (make_ci_type_param c (tpair t)) (Some (snd c.cl_path))
-		| _ -> die ""
+		| _ -> die "" __LOC__
 	) ctx.type_params;
 
 	(* module types *)

+ 1 - 1
src/context/display/importHandling.ml

@@ -21,7 +21,7 @@ let convert_import_to_something_usable pt path =
 			let is_display_pos = encloses_position pt p in
 			begin match is_lower,m,t with
 				| _,None,Some _ ->
-					die "" (* impossible, I think *)
+					die "" __LOC__ (* impossible, I think *)
 				| true,Some m,None ->
 					if is_display_pos then (IDKModuleField(List.rev pack,m,s),p)
 					else (IDK,p) (* assume that we're done *)

+ 2 - 2
src/context/sourcemaps.ml

@@ -234,7 +234,7 @@ class sourcemap_builder (generated_file:string) =
 			match node with
 				| Some ({ smn_data = SMNil } as node) -> current <- node
 				| Some node -> loop node.smn_left
-				| None -> die ""
+				| None -> die "" __LOC__
 		in
 		loop (Some current)
 	(**
@@ -245,7 +245,7 @@ class sourcemap_builder (generated_file:string) =
 			match node.smn_right with
 				| Some { smn_data = SMNil } -> current <- node
 				| Some node -> loop node
-				| None -> die ""
+				| None -> die "" __LOC__
 		in
 		loop current
 	(**

+ 6 - 6
src/context/typecore.ml

@@ -142,12 +142,12 @@ exception WithTypeError of error_msg * pos
 
 let memory_marker = [|Unix.time()|]
 
-let make_call_ref : (typer -> texpr -> texpr list -> t -> ?force_inline:bool -> pos -> texpr) ref = ref (fun _ _ _ _ ?force_inline:bool _ -> die "")
-let type_expr_ref : (?mode:access_mode -> typer -> expr -> WithType.t -> texpr) ref = ref (fun ?(mode=MGet) _ _ _ -> die "")
-let type_block_ref : (typer -> expr list -> WithType.t -> pos -> texpr) ref = ref (fun _ _ _ _ -> die "")
-let unify_min_ref : (typer -> texpr list -> t) ref = ref (fun _ _ -> die "")
-let unify_min_for_type_source_ref : (typer -> texpr list -> WithType.with_type_source option -> t) ref = ref (fun _ _ _ -> die "")
-let analyzer_run_on_expr_ref : (Common.context -> texpr -> texpr) ref = ref (fun _ _ -> die "")
+let make_call_ref : (typer -> texpr -> texpr list -> t -> ?force_inline:bool -> pos -> texpr) ref = ref (fun _ _ _ _ ?force_inline:bool _ -> die "" __LOC__)
+let type_expr_ref : (?mode:access_mode -> typer -> expr -> WithType.t -> texpr) ref = ref (fun ?(mode=MGet) _ _ _ -> die "" __LOC__)
+let type_block_ref : (typer -> expr list -> WithType.t -> pos -> texpr) ref = ref (fun _ _ _ _ -> die "" __LOC__)
+let unify_min_ref : (typer -> texpr list -> t) ref = ref (fun _ _ -> die "" __LOC__)
+let unify_min_for_type_source_ref : (typer -> texpr list -> WithType.with_type_source option -> t) ref = ref (fun _ _ _ -> die "" __LOC__)
+let analyzer_run_on_expr_ref : (Common.context -> texpr -> texpr) ref = ref (fun _ _ -> die "" __LOC__)
 
 let pass_name = function
 	| PBuildModule -> "build-module"

+ 1 - 1
src/core/ast.ml

@@ -1102,7 +1102,7 @@ module Expr = struct
 				add ("EMeta " ^ fst (Meta.get_info m));
 				loop e1
 			| EDisplayNew _ ->
-				die ""
+				die "" __LOC__
 		in
 		loop' "" e;
 		Buffer.contents buf

+ 2 - 2
src/core/display/completionItem.ml

@@ -199,7 +199,7 @@ module CompletionModuleType = struct
 				tp_meta = c.cl_meta
 			}
 			| _ ->
-				die ""
+				die "" __LOC__
 		in
 		{
 			pack = fst infos.mt_path;
@@ -769,7 +769,7 @@ let to_json ctx index item =
 					"meta",generate_metadata ctx c.cl_meta;
 					"constraints",jlist (generate_type ctx) tl;
 				]
-			| _ -> die ""
+			| _ -> die "" __LOC__
 			end
 		| ITDefine(n,v) -> "Define",jobject [
 			"name",jstring n;

+ 1 - 1
src/core/error.ml

@@ -242,7 +242,7 @@ module BetterErrors = struct
 					| TInst({cl_path = path},params) | TEnum({e_path = path},params) | TAbstract({a_path = path},params) | TType({t_path = path},params) ->
 						path,params
 					| _ ->
-						die ""
+						die "" __LOC__
 				in
 				let s1,s2 = loop() in
 				let path1,params1 = get_params access_prev.acc_actual in

+ 3 - 2
src/core/globals.ml

@@ -93,8 +93,9 @@ let s_version with_build =
 
 (**
 	Terminates compiler process and prints user-friendly instructions about filing an issue.
+	Usage: `die message __LOC__`, where `__LOC__` is a built-in ocaml constant
 *)
-let die ?p msg =
+let die ?p msg ml_loc =
 	let msg =
 		let str_pos, expr_msg =
 			match p with
@@ -112,5 +113,5 @@ let die ?p msg =
 	in
 	let ver = s_version true
 	and os_type = if Sys.unix then "unix" else "windows" in
-	Printf.eprintf "%s\nHaxe: %s; OS type: %s;\n%s" msg ver os_type backtrace;
+	Printf.eprintf "%s\nHaxe: %s; OS type: %s;\n%s\n%s" msg ver os_type ml_loc backtrace;
 	assert false

+ 1 - 1
src/core/json/genjson.ml

@@ -257,7 +257,7 @@ and generate_type_path_with_params ctx mpath tpath tl =
 and generate_type_parameter ctx (s,t) =
 	let generate_constraints () = match follow t with
 		| TInst({cl_kind = KTypeParameter tl},_) -> generate_types ctx tl
-		| _ -> die ""
+		| _ -> die "" __LOC__
 	in
 	jobject [
 		"name",jstring s;

+ 1 - 1
src/core/meta.ml

@@ -40,7 +40,7 @@ let get_documentation d =
 			| HasParam s -> params := s :: !params
 			| Platforms fl -> pfs := fl @ !pfs
 			| UsedOn ul -> used := ul @ !used
-			| UsedInternally -> die ""
+			| UsedInternally -> die "" __LOC__
 			| Link _ -> ()
 		) flags;
 		let params = (match List.rev !params with

+ 3 - 3
src/core/path.ml

@@ -78,7 +78,7 @@ let normalize_path path =
 		| Str.Text t :: [] ->
 			List.rev (t :: acc)
 		| Str.Text _ :: Str.Text  _ :: _ ->
-			Globals.die ""
+			Globals.die "" __LOC__
 	in
 	String.concat "/" (normalize [] (Str.full_split path_regex path))
 
@@ -168,10 +168,10 @@ let module_name_of_file file =
 		in
 		s
 	| [] ->
-		Globals.die ""
+		Globals.die "" __LOC__
 
 let rec create_file bin ext acc = function
-	| [] -> Globals.die ""
+	| [] -> Globals.die "" __LOC__
 	| d :: [] ->
 		let d = make_valid_filename d in
 		let maxlen = 200 - String.length ext in

+ 7 - 7
src/core/tFunctions.ml

@@ -2,8 +2,8 @@ open Globals
 open Ast
 open TType
 
-let monomorph_create_ref : (unit -> tmono) ref = ref (fun _ -> die "")
-let monomorph_bind_ref : (tmono -> t -> unit) ref = ref (fun _ _ -> die "")
+let monomorph_create_ref : (unit -> tmono) ref = ref (fun _ -> die "" __LOC__)
+let monomorph_bind_ref : (tmono -> t -> unit) ref = ref (fun _ _ -> die "" __LOC__)
 
 let has_meta m ml = List.exists (fun (m2,_,_) -> m = m2) ml
 let get_meta m ml = List.find (fun (m2,_,_) -> m = m2) ml
@@ -284,7 +284,7 @@ let apply_params ?stack cparams params t =
 		| [] , [] -> []
 		| (x,TLazy f) :: l1, _ -> loop ((x,lazy_type f) :: l1) l2
 		| (_,t1) :: l1 , t2 :: l2 -> (t1,t2) :: loop l1 l2
-		| _ -> die ""
+		| _ -> die "" __LOC__
 	in
 	let subst = loop cparams params in
 	let rec loop t =
@@ -363,7 +363,7 @@ let apply_params ?stack cparams params t =
 					(* for dynamic *)
 					let pt = mk_mono() in
 					let t = TInst (c,[pt]) in
-					(match pt with TMono r -> !monomorph_bind_ref r t | _ -> die "");
+					(match pt with TMono r -> !monomorph_bind_ref r t | _ -> die "" __LOC__);
 					t
 				| _ -> TInst (c,List.map loop tl))
 			| _ ->
@@ -457,7 +457,7 @@ let rec ambiguate_funs t =
 	| TFun _ -> TFun ([], t_dynamic)
 	| TMono r ->
 		(match r.tm_type with
-		| Some _ -> die ""
+		| Some _ -> die "" __LOC__
 		| _ -> t)
 	| TInst (a, pl) ->
 	    TInst (a, List.map ambiguate_funs pl)
@@ -472,7 +472,7 @@ let rec ambiguate_funs t =
 	    TAnon { a with a_fields =
 		    PMap.map (fun af -> { af with cf_type =
 				ambiguate_funs af.cf_type }) a.a_fields }
-	| TLazy _ -> die ""
+	| TLazy _ -> die "" __LOC__
 
 let rec is_nullable = function
 	| TMono r ->
@@ -702,7 +702,7 @@ let quick_field t n =
 	| TEnum _  | TMono _ | TAbstract _ | TFun _ ->
 		raise Not_found
 	| TLazy _ | TType _ ->
-		die ""
+		die "" __LOC__
 
 let quick_field_dynamic t s =
 	try quick_field t s

+ 4 - 4
src/core/tOther.ml

@@ -97,7 +97,7 @@ module TExprToExpr = struct
 		| TObjectDecl fl -> EObjectDecl (List.map (fun (k,e) -> k, convert_expr e) fl)
 		| TArrayDecl el -> EArrayDecl (List.map convert_expr el)
 		| TCall (e,el) -> ECall (convert_expr e,List.map convert_expr el)
-		| TNew (c,pl,el) -> ENew ((match (try convert_type (TInst (c,pl)) with Exit -> convert_type (TInst (c,[]))) with CTPath p -> p,null_pos | _ -> die ""),List.map convert_expr el)
+		| TNew (c,pl,el) -> ENew ((match (try convert_type (TInst (c,pl)) with Exit -> convert_type (TInst (c,[]))) with CTPath p -> p,null_pos | _ -> die "" __LOC__),List.map convert_expr el)
 		| TUnop (op,p,e) -> EUnop (op,p,convert_expr e)
 		| TFunction f ->
 			let arg (v,c) = (v.v_name,v.v_pos), false, v.v_meta, mk_type_hint v.v_type null_pos, (match c with None -> None | Some c -> Some (convert_expr c)) in
@@ -119,11 +119,11 @@ module TExprToExpr = struct
 		| TEnumIndex _
 		| TEnumParameter _ ->
 			(* these are considered complex, so the AST is handled in TMeta(Meta.Ast) *)
-			die ""
+			die "" __LOC__
 		| TTry (e,catches) ->
 			let e1 = convert_expr e in
 			let catches = List.map (fun (v,e) ->
-				let ct = try convert_type v.v_type,null_pos with Exit -> die "" in
+				let ct = try convert_type v.v_type,null_pos with Exit -> die "" __LOC__ in
 				let e = convert_expr e in
 				(v.v_name,v.v_pos),(Some ct),e,(pos e)
 			) catches in
@@ -137,7 +137,7 @@ module TExprToExpr = struct
 				| None -> None
 				| Some t ->
 					let t = (match t with TClassDecl c -> TInst (c,[]) | TEnumDecl e -> TEnum (e,[]) | TTypeDecl t -> TType (t,[]) | TAbstractDecl a -> TAbstract (a,[])) in
-					Some (try convert_type t,null_pos with Exit -> die "")
+					Some (try convert_type t,null_pos with Exit -> die "" __LOC__)
 			) in
 			ECast (convert_expr e,t)
 		| TMeta ((Meta.Ast,[e1,_],_),_) -> e1

+ 1 - 1
src/core/tPrinting.ml

@@ -475,7 +475,7 @@ module Printer = struct
 			| [] -> s
 			| _ -> Printf.sprintf "%s:%s" s (String.concat ", " (List.map s_type tl1))
 			end
-		| _ -> die ""
+		| _ -> die "" __LOC__
 
 	let s_type_params tl =
 		s_list ", " s_type_param tl

+ 2 - 2
src/core/tUnification.ml

@@ -759,7 +759,7 @@ and unify_from_field ab tl a b ?(allow_transitive_cast=true) (t,cf) =
 				) monos cf.cf_params;
 				unify_func (map r) b;
 				true
-			| _ -> die "")
+			| _ -> die "" __LOC__)
 
 and unify_to_field ab tl b ?(allow_transitive_cast=true) (t,cf) =
 	let a = TAbstract(ab,tl) in
@@ -782,7 +782,7 @@ and unify_to_field ab tl b ?(allow_transitive_cast=true) (t,cf) =
 					| _ -> ()
 				) monos cf.cf_params;
 				unify_func (map t) b;
-			| _ -> die "")
+			| _ -> die "" __LOC__)
 
 and unify_with_variance f t1 t2 =
 	let allows_variance_to t tf = type_iseq tf t in

+ 2 - 2
src/core/texpr.ml

@@ -470,7 +470,7 @@ module Builder = struct
 			| TClassDecl c -> mk_anon ~fields:c.cl_statics (ref (Statics c))
 			| TEnumDecl e -> mk_anon (ref (EnumStatics e))
 			| TAbstractDecl a -> mk_anon (ref (AbstractStatics a))
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		in
 		mk (TTypeExpr mt) t pos
 
@@ -508,7 +508,7 @@ module Builder = struct
 		| _ -> error "Unsupported constant" p
 
 	let field e name t p =
-		mk (TField (e,try quick_field e.etype name with Not_found -> die "")) t p
+		mk (TField (e,try quick_field e.etype name with Not_found -> die "" __LOC__)) t p
 
 	let fcall e name el ret p =
 		let ft = tfun (List.map (fun e -> e.etype) el) ret in

+ 3 - 3
src/core/timer.ml

@@ -63,9 +63,9 @@ let rec close now t =
 				| current :: _ ->
 					match current.pauses with
 					| pauses :: rest -> current.pauses <- (dt +. pauses) :: rest
-					| _ -> Globals.die ""
+					| _ -> Globals.die "" __LOC__
 				)
-			| _ -> Globals.die ""
+			| _ -> Globals.die "" __LOC__
 		end else
 			close now tt
 
@@ -115,7 +115,7 @@ let build_times_tree () =
 	} in
 	Hashtbl.iter (fun _ timer ->
 		let rec loop parent sl = match sl with
-			| [] -> Globals.die ""
+			| [] -> Globals.die "" __LOC__
 			| s :: sl ->
 				let path = (match parent.path with "" -> "" | _ -> parent.path ^ ".") ^ s in
 				let node = try

+ 2 - 2
src/filters/ES6Ctors.ml

@@ -62,7 +62,7 @@ let has_this_before_super e =
 let get_num_args cf =
 	match follow cf.cf_type with
 	| TFun (args, _) -> List.length args
-	| _ -> die ""
+	| _ -> die "" __LOC__
 
 (*
 	the filter works in two passes:
@@ -248,5 +248,5 @@ let rewrite_ctors com =
 		| { cl_constructor = Some ({ cf_expr = Some ({ eexpr = TFunction tf } as e_ctor) } as cf_ctor); cl_super = Some (cl_super,_) } ->
 			cl.cl_constructor <- Some { cf_ctor with cf_expr = Some { e_ctor with eexpr = TFunction { tf with tf_expr = { tf.tf_expr with eexpr = TBlock [e_empty_super_call; tf.tf_expr] } } } };
 		| _ ->
-			die ""
+			die "" __LOC__
 	) inject_super;

+ 2 - 2
src/filters/capturedVars.ml

@@ -50,7 +50,7 @@ let captured_vars com e =
 					| TClassDecl ({ cl_path = ["cs"|"java"],"NativeArray" }) -> true
 					| _ -> false
 				) com.types)
-			with TClassDecl cl -> cl | _ -> die ""
+			with TClassDecl cl -> cl | _ -> die "" __LOC__
 		in
 
 		object
@@ -60,7 +60,7 @@ let captured_vars com e =
 				match ve with
 				| None ->
 					let eone = mk (TConst (TInt (Int32.of_int 1))) t.tint p in
-					let t = match v.v_type with TInst (_, [t]) -> t | _ -> die "" in
+					let t = match v.v_type with TInst (_, [t]) -> t | _ -> die "" __LOC__ in
 					mk (TNew (cnativearray,[t],[eone])) v.v_type p
 				| Some e ->
 					{ (Inline.mk_untyped_call "__array__" p [e]) with etype = v.v_type }

+ 2 - 2
src/filters/defaultArguments.ml

@@ -127,7 +127,7 @@ let rec change_func com cl cf =
 						in
 						let args = List.map replace_args args in
 						{ tf.tf_expr with eexpr = TBlock ((if !found then { super with eexpr = TCall (e1, args) } else super) :: !block @ tl) }
-					| _ -> Globals.die "")
+					| _ -> Globals.die "" __LOC__)
 				with Not_found ->
 					Type.concat { tf.tf_expr with eexpr = TBlock !block; etype = basic.tvoid } tf.tf_expr
 			in
@@ -146,7 +146,7 @@ let rec change_func com cl cf =
 
 		| _ -> ());
 		(if !found then cf.cf_type <- TFun(!args, ret))
-	| _, _ -> Globals.die ""
+	| _, _ -> Globals.die "" __LOC__
 
 let run com md =
 	match md with

+ 2 - 2
src/filters/exceptions.ml

@@ -531,9 +531,9 @@ let patch_constructors tctx =
 									tf_expr = mk (TBlock [add fn.tf_expr; shift_stack fn.tf_expr.epos]) tctx.t.tvoid fn.tf_expr.epos
 								}
 							}
-						| _ -> die ""
+						| _ -> die "" __LOC__
 					)
-				| None -> die ""
+				| None -> die "" __LOC__
 				| _ -> ()
 				)
 			| _ -> ()

+ 2 - 2
src/filters/filters.ml

@@ -461,7 +461,7 @@ let add_field_inits locals ctx t =
 		| _ ->
 			let el = List.map (fun cf ->
 				match cf.cf_expr with
-				| None -> die ""
+				| None -> die "" __LOC__
 				| Some e ->
 					let lhs = mk (TField({ ethis with epos = cf.cf_pos },FInstance (c,List.map snd c.cl_params,cf))) cf.cf_type cf.cf_pos in
 					cf.cf_expr <- None;
@@ -486,7 +486,7 @@ let add_field_inits locals ctx t =
 					let ce = mk (TFunction {f with tf_expr = mk (TBlock (el @ bl)) ctx.com.basic.tvoid c.cl_pos }) cf.cf_type cf.cf_pos in
 					{cf with cf_expr = Some ce };
 				| _ ->
-					die ""
+					die "" __LOC__
 			in
 			let config = AnalyzerConfig.get_field_config ctx.com c cf in
 			Analyzer.Run.run_on_field ctx config c cf;

+ 1 - 1
src/filters/renameVars.ml

@@ -310,6 +310,6 @@ let run ctx ri e =
 		collect_vars rc scope e;
 		rename_vars rc scope;
 	with Failure msg ->
-		die ~p:e.epos msg
+		die ~p:e.epos msg __LOC__
 	);
 	e

+ 1 - 1
src/filters/tre.ml

@@ -18,7 +18,7 @@ let rec assign_args vars exprs =
 	| (v, Some e) :: rest_vars, rest_exprs ->
 		let arg = { e with eexpr = TLocal v } in
 		{ e with eexpr = TBinop (OpAssign, arg, e) } :: assign_args rest_vars rest_exprs
-	| _ -> die ""
+	| _ -> die "" __LOC__
 
 let replacement_for_TReturn ctx fn args p =
 	let temps_rev, args_rev = collect_new_args_values ctx args [] [] 0

+ 15 - 15
src/generators/gencpp.ml

@@ -729,7 +729,7 @@ let rec class_string klass suffix params remap =
             | TAbstract ({ a_path = ["cpp"],"UInt8" },_) -> "Dynamic"
             | t when type_has_meta_key t Meta.NotNull -> "Dynamic"
             | _ -> "/*NULL*/" ^ (type_string t) )
-         | _ -> die "");
+         | _ -> die "" __LOC__);
    (* Objective-C class *)
    | path when is_objc_type (TInst(klass,[])) ->
       let str = join_class_path_remap klass.cl_path "::" in
@@ -775,24 +775,24 @@ and type_string_suff suffix haxe_type remap =
          (match params with
          | [t] when (type_string (follow t) ) = "Dynamic" -> "Dynamic"
          | [t] -> "Array< " ^ (type_string (follow t) ) ^ " >"
-         | _ -> die "")
+         | _ -> die "" __LOC__)
       | ["cpp"] , "FastIterator" ->
          (match params with
          | [t] -> "::cpp::FastIterator< " ^ (type_string (follow t) ) ^ " >"
-         | _ -> die "")
+         | _ -> die "" __LOC__)
       | ["cpp"] , "Pointer"
       | ["cpp"] , "ConstPointer" ->
          (match params with
          | [t] -> "::cpp::Pointer< " ^ (type_string (follow t) ) ^ " >"
-         | _ -> die "")
+         | _ -> die "" __LOC__)
       | ["cpp"] , "RawPointer" ->
          (match params with
          | [t] -> " " ^ (type_string (follow t) ) ^ " *"
-         | _ -> die "")
+         | _ -> die "" __LOC__)
       | ["cpp"] , "RawConstPointer" ->
          (match params with
          | [t] -> "const " ^ (type_string (follow t) ) ^ " *"
-         | _ -> die "")
+         | _ -> die "" __LOC__)
       | ["cpp"] , "Function" ->
          "::cpp::Function< " ^ (cpp_function_signature_params params ) ^ " >"
       | _ ->  type_string_suff suffix (apply_params type_def.t_params params type_def.t_type) remap
@@ -847,10 +847,10 @@ and cpp_function_signature_params params = match params with
    | [t; abi] -> (match follow abi with
        | TInst (klass,_) -> cpp_function_signature t (get_meta_string klass.cl_meta Meta.Abi)
        | _ -> print_endline (type_string abi);
-           die "" )
+           die "" __LOC__ )
    | _ ->
       print_endline ("Params:" ^ (String.concat "," (List.map type_string params) ));
-      die "";
+      die "" __LOC__;
 
 and gen_interface_arg_type_name name opt typ =
    let type_str = (type_string typ) in
@@ -1825,7 +1825,7 @@ let rec cpp_type_of stack ctx haxe_type =
                 TCppProtocol(klass)
             (* TODO - get the line number here *)
             | _ -> print_endline "cpp.objc.Protocol must refer to an interface";
-                   die "";
+                   die "" __LOC__;
             )
       | (["cpp"],"Reference"), [param] ->
             TCppReference(cpp_type_of stack ctx param)
@@ -1888,7 +1888,7 @@ let rec cpp_type_of stack ctx haxe_type =
    and cpp_function_type_of stack ctx function_type abi =
       let abi = (match follow abi with
                  | TInst (klass1,_) -> get_meta_string klass1.cl_meta Meta.Abi
-                 | _ -> die "" )
+                 | _ -> die "" __LOC__ )
       in
       cpp_function_type_of_string stack ctx function_type abi
    and cpp_function_type_of_string stack ctx function_type abi_string =
@@ -3518,7 +3518,7 @@ let gen_cpp_ast_expression_tree ctx class_name func_name function_args function_
          let names = ExtString.String.nsplit field.cf_name ":" in
          let field_name, arg_names = match names with
            | name :: args -> name, args
-           | _ -> die "" (* per nsplit specs, this should never happen *)
+           | _ -> die "" __LOC__ (* per nsplit specs, this should never happen *)
          in
          out (" " ^ field_name);
          (try match arg_list, arg_names with
@@ -3807,7 +3807,7 @@ let gen_cpp_ast_expression_tree ctx class_name func_name function_args function_
             | CppFloat f -> out_top ( f ^ "," )
             | CppString s -> out_top ( (strq s) ^ "," )
             | CppBool b -> out_top (if b then "1," else "0,")
-            | _ -> die ""
+            | _ -> die "" __LOC__
          ) exprList;
          out_top ("\n};\n");
          out ("::Array_obj< " ^ typeName ^ " >::fromData( " ^ id ^ "," ^ list_num exprList ^ ")");
@@ -4897,7 +4897,7 @@ let generate_main ctx super_deps class_def =
    let main_expression =
       (match class_def.cl_ordered_statics with
       | [{ cf_expr = Some expression }] -> expression;
-      | _ -> die "" ) in
+      | _ -> die "" __LOC__ ) in
    ignore(find_referenced_types ctx (TClassDecl class_def) super_deps (Hashtbl.create 0) false false false);
    let depend_referenced = find_referenced_types ctx (TClassDecl class_def) super_deps (Hashtbl.create 0) false true false in
    let generate_startup filename is_main =
@@ -7202,7 +7202,7 @@ let cppia_op_info = function
 	| IaBinOp OpAssignOp OpGt
 	| IaBinOp OpAssignOp OpLt
 	| IaBinOp OpAssignOp OpAssignOp _
-	| IaBinOp OpAssignOp OpArrow -> die ""
+	| IaBinOp OpAssignOp OpArrow -> die "" __LOC__
 	| IaTCast -> ("TCAST", 221)
 ;;
 
@@ -7739,7 +7739,7 @@ class script_writer ctx filename asciiOut =
    | TEnumParameter (expr,ef,i) ->
          let enum = match follow ef.ef_type with
             | TEnum(en,_) | TFun(_,TEnum(en,_)) -> en
-            | _ -> die ""
+            | _ -> die "" __LOC__
          in
          this#write ( (this#op IaEnumI) ^ (this#typeText (TEnum(enum,[])) ) ^ (string_of_int i) ^ "\n");
          this#gen_expression expr;

+ 38 - 38
src/generators/gencs.ml

@@ -134,7 +134,7 @@ let parse_explicit_iface =
 			match split with
 				| clname :: fn_name :: [] -> fn_name, (List.rev pack, clname)
 				| pack_piece :: tl -> get_iface tl (pack_piece :: pack)
-				| _ -> die ""
+				| _ -> die "" __LOC__
 		in
 		get_iface split []
 	in parse_explicit_iface
@@ -228,16 +228,16 @@ struct
 	let get_cl_from_t t =
 		match follow t with
 			| TInst(cl,_) -> cl
-			| _ -> die ""
+			| _ -> die "" __LOC__
 
 	let get_ab_from_t t =
 		match follow t with
 			| TAbstract(ab,_) -> ab
-			| _ -> die ""
+			| _ -> die "" __LOC__
 
 	let configure gen runtime_cl =
 		let basic = gen.gcon.basic in
-		let uint = match get_type gen ([], "UInt") with | TTypeDecl t -> TType(t, []) | TAbstractDecl a -> TAbstract(a, []) | _ -> die "" in
+		let uint = match get_type gen ([], "UInt") with | TTypeDecl t -> TType(t, []) | TAbstractDecl a -> TAbstract(a, []) | _ -> die "" __LOC__ in
 
 		let rec run e =
 			match e.eexpr with
@@ -367,7 +367,7 @@ struct
 							let local, added = mk_local ea1 in
 							{ e with eexpr = TBlock([ added; mk_ushr { e1 with eexpr = TArray(local, ea2) }  ]); }
 						| _ -> (* invalid left-side expression *)
-							die ""
+							die "" __LOC__
 					in
 
 					ret
@@ -398,7 +398,7 @@ struct
 	let get_cl_from_t t =
 		match follow t with
 			| TInst(cl,_) -> cl
-			| _ -> die ""
+			| _ -> die "" __LOC__
 
 	let is_tparam t =
 		match follow t with
@@ -410,10 +410,10 @@ struct
 		(* let tchar = match ( get_type gen (["cs"], "Char16") ) with
 			| TTypeDecl t -> TType(t,[])
 			| TAbstractDecl a -> TAbstract(a,[])
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		in *)
 		let string_ext = get_cl ( get_type gen (["haxe";"lang"], "StringExt")) in
-		let ti64 = match ( get_type gen (["cs"], "Int64") ) with | TTypeDecl t -> TType(t,[]) | TAbstractDecl a -> TAbstract(a,[]) | _ -> die "" in
+		let ti64 = match ( get_type gen (["cs"], "Int64") ) with | TTypeDecl t -> TType(t,[]) | TAbstractDecl a -> TAbstract(a,[]) | _ -> die "" __LOC__ in
 		let boxed_ptr =
 			if Common.defined gen.gcon Define.Unsafe then
 				get_cl (get_type gen (["haxe";"lang"], "BoxedPointer"))
@@ -581,7 +581,7 @@ let add_cast_handler gen =
 
 	let get_narr_param t = match follow t with
 		| TInst({ cl_path = (["cs"], "NativeArray") }, [param]) -> param
-		| _ -> die ""
+		| _ -> die "" __LOC__
 	in
 
 	let gtparam_cast_native_array e to_t =
@@ -740,7 +740,7 @@ let generate con =
 
 		let native_arr_cl = get_cl ( get_type gen (["cs"], "NativeArray") ) in
 		gen.gclasses.nativearray <- (fun t -> TInst(native_arr_cl,[t]));
-		gen.gclasses.nativearray_type <- (function TInst(_,[t]) -> t | _ -> die "");
+		gen.gclasses.nativearray_type <- (function TInst(_,[t]) -> t | _ -> die "" __LOC__);
 		gen.gclasses.nativearray_len <- (fun e p -> mk_field_access gen e "Length" p);
 
 		let erase_generics = Common.defined gen.gcon Define.EraseGenerics in
@@ -907,7 +907,7 @@ let generate con =
 
 		let ifaces = Hashtbl.create 1 in
 
-		let ti64 = match ( get_type gen (["cs"], "Int64") ) with | TTypeDecl t -> TType(t,[]) | TAbstractDecl a -> TAbstract(a,[]) | _ -> die "" in
+		let ti64 = match ( get_type gen (["cs"], "Int64") ) with | TTypeDecl t -> TType(t,[]) | TAbstractDecl a -> TAbstract(a,[]) | _ -> die "" __LOC__ in
 
 		let ttype = get_cl ( get_type gen (["System"], "Type") ) in
 
@@ -1096,7 +1096,7 @@ let generate con =
 				| TAbstract(a,pl) when not (Meta.has Meta.CoreType a.a_meta) ->
 					t_s (Abstract.get_underlying_type a pl)
 				(* No Lazy type nor Function type made. That's because function types will be at this point be converted into other types *)
-				| _ -> if !strict_mode then begin trace ("[ !TypeError " ^ (Type.s_type (Type.print_context()) t) ^ " ]"); die "" end else "[ !TypeError " ^ (Type.s_type (Type.print_context()) t) ^ " ]"
+				| _ -> if !strict_mode then begin trace ("[ !TypeError " ^ (Type.s_type (Type.print_context()) t) ^ " ]"); die "" __LOC__ end else "[ !TypeError " ^ (Type.s_type (Type.print_context()) t) ^ " ]"
 
 		and path_param_s md path params =
 				match params with
@@ -1295,7 +1295,7 @@ let generate con =
 						write w "[";
 						let args, value = match List.rev args with
 							| v :: args -> List.rev args, v
-							| _ -> die ""
+							| _ -> die "" __LOC__
 						in
 						let first = ref true in
 						List.iter (fun f ->
@@ -1454,7 +1454,7 @@ let generate con =
 							expr_s w e;
 							print w "label%s: {}" n
 						| TBreak -> print w "goto label%s" n
-						| _ -> die "")
+						| _ -> die "" __LOC__)
 					| TMeta (_,e) ->
 								expr_s w e
 					| TArrayDecl el
@@ -1761,12 +1761,12 @@ let generate con =
 						write w "[ for not supported ";
 						expr_s w content;
 						write w " ]";
-						if !strict_mode then die ""
-					| TObjectDecl _ -> write w "[ obj decl not supported ]"; if !strict_mode then die ""
-					| TFunction _ -> write w "[ func decl not supported ]"; if !strict_mode then die ""
-					| TEnumParameter _ -> write w "[ enum parameter not supported ]"; if !strict_mode then die ""
-					| TEnumIndex _ -> write w "[ enum index not supported ]"; if !strict_mode then die ""
-					| TIdent s -> write w "[ ident not supported ]"; if !strict_mode then die ""
+						if !strict_mode then die "" __LOC__
+					| TObjectDecl _ -> write w "[ obj decl not supported ]"; if !strict_mode then die "" __LOC__
+					| TFunction _ -> write w "[ func decl not supported ]"; if !strict_mode then die "" __LOC__
+					| TEnumParameter _ -> write w "[ enum parameter not supported ]"; if !strict_mode then die "" __LOC__
+					| TEnumIndex _ -> write w "[ enum index not supported ]"; if !strict_mode then die "" __LOC__
+					| TIdent s -> write w "[ ident not supported ]"; if !strict_mode then die "" __LOC__
 			)
 			and do_call w e el =
 				let params, el = extract_tparams [] el in
@@ -1779,7 +1779,7 @@ let generate con =
 						let md = match e.eexpr with
 							| TField(ef, _) ->
 								t_to_md (run_follow gen ef.etype)
-							| _ -> die ""
+							| _ -> die "" __LOC__
 						in
 						write w "<";
 						ignore (List.fold_left (fun acc t ->
@@ -1951,7 +1951,7 @@ let generate con =
 			let hxgen = is_hxgen (TClassDecl cl) in
 			match cl_params with
 				| (_ :: _) when not (erase_generics && is_hxgeneric (TClassDecl cl)) ->
-					let get_param_name t = match follow t with TInst(cl, _) -> snd cl.cl_path | _ -> die "" in
+					let get_param_name t = match follow t with TInst(cl, _) -> snd cl.cl_path | _ -> die "" __LOC__ in
 					let combination_error c1 c2 =
 						gen.gcon.error ("The " ^ (get_constraint c1) ^ " constraint cannot be combined with the " ^ (get_constraint c2) ^ " constraint.") cl.cl_pos in
 
@@ -2073,7 +2073,7 @@ let generate con =
 				| None -> true
 				| Some ({ cf_kind = Method mkind } as m) ->
 					(match mkind with | MethInline -> true | _ -> false) || (has_class_field_flag m CfFinal)
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			in
 			let is_virtual = not (is_interface || is_final || (has_class_field_flag prop CfFinal) || fn_is_final get || fn_is_final set) in
 
@@ -2267,8 +2267,8 @@ let generate con =
 					let modifiers = modifiers @ modf in
 					let visibility, is_virtual = if is_explicit_iface then "",false else if visibility = "private" then "private",false else visibility, is_virtual in
 					let v_n = if is_static then "static" else if is_override && not is_interface then "override" else if is_virtual then "virtual" else "" in
-					let cf_type = if is_override && not is_overload && not (Meta.has Meta.Overload cf.cf_meta) then match field_access gen (TInst(cl, List.map snd cl.cl_params)) cf.cf_name with | FClassField(_,_,_,_,_,actual_t,_) -> actual_t | _ -> die "" else cf.cf_type in
-					let ret_type, args = match follow cf_type with | TFun (strbtl, t) -> (t, strbtl) | _ -> die "" in
+					let cf_type = if is_override && not is_overload && not (Meta.has Meta.Overload cf.cf_meta) then match field_access gen (TInst(cl, List.map snd cl.cl_params)) cf.cf_name with | FClassField(_,_,_,_,_,actual_t,_) -> actual_t | _ -> die "" __LOC__ else cf.cf_type in
+					let ret_type, args = match follow cf_type with | TFun (strbtl, t) -> (t, strbtl) | _ -> die "" __LOC__ in
 					gen_nocompletion w cf.cf_meta;
 
 					(* public static void funcName *)
@@ -2295,7 +2295,7 @@ let generate con =
 											match s.eexpr with
 												| TFunction tf ->
 													mk_block (tf.tf_expr)
-												| _ -> die "" (* FIXME *)
+												| _ -> die "" __LOC__ (* FIXME *)
 									in
 
 									let write_method_expr e =
@@ -2312,7 +2312,7 @@ let generate con =
 											line_reset_directive w;
 											if unchecked then end_block w
 										| _ ->
-											die ""
+											die "" __LOC__
 									in
 
 									(if is_new then begin
@@ -2347,7 +2347,7 @@ let generate con =
 														t()
 												);
 												write_method_expr { expr with eexpr = TBlock(rest) }
-											| _ -> die ""
+											| _ -> die "" __LOC__
 									end else
 										write_method_expr expr
 									)
@@ -2417,7 +2417,7 @@ let generate con =
 				let idx_t, v_t = match follow get.cf_type with
 					| TFun([_,_,arg_t],ret_t) ->
 						t_s (run_follow gen arg_t), t_s (run_follow gen ret_t)
-					| _ -> gen.gcon.error "The __get function must be a function with one argument. " get.cf_pos; die ""
+					| _ -> gen.gcon.error "The __get function must be a function with one argument. " get.cf_pos; die "" __LOC__
 				in
 				List.iter (fun (cl,args) ->
 					match cl.cl_array_access with
@@ -2573,7 +2573,7 @@ let generate con =
 					else
 						"object" :: (loop (pred i) acc)
 				in
-				let tparams = loop (match m with [(EConst(Int s),_)] -> int_of_string s | _ -> die "") [] in
+				let tparams = loop (match m with [(EConst(Int s),_)] -> int_of_string s | _ -> die "" __LOC__) [] in
 				cl.cl_meta <- (Meta.Meta, [
 					EConst(String("global::haxe.lang.GenericInterface(typeof(global::" ^ module_s (TClassDecl cl) ^ "<" ^ String.concat ", " tparams ^ ">))",SDoubleQuotes) ), cl.cl_pos
 				], cl.cl_pos) :: cl.cl_meta
@@ -2621,7 +2621,7 @@ let generate con =
 			begin_block w;
 			newline w;
 			(* our constructor is expected to be a normal "new" function *
-			if !strict_mode && is_some cl.cl_constructor then die "";*)
+			if !strict_mode && is_some cl.cl_constructor then die "" __LOC__;*)
 
 			let rec loop meta =
 				match meta with
@@ -2756,7 +2756,7 @@ let generate con =
 					| Some add, Some remove ->
 						if custom && not cl.cl_interface then
 							nonprops := add :: remove :: !nonprops
-					| _ -> die "" (* shouldn't happen because Filters.check_cs_events makes sure methods are present *)
+					| _ -> die "" __LOC__ (* shouldn't happen because Filters.check_cs_events makes sure methods are present *)
 				) events;
 
 				let evts = List.map (fun(_,v) -> !v) events in
@@ -2934,7 +2934,7 @@ let generate con =
 						let e = { e with eexpr = TParenthesis(e) } in
 						{ (mk_field_access gen e "value" e.epos) with etype = t }
 					| _ ->
-						trace (debug_type e.etype); gen.gcon.error "This expression is not a Nullable expression" e.epos; die ""
+						trace (debug_type e.etype); gen.gcon.error "This expression is not a Nullable expression" e.epos; die "" __LOC__
 			)
 			(fun v t has_value ->
 				match has_value, real_type v.etype with
@@ -2995,7 +2995,7 @@ let generate con =
 
 		let object_iface = get_cl (get_type gen (["haxe";"lang"],"IHxObject")) in
 
-		let empty_en = match get_type gen (["haxe";"lang"], "EmptyObject") with TEnumDecl e -> e | _ -> die "" in
+		let empty_en = match get_type gen (["haxe";"lang"], "EmptyObject") with TEnumDecl e -> e | _ -> die "" __LOC__ in
 		let empty_ctor_type = TEnum(empty_en, []) in
 		let empty_en_expr = mk (TTypeExpr (TEnumDecl empty_en)) (mk_anon (ref (EnumStatics empty_en))) null_pos in
 		let empty_ctor_expr = mk (TField (empty_en_expr, FEnum(empty_en, PMap.find "EMPTY" empty_en.e_constrs))) empty_ctor_type null_pos in
@@ -3008,7 +3008,7 @@ let generate con =
 			let get_specialized_postfix t = match t with
 				| TAbstract({a_path = [],("Float" | "Int" as name)}, _) -> name
 				| TAnon _ | TDynamic _ -> "Dynamic"
-				| _ -> print_endline (debug_type t); die ""
+				| _ -> print_endline (debug_type t); die "" __LOC__
 			in
 			(fun t -> mk_static_field_access_infer (get_cl (get_type gen (["haxe";"lang"], "FieldLookup"))) ("insert" ^ get_specialized_postfix t) null_pos []),
 			(fun t -> mk_static_field_access_infer (get_cl (get_type gen (["haxe";"lang"], "FieldLookup"))) ("remove" ^ get_specialized_postfix t) null_pos [])
@@ -3155,7 +3155,7 @@ let generate con =
 							| Some(Ast.OpAssignOp _), ([TDynamic _] | [TAnon _]) ->
 								true
 							| _ -> false)
-				| _ -> die ""
+				| _ -> die "" __LOC__
 		) "__get" "__set";
 
 		let field_is_dynamic t field =
@@ -3215,7 +3215,7 @@ let generate con =
 
 		let string_cl = match gen.gcon.basic.tstring with
 			| TInst(c,[]) -> c
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		in
 
 		let is_undefined e = match e.eexpr with
@@ -3331,7 +3331,7 @@ let generate con =
 							) cases)
 						| _ -> true
 					)
-				| _ -> die ""
+				| _ -> die "" __LOC__
 		);
 
 		ExpressionUnwrap.configure gen;

+ 75 - 75
src/generators/genhl.ml

@@ -199,7 +199,7 @@ let type_size_bits = function
 	| HUI16 -> 1
 	| HI32 | HF32 -> 2
 	| HI64 | HF64 -> 3
-	| _ -> die ""
+	| _ -> die "" __LOC__
 
 let new_lookup() =
 	{
@@ -293,7 +293,7 @@ let array_class ctx t =
 let member_fun c t =
 	match follow t with
 	| TFun (args, ret) -> TFun (("this",false,TInst(c,[])) :: args, ret)
-	| _ -> die ""
+	| _ -> die "" __LOC__
 
 let rec unsigned t =
 	match follow t with
@@ -397,7 +397,7 @@ let rec to_type ?tref ctx t =
 			class_type ctx c (List.map snd c.cl_params) true
 		| EnumStatics e ->
 			enum_class ctx e
-		| _ -> die "")
+		| _ -> die "" __LOC__)
 	| TAnon a ->
 		if PMap.is_empty a.a_fields then HDyn else
 		(try
@@ -477,7 +477,7 @@ and resolve_class ctx c pl statics =
 	| ([],"Array"), [t] ->
 		if statics then ctx.array_impl.abase else array_class ctx (to_type ctx t)
 	| ([],"Array"), [] ->
-		die ""
+		die "" __LOC__
 	| _, _ when c.cl_extern ->
 		not_supported()
 	| _ ->
@@ -589,9 +589,9 @@ and class_type ?(tref=None) ctx c pl statics =
 		| Some r -> r := Some t);
 		ctx.ct_depth <- ctx.ct_depth + 1;
 		ctx.cached_types <- PMap.add key_path t ctx.cached_types;
-		if c.cl_path = ([],"Array") then die "";
+		if c.cl_path = ([],"Array") then die "" __LOC__;
 		if c == ctx.base_class then begin
-			if statics then die "";
+			if statics then die "" __LOC__;
 			p.pnfields <- 1;
 		end;
 		let tsup = (match c.cl_super with
@@ -602,10 +602,10 @@ and class_type ?(tref=None) ctx c pl statics =
 			| None -> 0, [||]
 			| Some ((HObj psup | HStruct psup) as pt) ->
 				if is_struct t <> is_struct pt then abort (if is_struct t then "Struct cannot extend a not struct class" else "Class cannot extend a struct") c.cl_pos;
-				if psup.pnfields < 0 then die "";
+				if psup.pnfields < 0 then die "" __LOC__;
 				p.psuper <- Some psup;
 				psup.pnfields, psup.pvirtuals
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		) in
 		let fa = DynArray.create() and pa = DynArray.create() and virtuals = DynArray.of_array virtuals in
 		let add_field name get_t =
@@ -627,7 +627,7 @@ and class_type ?(tref=None) ctx c pl statics =
 				let g = alloc_fid ctx c f in
 				p.pfunctions <- PMap.add f.cf_name g p.pfunctions;
 				let virt = if List.exists (fun ff -> ff.cf_name = f.cf_name) c.cl_overrides then
-					let vid = (try -(fst (get_index f.cf_name p))-1 with Not_found -> die "") in
+					let vid = (try -(fst (get_index f.cf_name p))-1 with Not_found -> die "" __LOC__) in
 					DynArray.set virtuals vid g;
 					Some vid
 				else if is_overridden ctx c f then begin
@@ -641,7 +641,7 @@ and class_type ?(tref=None) ctx c pl statics =
 				DynArray.add pa { fname = f.cf_name; fid = alloc_string ctx f.cf_name; fmethod = g; fvirtual = virt; };
 				None
 			| Method MethDynamic when List.exists (fun ff -> ff.cf_name = f.cf_name) c.cl_overrides ->
-				Some (try fst (get_index f.cf_name p) with Not_found -> die "")
+				Some (try fst (get_index f.cf_name p) with Not_found -> die "" __LOC__)
 			| _ ->
 				let fid = add_field f.cf_name (fun() -> to_type ctx f.cf_type) in
 				Some fid
@@ -670,7 +670,7 @@ and class_type ?(tref=None) ctx c pl statics =
 		end else begin
 			(match c.cl_constructor with
 			| Some f when not (is_extern_field f) ->
-				p.pbindings <- ((try fst (get_index "__constructor__" p) with Not_found -> die ""),alloc_fid ctx c f) :: p.pbindings
+				p.pbindings <- ((try fst (get_index "__constructor__" p) with Not_found -> die "" __LOC__),alloc_fid ctx c f) :: p.pbindings
 			| _ -> ());
 		end;
 		p.pnfields <- DynArray.length fa + start_field;
@@ -712,7 +712,7 @@ and enum_type ?(tref=None) ctx e =
 			(f.ef_name, alloc_string ctx f.ef_name, args)
 		) e.e_names);
 		let ct = enum_class ctx e in
-		et.eglobal <- Some (alloc_global ctx (match ct with HObj o -> o.pname | _ -> die "") ct);
+		et.eglobal <- Some (alloc_global ctx (match ct with HObj o -> o.pname | _ -> die "" __LOC__) ct);
 		t
 
 and enum_class ctx e =
@@ -737,7 +737,7 @@ and enum_class ctx e =
 		} in
 		let t = HObj p in
 		ctx.cached_types <- PMap.add key_path t ctx.cached_types;
-		p.psuper <- Some (match class_type ctx ctx.base_enum [] false with HObj o -> o | _ -> die "");
+		p.psuper <- Some (match class_type ctx ctx.base_enum [] false with HObj o -> o | _ -> die "" __LOC__);
 		t
 
 and alloc_fun_path ctx path name =
@@ -745,7 +745,7 @@ and alloc_fun_path ctx path name =
 
 and alloc_fid ctx c f =
 	match f.cf_kind with
-	| Var _ -> die ""
+	| Var _ -> die "" __LOC__
 	| _ -> alloc_fun_path ctx c.cl_path f.cf_name
 
 and alloc_eid ctx e f =
@@ -765,7 +765,7 @@ and class_global ?(resolve=true) ctx c =
 	alloc_global ctx ("$" ^ s_type_path c.cl_path) t, t
 
 let resolve_class_global ctx cpath =
-	lookup ctx.cglobals ("$" ^ cpath) (fun() -> die "")
+	lookup ctx.cglobals ("$" ^ cpath) (fun() -> die "" __LOC__)
 
 let resolve_type ctx path =
 	PMap.find path ctx.cached_types
@@ -816,7 +816,7 @@ let hold ctx r =
 	let a = PMap.find t ctx.m.mallocs in
 	let rec loop l =
 		match l with
-		| [] -> if List.mem r a.a_hold then [] else die ""
+		| [] -> if List.mem r a.a_hold then [] else die "" __LOC__
 		| n :: l when n = r -> l
 		| n :: l -> n :: loop l
 	in
@@ -830,7 +830,7 @@ let free ctx r =
 	let last = ref true in
 	let rec loop l =
 		match l with
-		| [] -> die ""
+		| [] -> die "" __LOC__
 		| n :: l when n = r ->
 			if List.mem r l then last := false;
 			l
@@ -923,7 +923,7 @@ let read_mem ctx rdst bytes index t =
 	| HI32 | HI64 | HF32 | HF64 ->
 		op ctx (OGetMem (rdst,bytes,index))
 	| _ ->
-		die ""
+		die "" __LOC__
 
 let write_mem ctx bytes index t r =
 	match t with
@@ -934,7 +934,7 @@ let write_mem ctx bytes index t r =
 	| HI32 | HI64 | HF32 | HF64 ->
 		op ctx (OSetMem (bytes,index,r))
 	| _ ->
-		die ""
+		die "" __LOC__
 
 let common_type ctx e1 e2 for_eq p =
 	let t1 = to_type ctx e1.etype in
@@ -1032,10 +1032,10 @@ let type_value ctx t p =
 	| TEnumDecl e ->
 		let r = alloc_tmp ctx (enum_class ctx e) in
 		let rt = rtype ctx r in
-		op ctx (OGetGlobal (r, alloc_global ctx (match rt with HObj o -> o.pname | _ -> die "") rt));
+		op ctx (OGetGlobal (r, alloc_global ctx (match rt with HObj o -> o.pname | _ -> die "" __LOC__) rt));
 		r
 	| TTypeDecl _ ->
-		die ""
+		die "" __LOC__
 
 let rec eval_to ctx e (t:ttype) =
 	match e.eexpr, t with
@@ -1326,7 +1326,7 @@ and get_access ctx e =
 		(match a, follow ethis.etype with
 		| FStatic (c,({ cf_kind = Var _ | Method MethDynamic } as f)), _ ->
 			let g, t = class_global ctx c in
-			AStaticVar (g, t, (match t with HObj o -> (try fst (get_index f.cf_name o) with Not_found -> die "") | _ -> die ""))
+			AStaticVar (g, t, (match t with HObj o -> (try fst (get_index f.cf_name o) with Not_found -> die "" __LOC__) | _ -> die "" __LOC__))
 		| FStatic (c,({ cf_kind = Method _ } as f)), _ ->
 			AStaticFun (alloc_fid ctx c f)
 		| FClosure (Some (cdef,pl), f), TInst (c,_)
@@ -1400,7 +1400,7 @@ and array_read ctx ra (at,vt) ridx p =
 		| HF32 | HF64 ->
 			op ctx (OFloat (r,alloc_float ctx 0.));
 		| _ ->
-			die "");
+			die "" __LOC__);
 		let jend = jump ctx (fun i -> OJAlways i) in
 		j();
 		let hbytes = alloc_tmp ctx HBytes in
@@ -1471,7 +1471,7 @@ and jump_expr ctx e jcond =
 			| OpGte -> if jcond then gte r1 r2 else lt r1 r2
 			| OpLt -> if jcond then lt r1 r2 else gte r1 r2
 			| OpLte -> if jcond then gte r2 r1 else lt r2 r1
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		)
 	| TBinop (OpBoolAnd, e1, e2) ->
 		let j = jump_expr ctx e1 false in
@@ -1499,7 +1499,7 @@ and eval_args ctx el t p =
 		) in
 		hold ctx r;
 		r
-	) el (match t with HFun (args,_) -> args | HDyn -> List.map (fun _ -> HDyn) el | _ -> die "") in
+	) el (match t with HFun (args,_) -> args | HDyn -> List.map (fun _ -> HDyn) el | _ -> die "" __LOC__) in
 	List.iter (free ctx) rl;
 	set_curpos ctx p;
 	rl
@@ -1632,14 +1632,14 @@ and eval_expr ctx e =
 		(match follow s.etype with
 		| TInst (csup,_) ->
 			(match csup.cl_constructor with
-			| None -> die ""
+			| None -> die "" __LOC__
 			| Some f ->
 				let r = alloc_tmp ctx HVoid in
 				let el = eval_args ctx el (to_type ctx f.cf_type) e.epos in
 				op ctx (OCallN (r, alloc_fid ctx csup f, 0 :: el));
 				r
 			)
-		| _ -> die "");
+		| _ -> die "" __LOC__);
 	| TCall ({ eexpr = TIdent s }, el) when s.[0] = '$' ->
 		let invalid() = abort "Invalid native call" e.epos in
 		(match s, el with
@@ -1986,8 +1986,8 @@ and eval_expr ctx e =
 			op ctx (OGetTID (r,eval_to ctx v HType));
 			r
 		| "$resources", [] ->
-			let tdef = (try List.find (fun t -> (t_infos t).mt_path = (["haxe";"_Resource"],"ResourceContent")) ctx.com.types with Not_found -> die "") in
-			let t = class_type ctx (match tdef with TClassDecl c -> c | _ -> die "") [] false in
+			let tdef = (try List.find (fun t -> (t_infos t).mt_path = (["haxe";"_Resource"],"ResourceContent")) ctx.com.types with Not_found -> die "" __LOC__) in
+			let t = class_type ctx (match tdef with TClassDecl c -> c | _ -> die "" __LOC__) [] false in
 			let arr = alloc_tmp ctx HArray in
 			let rt = alloc_tmp ctx HType in
 			op ctx (OType (rt,t));
@@ -1998,7 +1998,7 @@ and eval_expr ctx e =
 			let rb = alloc_tmp ctx HBytes in
 			let ridx = reg_int ctx 0 in
 			hold ctx ridx;
-			let has_len = (match t with HObj p -> PMap.mem "dataLen" p.pindex | _ -> die "") in
+			let has_len = (match t with HObj p -> PMap.mem "dataLen" p.pindex | _ -> die "" __LOC__) in
 			list_iteri (fun i (k,v) ->
 				op ctx (ONew ro);
 				op ctx (OString (rb,alloc_string ctx k));
@@ -2178,7 +2178,7 @@ and eval_expr ctx e =
 				let _, sid, _ = vp.vfields.(fid) in
 				op ctx (ODynGet (r,robj, sid))
 			| _ ->
-				die "")
+				die "" __LOC__)
 		| ADynamic (ethis, f) ->
 			let robj = eval_null_check ctx ethis in
 			op ctx (ODynGet (r,robj,f))
@@ -2188,7 +2188,7 @@ and eval_expr ctx e =
 			let fid = alloc_fun_path ctx en.e_path name in
 			if fid = cur_fid then begin
 				let ef = PMap.find name en.e_constrs in
-				let eargs, et = (match follow ef.ef_type with TFun (args,ret) -> args, ret | _ -> die "") in
+				let eargs, et = (match follow ef.ef_type with TFun (args,ret) -> args, ret | _ -> die "" __LOC__) in
 				let ct = ctx.com.basic in
 				let p = ef.ef_pos in
 				let eargs = List.map (fun (n,o,t) -> Type.alloc_var VGenerated n t en.e_pos, if o then Some (mk (TConst TNull) t_dynamic null_pos) else None) eargs in
@@ -2214,7 +2214,7 @@ and eval_expr ctx e =
 			op ctx (ONew r);
 			hold ctx r;
 			List.iter (fun ((s,_,_),ev) ->
-				let fidx = (try PMap.find s vp.vindex with Not_found -> die "") in
+				let fidx = (try PMap.find s vp.vindex with Not_found -> die "" __LOC__) in
 				let _, _, ft = vp.vfields.(fidx) in
 				let v = eval_to ctx ev ft in
 				op ctx (OSetField (r,fidx,v));
@@ -2225,7 +2225,7 @@ and eval_expr ctx e =
 			let r = alloc_tmp ctx HDynObj in
 			op ctx (ONew r);
 			hold ctx r;
-			let a = (match follow e.etype with TAnon a -> Some a | t -> if t == t_dynamic then None else die "") in
+			let a = (match follow e.etype with TAnon a -> Some a | t -> if t == t_dynamic then None else die "" __LOC__) in
 			List.iter (fun ((s,_,_),ev) ->
 				let ft = (try (match a with None -> raise Not_found | Some a -> PMap.find s a.a_fields).cf_type with Not_found -> ev.etype) in
 				let v = eval_to ctx ev (to_type ctx ft) in
@@ -2244,7 +2244,7 @@ and eval_expr ctx e =
 		op ctx (ONew r);
 		hold ctx r;
 		(match c.cl_constructor with
-		| None -> if c.cl_implements <> [] then die ""
+		| None -> if c.cl_implements <> [] then die "" __LOC__
 		| Some { cf_expr = None } -> abort (s_type_path c.cl_path ^ " does not have a constructor") e.epos
 		| Some ({ cf_expr = Some cexpr } as constr) ->
 			let rl = eval_args ctx el (to_type ctx cexpr.etype) e.epos in
@@ -2310,11 +2310,11 @@ and eval_expr ctx e =
 						| OpMult -> op ctx (OMul (r,a,b))
 						| OpMod -> op ctx (if unsigned e1.etype then OUMod (r,a,b) else OSMod (r,a,b))
 						| OpDiv -> op ctx (OSDiv (r,a,b)) (* don't use UDiv since both operands are float already *)
-						| _ -> die "")
+						| _ -> die "" __LOC__)
 					| HDyn ->
-						op ctx (OCall3 (r, alloc_std ctx "dyn_op" [HI32;HDyn;HDyn] HDyn, reg_int ctx (match bop with OpSub -> 1 | OpMult -> 2 | OpMod -> 3 | OpDiv -> 4 | _ -> die ""), a, b))
+						op ctx (OCall3 (r, alloc_std ctx "dyn_op" [HI32;HDyn;HDyn] HDyn, reg_int ctx (match bop with OpSub -> 1 | OpMult -> 2 | OpMod -> 3 | OpDiv -> 4 | _ -> die "" __LOC__), a, b))
 					| _ ->
-						die "")
+						die "" __LOC__)
 				| OpShl | OpShr | OpUShr | OpAnd | OpOr | OpXor ->
 					(match rtype ctx r with
 					| HUI8 | HUI16 | HI32 | HI64 ->
@@ -2327,13 +2327,13 @@ and eval_expr ctx e =
 						| OpXor -> op ctx (OXor (r,a,b))
 						| _ -> ())
 					| HDyn ->
-						op ctx (OCall3 (r, alloc_std ctx "dyn_op" [HI32;HDyn;HDyn] HDyn, reg_int ctx (match bop with OpShl -> 5 | OpShr -> 6 | OpUShr -> 7 | OpAnd -> 8 | OpOr -> 9 | OpXor -> 10 | _ -> die ""), a, b))
+						op ctx (OCall3 (r, alloc_std ctx "dyn_op" [HI32;HDyn;HDyn] HDyn, reg_int ctx (match bop with OpShl -> 5 | OpShr -> 6 | OpUShr -> 7 | OpAnd -> 8 | OpOr -> 9 | OpXor -> 10 | _ -> die "" __LOC__), a, b))
 					| _ ->
-						die "")
+						die "" __LOC__)
 				| OpAssignOp bop ->
 					loop bop
 				| _ ->
-					die ""
+					die "" __LOC__
 			in
 			loop bop
 		in
@@ -2446,7 +2446,7 @@ and eval_expr ctx e =
 				op ctx (OSetEnumField (ctx.m.mcaptreg,index,r));
 				r
 			| AEnum _ | ANone | AInstanceFun _ | AInstanceProto _ | AStaticFun _ | AVirtualMethod _ ->
-				die "")
+				die "" __LOC__)
 		| OpBoolOr ->
 			let r = alloc_tmp ctx HBool in
 			let j = jump_expr ctx e1 true in
@@ -2484,7 +2484,7 @@ and eval_expr ctx e =
 					binop r r b;
 					r))
 		| OpInterval | OpArrow | OpIn ->
-			die "")
+			die "" __LOC__)
 	| TUnop (Not,_,v) ->
 		let tmp = alloc_tmp ctx HBool in
 		let r = eval_to ctx v HBool in
@@ -2546,7 +2546,7 @@ and eval_expr ctx e =
 				op ctx (OSub (r2, r2, tmp));
 				op ctx (OSafeCast (r, r2));
 			| _ ->
-				die ""
+				die "" __LOC__
 		in
 		(match get_access ctx v, fix with
 		| ALocal (v,r), Prefix ->
@@ -2657,7 +2657,7 @@ and eval_expr ctx e =
 			cast_to ~force:true ctx rv t e.epos)
 	| TArrayDecl el ->
 		let r = alloc_tmp ctx (to_type ctx e.etype) in
-		let et = (match follow e.etype with TInst (_,[t]) -> to_type ctx t | _ -> die "") in
+		let et = (match follow e.etype with TInst (_,[t]) -> to_type ctx t | _ -> die "" __LOC__) in
 		let array_bytes bits t tname get_op =
 			let b = alloc_tmp ctx HBytes in
 			let size = reg_int ctx ((List.length el) lsl bits) in
@@ -2714,7 +2714,7 @@ and eval_expr ctx e =
 		| AArray (a,at,idx) ->
 			array_read ctx a at idx e.epos
 		| _ ->
-			die "")
+			die "" __LOC__)
 	| TMeta (_,e) ->
 		eval_expr ctx e
 	| TFor (v,it,loop) ->
@@ -2830,7 +2830,7 @@ and eval_expr ctx e =
 			| HEnum e ->
 				let _,_,args = e.efields.(f.ef_index) in
 				args.(index), Array.length e.efields = 1
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		) in
 		let er = eval_expr ctx ec in
 		if is_single then op ctx (ONullCheck er); (* #7560 *)
@@ -2877,7 +2877,7 @@ and eval_expr ctx e =
 					| TInst (c,_) -> TClassDecl c
 					| TAbstract (a,_) -> TAbstractDecl a
 					| TEnum (e,_) -> TEnumDecl e
-					| _ -> die ""
+					| _ -> die "" __LOC__
 					) in
 					hold ctx rtrap;
 					let r = type_value ctx ct ec.epos in
@@ -3033,7 +3033,7 @@ and gen_assign_op ctx acc e1 f =
 		op ctx (ODynSet (robj,fid,r));
 		r
 	| ANone | ALocal _ | AStaticFun _ | AInstanceFun _ | AInstanceProto _ | AVirtualMethod _ | AEnum _ ->
-		die ""
+		die "" __LOC__
 
 and build_capture_vars ctx f =
 	let ignored_vars = ref PMap.empty in
@@ -3089,8 +3089,8 @@ and gen_method_wrapper ctx rt t p =
 		let fid = lookup_alloc ctx.cfids () in
 		ctx.method_wrappers <- PMap.add (rt,t) fid ctx.method_wrappers;
 		let old = ctx.m in
-		let targs, tret = (match t with HFun (args, ret) -> args, ret | _ -> die "") in
-		let iargs, iret = (match rt with HFun (args, ret) -> args, ret | _ -> die "") in
+		let targs, tret = (match t with HFun (args, ret) -> args, ret | _ -> die "" __LOC__) in
+		let iargs, iret = (match rt with HFun (args, ret) -> args, ret | _ -> die "" __LOC__) in
 		ctx.m <- method_context fid HDyn null_capture false;
 		let rfun = alloc_tmp ctx rt in
 		let rargs = List.map (fun t ->
@@ -3184,18 +3184,18 @@ and make_fun ?gen_content ctx name fidx f cthis cparent =
 				(match c.eexpr with
 				| TConst (TInt i) -> op ctx (OInt (t,alloc_i32 ctx i))
 				| TConst (TFloat s) -> op ctx (OInt (t,alloc_i32 ctx  (Int32.of_float (float_of_string s))))
-				| _ -> die "")
+				| _ -> die "" __LOC__)
 			| HF32 | HF64 ->
 				(match c.eexpr with
 				| TConst (TInt i) -> op ctx (OFloat (t,alloc_float ctx (Int32.to_float i)))
 				| TConst (TFloat s) -> op ctx (OFloat (t,alloc_float ctx  (float_of_string s)))
-				| _ -> die "")
+				| _ -> die "" __LOC__)
 			| HBool ->
 				(match c.eexpr with
 				| TConst (TBool b) -> op ctx (OBool (t,b))
-				| _ -> die "")
+				| _ -> die "" __LOC__)
 			| _ ->
-				die "");
+				die "" __LOC__);
 			if capt = None then add_assign ctx v;
 			let jend = jump ctx (fun n -> OJAlways n) in
 			j();
@@ -3208,7 +3208,7 @@ and make_fun ?gen_content ctx name fidx f cthis cparent =
 		| Some c ->
 			let j = jump ctx (fun n -> OJNotNull (r,n)) in
 			(match c.eexpr with
-			| TConst (TNull | TThis | TSuper) -> die ""
+			| TConst (TNull | TThis | TSuper) -> die "" __LOC__
 			| TConst (TInt i) when (match to_type ctx (Abstract.follow_with_abstracts v.v_type) with HUI8 | HUI16 | HI32 | HI64 | HDyn -> true | _ -> false) ->
 				let tmp = alloc_tmp ctx HI32 in
 				op ctx (OInt (tmp, alloc_i32 ctx i));
@@ -3340,7 +3340,7 @@ let rec generate_member ctx c f =
 
 			let o = (match class_type ctx c (List.map snd c.cl_params) false with
 				| HObj o | HStruct o -> o
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			) in
 
 			(*
@@ -3350,7 +3350,7 @@ let rec generate_member ctx c f =
 				match f.cf_kind with
 				| Method MethDynamic ->
 					let r = alloc_tmp ctx (to_type ctx f.cf_type) in
-					let fid = (try fst (get_index f.cf_name o) with Not_found -> die "") in
+					let fid = (try fst (get_index f.cf_name o) with Not_found -> die "" __LOC__) in
 					op ctx (OGetThis (r,fid));
 					op ctx (OJNotNull (r,2));
 					op ctx (OInstanceClosure (r,alloc_fid ctx c f,0));
@@ -3364,7 +3364,7 @@ let rec generate_member ctx c f =
 			(* function __string() return this.toString().bytes *)
 			let ethis = mk (TConst TThis) (TInst (c,List.map snd c.cl_params)) p in
 			let tstr = mk (TCall (mk (TField (ethis,FInstance(c,List.map snd c.cl_params,f))) f.cf_type p,[])) ctx.com.basic.tstring p in
-			let cstr, cf_bytes = (try (match ctx.com.basic.tstring with TInst(c,_) -> c, PMap.find "bytes" c.cl_fields | _ -> die "") with Not_found -> die "") in
+			let cstr, cf_bytes = (try (match ctx.com.basic.tstring with TInst(c,_) -> c, PMap.find "bytes" c.cl_fields | _ -> die "" __LOC__) with Not_found -> die "" __LOC__) in
 			let estr = mk (TReturn (Some (mk (TField (tstr,FInstance (cstr,[],cf_bytes))) cf_bytes.cf_type p))) ctx.com.basic.tvoid p in
 			ignore(make_fun ctx (s_type_path c.cl_path,"__string") (alloc_fun_path ctx c.cl_path "__string") { tf_expr = estr; tf_args = []; tf_type = cf_bytes.cf_type; } (Some c) None)
 		end
@@ -3427,9 +3427,9 @@ let generate_static_init ctx types main =
 				let index name =
 					match ct with
 					| HObj o ->
-						fst (try get_index name o with Not_found -> die "")
+						fst (try get_index name o with Not_found -> die "" __LOC__)
 					| _ ->
-						die ""
+						die "" __LOC__
 				in
 
 				let rc = (match t with
@@ -3525,9 +3525,9 @@ let generate_static_init ctx types main =
 				let index name =
 					match et with
 					| HObj o ->
-						fst (try get_index name o with Not_found -> die "")
+						fst (try get_index name o with Not_found -> die "" __LOC__)
 					| _ ->
-						die ""
+						die "" __LOC__
 				in
 
 				let avalues = alloc_tmp ctx HArray in
@@ -3560,16 +3560,16 @@ let generate_static_init ctx types main =
 					let index name =
 						match t with
 						| HObj o ->
-							fst (try get_index name o with Not_found -> die "")
+							fst (try get_index name o with Not_found -> die "" __LOC__)
 						| _ ->
-							die ""
+							die "" __LOC__
 					in
 
 					let g = alloc_global ctx ("$" ^ name) t in
 					let r = alloc_tmp ctx t in
 					let rt = alloc_tmp ctx HType in
 					op ctx (ONew r);
-					op ctx (OType (rt,(match name with "Int" -> HI32 | "Float" -> HF64 | "Dynamic" -> HDyn | "Bool" -> HBool | _ -> die "")));
+					op ctx (OType (rt,(match name with "Int" -> HI32 | "Float" -> HF64 | "Dynamic" -> HDyn | "Bool" -> HBool | _ -> die "" __LOC__)));
 					op ctx (OSetField (r,index "__type__",rt));
 					op ctx (OSetField (r,index (if is_bool then "__ename__" else "__name__"),make_string ctx name pos));
 					op ctx (OSetGlobal (g,r));
@@ -3625,7 +3625,7 @@ let write_index_gen b i =
 		if i < 0x2000 then begin
 			b ((i lsr 8) lor 0xA0);
 			b (i land 0xFF);
-		end else if i >= 0x20000000 then die "" else begin
+		end else if i >= 0x20000000 then die "" __LOC__ else begin
 			b ((i lsr 24) lor 0xE0);
 			b ((i lsr 16) land 0xFF);
 			b ((i lsr 8) land 0xFF);
@@ -3636,7 +3636,7 @@ let write_index_gen b i =
 	else if i < 0x2000 then begin
 		b ((i lsr 8) lor 0x80);
 		b (i land 0xFF);
-	end else if i >= 0x20000000 then die "" else begin
+	end else if i >= 0x20000000 then die "" __LOC__ else begin
 		b ((i lsr 24) lor 0xC0);
 		b ((i lsr 16) land 0xFF);
 		b ((i lsr 8) land 0xFF);
@@ -3650,7 +3650,7 @@ let write_code ch code debug =
 	let write_index = write_index_gen byte in
 
 	let rec write_type t =
-		write_index (try PMap.find t htypes with Not_found -> die "")
+		write_index (try PMap.find t htypes with Not_found -> die "" __LOC__)
 	in
 
 	let write_op op =
@@ -3687,7 +3687,7 @@ let write_code ch code debug =
 			write_index r;
 			write_index f;
 			let n = List.length rl in
-			if n > 0xFF then die "";
+			if n > 0xFF then die "" __LOC__;
 			byte n;
 			List.iter write_index rl
 		| OType (r,t) ->
@@ -3728,7 +3728,7 @@ let write_code ch code debug =
 				write_index b;
 				write_index c;
 			| _ ->
-				die ""
+				die "" __LOC__
 	in
 
 	IO.nwrite_string ch "HLB";
@@ -3793,7 +3793,7 @@ let write_code ch code debug =
 		| HDyn -> byte 9
 		| HFun (args,ret) | HMethod (args,ret) ->
 			let n = List.length args in
-			if n > 0xFF then die "";
+			if n > 0xFF then die "" __LOC__;
 			byte (match t with HFun _ -> 10 | _ -> 20);
 			byte n;
 			List.iter write_type args;
@@ -3838,7 +3838,7 @@ let write_code ch code debug =
 			write_index (Array.length e.efields);
 			Array.iter (fun (_,nid,tl) ->
 				write_index nid;
-				if Array.length tl > 0xFF then die "";
+				if Array.length tl > 0xFF then die "" __LOC__;
 				byte (Array.length tl);
 				Array.iter write_type tl;
 			) e.efields
@@ -3933,12 +3933,12 @@ let create_context com is_macro dump =
 	let get_class name =
 		match get_type name with
 		| TClassDecl c -> c
-		| _ -> die ""
+		| _ -> die "" __LOC__
 	in
 	let get_abstract name =
 		match get_type name with
 		| TAbstractDecl a -> a
-		| _ -> die ""
+		| _ -> die "" __LOC__
 	in
 	let ctx = {
 		com = com;

+ 1 - 1
src/generators/genhxold.ml

@@ -196,7 +196,7 @@ let generate_type com t =
 						a,(if o then Some (loop f.cf_meta) else None ),t
 					) args, ret
 				| _ ->
-					die ""
+					die "" __LOC__
 			) in
 			let tparams = (match f.cf_params with [] -> "" | l -> "<" ^ String.concat "," (List.map fst l) ^ ">") in
 			p "function %s%s(%s) : %s" name tparams (String.concat ", " (List.map sparam params)) (stype ret);

+ 31 - 31
src/generators/genjava.ml

@@ -181,7 +181,7 @@ let parse_explicit_iface =
 			match split with
 				| clname :: fn_name :: [] -> fn_name, (List.rev pack, clname)
 				| pack_piece :: tl -> get_iface tl (pack_piece :: pack)
-				| _ -> die ""
+				| _ -> die "" __LOC__
 		in
 		get_iface split []
 	in parse_explicit_iface
@@ -218,7 +218,7 @@ struct
 	let get_cl_from_t t =
 		match follow t with
 			| TInst(cl,_) -> cl
-			| _ -> die ""
+			| _ -> die "" __LOC__
 
 	let configure gen runtime_cl =
 		let basic = gen.gcon.basic in
@@ -482,7 +482,7 @@ struct
 		let has_case = ref false in
 		(* first we need to reorder all cases so all collisions are close to each other *)
 
-		let get_str e = match e.eexpr with | TConst(TString s) -> s | _ -> die "" in
+		let get_str e = match e.eexpr with | TConst(TString s) -> s | _ -> die "" __LOC__ in
 		let has_conflict = ref false in
 
 		let rec reorder_cases unordered ordered =
@@ -514,7 +514,7 @@ struct
 							match ret with
 								| (el, e) :: ( (_,_) :: _ as tl ) -> loop tl ( (true, el, e) :: acc )
 								| (el, e) :: [] -> ( (false, el, e) :: acc )
-								| _ -> die ""
+								| _ -> die "" __LOC__
 						in
 						List.rev (loop ret [])
 					else
@@ -564,7 +564,7 @@ struct
 						in
 
 						Some conds, hashed_exprs
-					| _ -> die ""
+					| _ -> die "" __LOC__
 			) (None,[]) el in
 			let e = if has_default then Type.concat execute_def_set e else e in
 			let e = if !has_conflict then Type.concat e { e with eexpr = TBreak; etype = basic.tvoid } else e in
@@ -602,13 +602,13 @@ struct
 	let get_cl_from_t t =
 		match follow t with
 		| TInst(cl,_) -> cl
-		| _ -> die ""
+		| _ -> die "" __LOC__
 
 	let configure gen runtime_cl =
 		let cl_boolean = get_cl (get_type gen (["java";"lang"],"Boolean")) in
 		let cl_number = get_cl (get_type gen (["java";"lang"],"Number")) in
 
-		(if java_hash "Testing string hashCode implementation from haXe" <> (Int32.of_int 545883604) then die "");
+		(if java_hash "Testing string hashCode implementation from haXe" <> (Int32.of_int 545883604) then die "" __LOC__);
 		let basic = gen.gcon.basic in
 		let tbyte = mt_to_t_dyn ( get_type gen (["java"], "Int8") ) in
 		let tshort = mt_to_t_dyn ( get_type gen (["java"], "Int16") ) in
@@ -633,8 +633,8 @@ struct
 					| "Long" ->
 						cl, ti64
 					| _ ->
-						die "")
-				| _ -> die ""
+						die "" __LOC__)
+				| _ -> die "" __LOC__
 		in
 
 		let mk_valueof_call boxed_t expr =
@@ -691,7 +691,7 @@ struct
 					"numToLong"
 				| TInst({ cl_path = (["java";"lang"],"Short") },[]) ->
 					"numToShort"
-				| _ -> gen.gcon.error ("Invalid boxed type " ^ (debug_type boxed_t)) expr.epos; die ""
+				| _ -> gen.gcon.error ("Invalid boxed type " ^ (debug_type boxed_t)) expr.epos; die "" __LOC__
 			in
 			{
 				eexpr = TCall(
@@ -994,7 +994,7 @@ let generate con =
 	(try
 	let native_arr_cl = get_cl ( get_type gen (["java"], "NativeArray") ) in
 	gen.gclasses.nativearray <- (fun t -> TInst(native_arr_cl,[t]));
-	gen.gclasses.nativearray_type <- (function TInst(_,[t]) -> t | _ -> die "");
+	gen.gclasses.nativearray_type <- (function TInst(_,[t]) -> t | _ -> die "" __LOC__);
 	gen.gclasses.nativearray_len <- (fun e p -> mk_field_access gen e "length" p);
 
 	let fn_cl = get_cl (get_type gen (["haxe";"lang"],"Function")) in
@@ -1004,7 +1004,7 @@ let generate con =
 
 	(*let string_ref = get_cl ( get_type gen (["haxe";"lang"], "StringRefl")) in*)
 
-	let ti64 = match ( get_type gen (["java"], "Int64") ) with | TAbstractDecl a -> TAbstract(a,[]) | _ -> die "" in
+	let ti64 = match ( get_type gen (["java"], "Int64") ) with | TAbstractDecl a -> TAbstract(a,[]) | _ -> die "" __LOC__ in
 
 	let has_tdynamic params =
 		List.exists (fun e -> match run_follow gen e with | TDynamic _ -> true | _ -> false) params
@@ -1281,7 +1281,7 @@ let generate con =
 					| TDynamic _ ->
 							path_s_import pos (["java";"lang"], "Object") []
 				(* No Lazy type nor Function type made. That's because function types will be at this point be converted into other types *)
-				| _ -> if !strict_mode then begin trace ("[ !TypeError " ^ (Type.s_type (Type.print_context()) t) ^ " ]"); die "" end else "[ !TypeError " ^ (Type.s_type (Type.print_context()) t) ^ " ]"
+				| _ -> if !strict_mode then begin trace ("[ !TypeError " ^ (Type.s_type (Type.print_context()) t) ^ " ]"); die "" __LOC__ end else "[ !TypeError " ^ (Type.s_type (Type.print_context()) t) ^ " ]"
 		end
 	and param_t_s stack pos t =
 		match run_follow gen t with
@@ -1529,7 +1529,7 @@ let generate con =
 						newline w;
 						expr_s w e;
 					| TBreak -> print w "break label%s" n
-					| _ -> die "")
+					| _ -> die "" __LOC__)
 				| TMeta (_,e) ->
 					expr_s w e
 				| TCall ({ eexpr = TIdent "__array__" }, el)
@@ -1613,7 +1613,7 @@ let generate con =
 						| params ->
 							let md = match e.eexpr with
 								| TField(ef, _) -> t_to_md (run_follow gen ef.etype)
-								| _ -> die ""
+								| _ -> die "" __LOC__
 							in
 							write w "<";
 							ignore (List.fold_left (fun acc t ->
@@ -1804,11 +1804,11 @@ let generate con =
 					write w "[ for not supported ";
 					expr_s w content;
 					write w " ]";
-					if !strict_mode then die ""
-				| TObjectDecl _ -> write w "[ obj decl not supported ]"; if !strict_mode then die ""
-				| TFunction _ -> write w "[ func decl not supported ]"; if !strict_mode then die ""
-				| TEnumParameter _ -> write w "[ enum parameter not supported ]"; if !strict_mode then die ""
-				| TEnumIndex _ -> write w "[ enum index not supported ]"; if !strict_mode then die ""
+					if !strict_mode then die "" __LOC__
+				| TObjectDecl _ -> write w "[ obj decl not supported ]"; if !strict_mode then die "" __LOC__
+				| TFunction _ -> write w "[ func decl not supported ]"; if !strict_mode then die "" __LOC__
+				| TEnumParameter _ -> write w "[ enum parameter not supported ]"; if !strict_mode then die "" __LOC__
+				| TEnumIndex _ -> write w "[ enum index not supported ]"; if !strict_mode then die "" __LOC__
 		in
 		expr_s w e
 	in
@@ -1901,7 +1901,7 @@ let generate con =
 			| [] ->
 				("","")
 			| _ ->
-				let params = sprintf "<%s>" (String.concat ", " (List.map (fun (_, tcl) -> match follow tcl with | TInst(cl, _) -> snd cl.cl_path | _ -> die "") cl_params)) in
+				let params = sprintf "<%s>" (String.concat ", " (List.map (fun (_, tcl) -> match follow tcl with | TInst(cl, _) -> snd cl.cl_path | _ -> die "" __LOC__) cl_params)) in
 				let params_extends = List.fold_left (fun acc (name, t) ->
 					match run_follow gen t with
 						| TInst (cl, p) ->
@@ -1909,7 +1909,7 @@ let generate con =
 								| [] -> acc
 								| _ -> acc) (* TODO
 								| _ -> (sprintf " where %s : %s" name (String.concat ", " (List.map (fun (cl,p) -> path_param_s (TClassDecl cl) cl.cl_path p) cl.cl_implements))) :: acc ) *)
-						| _ -> trace (t_s null_pos t); die "" (* FIXME it seems that a cl_params will never be anything other than cl.cl_params. I'll take the risk and fail if not, just to see if that confirms *)
+						| _ -> trace (t_s null_pos t); die "" __LOC__ (* FIXME it seems that a cl_params will never be anything other than cl.cl_params. I'll take the risk and fail if not, just to see if that confirms *)
 				) [] cl_params in
 				(params, String.concat " " params_extends)
 	in
@@ -1991,13 +1991,13 @@ let generate con =
 				let visibility, modifiers = get_fun_modifiers cf.cf_meta visibility [] in
 				let visibility, is_virtual = if is_explicit_iface then "",false else visibility, is_virtual in
 				let v_n = if is_static then "static" else if is_override && not is_interface then "" else if not is_virtual then "final" else "" in
-				let cf_type = if is_override && not is_overload && not (Meta.has Meta.Overload cf.cf_meta) then match field_access gen (TInst(cl, List.map snd cl.cl_params)) cf.cf_name with | FClassField(_,_,_,_,_,actual_t,_) -> actual_t | _ -> die "" else cf.cf_type in
+				let cf_type = if is_override && not is_overload && not (Meta.has Meta.Overload cf.cf_meta) then match field_access gen (TInst(cl, List.map snd cl.cl_params)) cf.cf_name with | FClassField(_,_,_,_,_,actual_t,_) -> actual_t | _ -> die "" __LOC__ else cf.cf_type in
 
 				let params = List.map snd cl.cl_params in
 				let ret_type, args = match follow cf_type, follow cf.cf_type with
 					| TFun (strbtl, t), TFun(rargs, _) ->
 							(apply_params cl.cl_params params (real_type t), List.map2 (fun(_,_,t) (n,o,_) -> (n,o,apply_params cl.cl_params params (real_type t))) strbtl rargs)
-					| _ -> die ""
+					| _ -> die "" __LOC__
 				in
 
 				(if is_override && not is_interface then write w "@Override ");
@@ -2026,7 +2026,7 @@ let generate con =
 										match s.eexpr with
 											| TFunction tf ->
 												mk_block (tf.tf_expr)
-											| _ -> die "" (* FIXME *)
+											| _ -> die "" __LOC__ (* FIXME *)
 								in
 								(if is_new then begin
 									(*let rec get_super_call el =
@@ -2134,7 +2134,7 @@ let generate con =
 		(* public class Test<A> : X, Y, Z where A : Y *)
 		begin_block w;
 		(* our constructor is expected to be a normal "new" function *
-		if !strict_mode && is_some cl.cl_constructor then die "";*)
+		if !strict_mode && is_some cl.cl_constructor then die "" __LOC__;*)
 
 		let rec loop cl =
 			List.iter (fun cf -> add_scope cf.cf_name) cl.cl_ordered_fields;
@@ -2321,7 +2321,7 @@ let generate con =
 
 	let object_iface = get_cl (get_type gen (["haxe";"lang"],"IHxObject")) in
 
-	let empty_en = match get_type gen (["haxe";"lang"], "EmptyObject") with TEnumDecl e -> e | _ -> die "" in
+	let empty_en = match get_type gen (["haxe";"lang"], "EmptyObject") with TEnumDecl e -> e | _ -> die "" __LOC__ in
 	let empty_ctor_type = TEnum(empty_en, []) in
 	let empty_en_expr = mk (TTypeExpr (TEnumDecl empty_en)) (mk_anon (ref (EnumStatics empty_en))) null_pos in
 	let empty_ctor_expr = mk (TField (empty_en_expr, FEnum(empty_en, PMap.find "EMPTY" empty_en.e_constrs))) empty_ctor_type null_pos in
@@ -2333,7 +2333,7 @@ let generate con =
 		| TAbstract({a_path = [],"Float"}, _) -> "Float"
 		| TInst({cl_path = [],"String"},_) -> "String"
 		| TAnon _ | TDynamic _ -> "Dynamic"
-		| _ -> print_endline (debug_type t); die ""
+		| _ -> print_endline (debug_type t); die "" __LOC__
 	in
 	let rcf_static_insert t = mk_static_field_access_infer (get_cl (get_type gen (["haxe";"lang"], "FieldLookup"))) ("insert" ^ get_specialized_postfix t) null_pos [] in
 	let rcf_static_remove t = mk_static_field_access_infer (get_cl (get_type gen (["haxe";"lang"], "FieldLookup"))) ("remove" ^ get_specialized_postfix t) null_pos [] in
@@ -2444,7 +2444,7 @@ let generate con =
 				( match run_follow gen (follow e1.etype) with
 					| TInst({ cl_path = (["java"], "NativeArray") }, _) -> false
 					| _ -> true )
-			| _ -> die ""
+			| _ -> die "" __LOC__
 	) "__get" "__set";
 
 	let field_is_dynamic is_dynamic t field =
@@ -2595,7 +2595,7 @@ let generate con =
 						) cases)
 					| _ -> true
 				)
-			| _ -> die ""
+			| _ -> die "" __LOC__
 	);
 
 	ExpressionUnwrap.configure gen;
@@ -2614,7 +2614,7 @@ let generate con =
 	JavaSpecificESynf.configure gen runtime_cl;
 
 	(* add native String as a String superclass *)
-	let str_cl = match gen.gcon.basic.tstring with | TInst(cl,_) -> cl | _ -> die "" in
+	let str_cl = match gen.gcon.basic.tstring with | TInst(cl,_) -> cl | _ -> die "" __LOC__ in
 	str_cl.cl_super <- Some (get_cl (get_type gen (["haxe";"lang"], "NativeString")), []);
 
 	Path.mkdir_from_path (gen.gcon.file ^ "/src");

+ 6 - 6
src/generators/genjs.ml

@@ -465,7 +465,7 @@ let rec gen_call ctx e el in_value =
 		spr ctx "]";
 	| TIdent "`trace", [e;infos] ->
 		if has_feature ctx "haxe.Log.trace" then begin
-			let t = (try List.find (fun t -> t_path t = (["haxe"],"Log")) ctx.com.types with _ -> die "") in
+			let t = (try List.find (fun t -> t_path t = (["haxe"],"Log")) ctx.com.types with _ -> die "" __LOC__) in
 			spr ctx (ctx.type_accessor t);
 			spr ctx ".trace(";
 			gen_value ctx e;
@@ -585,7 +585,7 @@ and gen_expr ctx e =
 	| TEnumParameter (x,f,i) ->
 		gen_value ctx x;
 		if not (Common.defined ctx.com Define.JsEnumsAsArrays) then
-			let fname = (match f.ef_type with TFun((args,_)) -> let fname,_,_ = List.nth args i in  fname | _ -> die "" ) in
+			let fname = (match f.ef_type with TFun((args,_)) -> let fname,_,_ = List.nth args i in  fname | _ -> die "" __LOC__ ) in
 			print ctx ".%s" (ident fname)
 		else
 			print ctx "[%i]" (i + 2)
@@ -615,7 +615,7 @@ and gen_expr ctx e =
 			gen_expr ctx e
 		| TBreak ->
 			print ctx "break _hx_loop%s" n;
-		| _ -> die "")
+		| _ -> die "" __LOC__)
 	| TMeta (_,e) ->
 		gen_expr ctx e
 	| TReturn eo ->
@@ -820,7 +820,7 @@ and gen_block_element ?(after=false) ctx e =
 		else (match eelse with
 			| [] -> ()
 			| [e] -> gen_block_element ~after ctx e
-			| _ -> die "")
+			| _ -> die "" __LOC__)
 	| TFunction _ ->
 		gen_block_element ~after ctx (mk (TParenthesis e) e.etype e.epos)
 	| TObjectDecl fl ->
@@ -834,7 +834,7 @@ and gen_value ctx e =
 	let clear_mapping = add_mapping ctx e in
 	let assign e =
 		mk (TBinop (Ast.OpAssign,
-			mk (TLocal (match ctx.in_value with None -> die "" | Some v -> v)) t_dynamic e.epos,
+			mk (TLocal (match ctx.in_value with None -> die "" __LOC__ | Some v -> v)) t_dynamic e.epos,
 			e
 		)) e.etype e.epos
 	in
@@ -1623,7 +1623,7 @@ let alloc_ctx com es_version =
 		in_value = None;
 		in_loop = false;
 		id_counter = 0;
-		type_accessor = (fun _ -> die "");
+		type_accessor = (fun _ -> die "" __LOC__);
 		separator = false;
 		found_expose = false;
 		catch_vars = [];

+ 30 - 30
src/generators/genjvm.ml

@@ -109,12 +109,12 @@ let rec jsignature_of_type gctx stack t =
 			| [],"Null" ->
 				begin match tl with
 				| [t] -> get_boxed_type (jsignature_of_type t)
-				| _ -> die ""
+				| _ -> die "" __LOC__
 				end
 			| (["haxe";"ds"],"Vector") | (["haxe";"extern"],"Rest") ->
 				begin match tl with
 				| [t] -> TArray(jsignature_of_type t,None)
-				| _ -> die ""
+				| _ -> die "" __LOC__
 				end
 			| [],"Dynamic" ->
 				object_sig
@@ -240,7 +240,7 @@ let convert_cmp_op = function
 	| OpLte -> CmpLe
 	| OpGt -> CmpGt
 	| OpGte -> CmpGe
-	| _ -> die ""
+	| _ -> die "" __LOC__
 
 let flip_cmp_op = function
 	| CmpEq -> CmpNe
@@ -299,7 +299,7 @@ class haxe_exception gctx (t : Type.t) =
 	let is_haxe_exception = Exceptions.is_haxe_exception t
 	and native_type = jsignature_of_type gctx t in
 object(self)
-	val native_path = (match native_type with TObject(path,_) -> path | _ -> die "")
+	val native_path = (match native_type with TObject(path,_) -> path | _ -> die "" __LOC__)
 
 	method is_assignable_to (exc2 : haxe_exception) =
 		match self#is_haxe_exception,exc2#is_haxe_exception with
@@ -347,7 +347,7 @@ let create_field_closure gctx jc path_this jm name jsig =
 		| TMethod(args,ret) ->
 			List.mapi (fun i jsig -> (Printf.sprintf "arg%i" i,jsig)) args,ret
 		| _ ->
-			die ""
+			die "" __LOC__
 	in
 	let jm_invoke = wf#generate_invoke args ret in
 	let vars = List.map (fun (name,jsig) ->
@@ -431,7 +431,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 
 	method get_local_by_id (vid,vname) =
 		if vid = 0 && env = None then
-			(0,(fun () -> jm#load_this),(fun () -> die ""))
+			(0,(fun () -> jm#load_this),(fun () -> die "" __LOC__))
 		else try
 			Hashtbl.find local_lookup vid
 		with Not_found -> try
@@ -595,7 +595,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 		let read_static_closure path cf =
 			let args,ret = match follow cf.cf_type with
 				| TFun(tl,tr) -> List.map (fun (n,_,t) -> n,self#vtype t) tl,(return_of_type gctx tr)
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			in
 			self#read_static_closure path cf.cf_name args ret
 		in
@@ -756,7 +756,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 				end
 		| _ ->
 			print_endline (s_expr_ast false "" (s_type (print_context())) e);
-			die ""
+			die "" __LOC__
 
 	(* branching *)
 
@@ -820,7 +820,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 			let cases = List.map (fun (el,e) ->
 				let il = List.map (fun e -> match e.eexpr with
 					| TConst (TInt i32) -> i32
-					| _ -> die ""
+					| _ -> die "" __LOC__
 				) el in
 				(il,(fun () -> self#texpr ret e))
 			) cases in
@@ -835,7 +835,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 			let cases = List.map (fun (el,e) ->
 				let sl = List.map (fun e -> match e.eexpr with
 					| TConst (TString s) -> s
-					| _ -> die ""
+					| _ -> die "" __LOC__
 				) el in
 				(sl,(fun () -> self#texpr ret e))
 			) cases in
@@ -860,7 +860,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 			let el = List.rev_map (fun (el,e) ->
 				let f e' = mk (TBinop(OpEq,ev,e')) com.basic.tbool e'.epos in
 				let e_cond = match el with
-					| [] -> die ""
+					| [] -> die "" __LOC__
 					| [e] -> f e
 					| e :: el ->
 						List.fold_left (fun eacc e ->
@@ -870,7 +870,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 				(e_cond,e)
 			) cases in
 			(* If we rewrite an exhaustive switch that has no default value, treat the last case as the default case to satisfy control flow. *)
-			let cases,def = if need_val && def = None then (match List.rev cases with (_,e) :: cases -> List.rev cases,Some e | _ -> die "") else cases,def in
+			let cases,def = if need_val && def = None then (match List.rev cases with (_,e) :: cases -> List.rev cases,Some e | _ -> die "" __LOC__) else cases,def in
 			let e = List.fold_left (fun e_else (e_cond,e_then) -> Some (mk (TIf(e_cond,e_then,e_else)) e_then.etype e_then.epos)) def el in
 			self#texpr ret (Option.get e);
 			pop_scope()
@@ -1076,7 +1076,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 			| OpShl -> "opShl"
 			| OpShr -> "opShr"
 			| OpUShr -> "opUshr"
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		in
 		begin match cast_type with
 			| TByte | TShort | TInt ->
@@ -1377,7 +1377,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 			let tl,tr = self#call_arguments cf.cf_type el in
 			begin match tl with
 				| [t1;t2] -> self#boolop (CmpSpecial (code#if_acmp_ne t1 t2))
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			end;
 			tr
 		| TField(_,FStatic({cl_path = ["haxe";"jvm"],"Jvm"},({cf_name = "instanceof"}))) ->
@@ -1401,7 +1401,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 				jm#invokestatic (["java";"lang"],"Double") name (method_sig [TDouble] (Some TBool));
 				Some TBool
 			| _ ->
-				die ""
+				die "" __LOC__
 			end;
 		| TField(_,FStatic({cl_path = (["java";"lang"],"Math")},{cf_name = ("floor" | "ceil" | "round") as name})) ->
 			begin match el with
@@ -1413,7 +1413,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 				jm#cast TInt;
 				Some TInt
 			| _ ->
-				die ""
+				die "" __LOC__
 			end;
 		| TField(_,FStatic({cl_path = (["java";"lang"],"Math")} as c,({cf_name = ("ffloor" | "fceil")} as cf))) ->
 			let tl,tr = self#call_arguments cf.cf_type el in
@@ -1441,7 +1441,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 				jm#get_code#lor_;
 				Some TLong
 			| _ ->
-				die ""
+				die "" __LOC__
 			end
 		| TIdent "__array__" | TField(_,FStatic({cl_path = (["java"],"NativeArray")},{cf_name = "make"})) ->
 			begin match follow tr with
@@ -1514,7 +1514,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 					let c,_,cf = raw_class_field (fun cf -> cf.cf_type) c [] cf.cf_name in
 					let path_inner = match c with
 						| Some(c,_) -> c.cl_path
-						| _ -> die ""
+						| _ -> die "" __LOC__
 					in
 					self#texpr rvalue_any e11;
 					let tl,tr = self#call_arguments cf.cf_type el in
@@ -1597,7 +1597,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 					if not term_try then jm#add_stack_frame;
 					jm#close_jumps true ([term_try,r_try]);
 					None
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			end
 		| _ ->
 			self#texpr rvalue_any e1;
@@ -1607,7 +1607,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 		| false,Some _ -> code#pop
 		| false,None -> ()
 		| true,Some _ -> self#cast tr;
-		| true,None -> die ""
+		| true,None -> die "" __LOC__
 
 	(* exceptions *)
 
@@ -1870,7 +1870,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 				jm#invokestatic (["haxe";"root"],"Array") "ofNative" (method_sig [array_sig object_sig] (Some (object_path_sig (["haxe";"root"],"Array"))));
 				self#cast e.etype
 			| _ ->
-				die ""
+				die "" __LOC__
 			end
 		| TArray(e1,e2) when not (need_val ret) ->
 			(* Array access never throws so this should be fine... *)
@@ -1901,7 +1901,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 			if ret = RReturn && not jm#is_terminated then jm#return;
 		| TBlock el ->
 			let rec loop el = match el with
-				| [] -> die ""
+				| [] -> die "" __LOC__
 				| [e1] ->
 					self#texpr ret e1;
 					if ret = RReturn && not jm#is_terminated then jm#return;
@@ -1934,7 +1934,7 @@ class texpr_to_jvm gctx (jc : JvmClass.builder) (jm : JvmMethod.builder) (return
 				| TFun(tl,TEnum(en,_)) ->
 					let n,_,t = List.nth tl i in
 					en.e_path,n,self#vtype t
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			in
 			let cpath = ((fst path),Printf.sprintf "%s$%s" (snd path) ef.ef_name) in
 			let jsig = (object_path_sig cpath) in
@@ -2151,7 +2151,7 @@ class tclass_to_jvm gctx c = object(self)
 					let tr = loop tr in
 					TFun(tl,tr)
 				| _ ->
-					die ""
+					die "" __LOC__
 			in
 			if !has_type_param then Some t else None
 		in
@@ -2163,7 +2163,7 @@ class tclass_to_jvm gctx c = object(self)
 					let jm = jc#spawn_method cf_impl.cf_name jsig [MPublic;MSynthetic;MBridge] in
 					jm#load_this;
 					let jsig_impl = jsignature_of_type gctx cf_impl.cf_type in
-					let jsigs,_ = match jsig_impl with TMethod(jsigs,jsig) -> jsigs,jsig | _ -> die "" in
+					let jsigs,_ = match jsig_impl with TMethod(jsigs,jsig) -> jsigs,jsig | _ -> die "" __LOC__ in
 					List.iter2 (fun (n,_,t) jsig ->
 						let _,load,_ = jm#add_local n (jsignature_of_type gctx t) VarArgument in
 						load();
@@ -2199,7 +2199,7 @@ class tclass_to_jvm gctx c = object(self)
 					| (Method (MethNormal | MethInline)),(Some(c',_),_,cf_impl) when c' == c ->
 						let tl = match follow (map_type cf.cf_type) with
 							| TFun(tl,_) -> tl
-							| _ -> die ""
+							| _ -> die "" __LOC__
 						in
 						begin match find_overload_rec' false map_type c cf.cf_name (List.map (fun (_,_,t) -> Texpr.Builder.make_null t null_pos) tl) with
 							| Some(_,cf_impl,_) -> check true cf cf_impl
@@ -2222,7 +2222,7 @@ class tclass_to_jvm gctx c = object(self)
 				| _ -> ()
 			) fields
 		| _ ->
-			die ""
+			die "" __LOC__
 		end
 
 	method private set_interfaces =
@@ -2273,7 +2273,7 @@ class tclass_to_jvm gctx c = object(self)
 				DynArray.iter (fun e ->
 					handler#texpr RVoid e;
 				) field_inits;
-				let tl = match follow cf.cf_type with TFun(tl,_) -> tl | _ -> die "" in
+				let tl = match follow cf.cf_type with TFun(tl,_) -> tl | _ -> die "" __LOC__ in
 				List.iter (fun (n,_,t) ->
 					let _,load,_ = jm#add_local n (jsignature_of_type gctx t) VarArgument in
 					load();
@@ -2705,7 +2705,7 @@ let generate_anons gctx =
 				let jm = jc#spawn_method cf.cf_name jsig_cf [MPublic] in
 				let tl,tr = match follow cf.cf_type with
 					| TFun(tl,tr) -> tl,tr
-					| _ -> die ""
+					| _ -> die "" __LOC__
 				in
 				let locals = List.map (fun (n,_,t) ->
 					let jsig = jsignature_of_type gctx t in
@@ -2792,7 +2792,7 @@ end
 let file_name_and_extension file =
 	match List.rev (ExtString.String.nsplit file "/") with
 	| e1 :: _ -> e1
-	| _ -> die ""
+	| _ -> die "" __LOC__
 
 let generate com =
 	mkdir_from_path com.file;

+ 10 - 10
src/generators/genlua.ml

@@ -237,7 +237,7 @@ let mk_mr_box ctx e =
         match follow e.etype with
         | TInst (c,_) ->
             String.concat ", " (List.map (fun f -> "\"" ^ f.cf_name ^ "\"") c.cl_ordered_fields)
-        | _ -> Globals.die ""
+        | _ -> Globals.die "" __LOC__
     in
     add_feature ctx "use._hx_box_mr";
     add_feature ctx "use._hx_table";
@@ -251,7 +251,7 @@ let mk_mr_select com e ecall name =
         | TInst (c,_) ->
             index_of (fun f -> f.cf_name = name) c.cl_ordered_fields
         | _ ->
-            Globals.die ""
+            Globals.die "" __LOC__
     in
     if i == 0 then
         mk_lua_code com "{0}" [ecall] e.etype e.epos
@@ -320,7 +320,7 @@ let gen_constant ctx p = function
     | TBool b -> spr ctx (if b then "true" else "false")
     | TNull -> spr ctx "nil"
     | TThis -> spr ctx (this ctx)
-    | TSuper -> Globals.die ""
+    | TSuper -> Globals.die "" __LOC__
 
 
 
@@ -460,7 +460,7 @@ and gen_call ctx e el =
          print ctx "}, %i)" !count;
      | TIdent "`trace", [e;infos] ->
          if has_feature ctx "haxe.Log.trace" then begin
-             let t = (try List.find (fun t -> t_path t = (["haxe"],"Log")) ctx.com.types with _ -> Globals.die "") in
+             let t = (try List.find (fun t -> t_path t = (["haxe"],"Log")) ctx.com.types with _ -> Globals.die "" __LOC__) in
              spr ctx (ctx.type_accessor t);
              spr ctx ".trace(";
              gen_value ctx e;
@@ -691,7 +691,7 @@ and gen_expr ?(local=true) ctx e = begin
          | [(EConst(String(id,_)), _)] ->
              spr ctx (id ^ "_" ^ (ident v.v_name) ^ "_" ^ (field_name f));
          | _ ->
-             Globals.die "");
+             Globals.die "" __LOC__);
     | TField (x,f) ->
         gen_value ctx x;
         let name = field_name f in
@@ -781,7 +781,7 @@ and gen_expr ?(local=true) ctx e = begin
                         | TInst (c, _) ->
                             List.map (fun f -> id ^ "_" ^name ^ "_" ^ f.cf_name) c.cl_ordered_fields
                         | _ ->
-                            Globals.die ""
+                            Globals.die "" __LOC__
                     in
                     spr ctx "local ";
                     spr ctx (String.concat ", " names);
@@ -956,7 +956,7 @@ and gen_expr ?(local=true) ctx e = begin
         | [v,e] ->
             print ctx "  local %s = _hx_result;" v.v_name;
             gen_block_element ctx e;
-        | _ -> Globals.die ""
+        | _ -> Globals.die "" __LOC__
         );
         bend();
         newline ctx;
@@ -1058,7 +1058,7 @@ and gen_block_element ctx e  =
             else (match eelse with
                 | [] -> ()
                 | [e] -> gen_block_element ctx e
-                | _ -> Globals.die "")
+                | _ -> Globals.die "" __LOC__)
         | _ ->
             newline ctx;
             gen_expr ctx e;
@@ -1104,7 +1104,7 @@ and gen_anon_value ctx e =
 and gen_value ctx e =
     let assign e =
         mk (TBinop (Ast.OpAssign,
-                    mk (TLocal (match ctx.in_value with None -> Globals.die "" | Some v -> v)) t_dynamic e.epos,
+                    mk (TLocal (match ctx.in_value with None -> Globals.die "" __LOC__ | Some v -> v)) t_dynamic e.epos,
                     e
                    )) e.etype e.epos
     in
@@ -1815,7 +1815,7 @@ let alloc_ctx com =
         break_depth = 0;
         handle_continue = false;
         id_counter = 0;
-        type_accessor = (fun _ -> Globals.die "");
+        type_accessor = (fun _ -> Globals.die "" __LOC__);
         separator = false;
         found_expose = false;
         lua_jit = Common.defined com Define.LuaJit;

+ 8 - 8
src/generators/genneko.ml

@@ -177,7 +177,7 @@ let gen_constant ctx pe c =
 	| TBool b -> (EConst (if b then True else False),p)
 	| TNull -> null p
 	| TThis -> this p
-	| TSuper -> die ""
+	| TSuper -> die "" __LOC__
 
 let rec gen_binop ctx p op e1 e2 =
 	(EBinop (Ast.s_binop op,gen_expr ctx e1,gen_expr ctx e2),p)
@@ -193,7 +193,7 @@ and gen_unop ctx p op flag e =
 and gen_call ctx p e el =
 	match e.eexpr , el with
 	| TConst TSuper , _ ->
-		let c = (match follow e.etype with TInst (c,_) -> c | _ -> die "") in
+		let c = (match follow e.etype with TInst (c,_) -> c | _ -> die "" __LOC__) in
 		call p (builtin p "call") [
 			field p (gen_type_path p c.cl_path) "__construct__";
 			this p;
@@ -204,7 +204,7 @@ and gen_call ctx p e el =
 			(EObject [("name",gen_constant ctx e.epos (TString name));("data",gen_big_string ctx p data)],p) :: acc
 		) ctx.com.resources [])
 	| TField ({ eexpr = TConst TSuper; etype = t },f) , _ ->
-		let c = (match follow t with TInst (c,_) -> c | _ -> die "") in
+		let c = (match follow t with TInst (c,_) -> c | _ -> die "" __LOC__) in
 		call p (builtin p "call") [
 			field p (gen_type_path p (fst c.cl_path,"@" ^ snd c.cl_path)) (field_name f);
 			this p;
@@ -245,7 +245,7 @@ and gen_expr ctx e =
 				else
 					call p (ident p ("@closure" ^ string_of_int n)) [tmp;ident p "@fun"]
 			] , p
-		| _ -> die "")
+		| _ -> die "" __LOC__)
 	| TEnumParameter (e,_,i) ->
 		EArray (field p (gen_expr ctx e) "args",int p i),p
 	| TEnumIndex e ->
@@ -334,7 +334,7 @@ and gen_expr ctx e =
 					| TEnum (e,_) -> Some e.e_path
 					| TAbstract (a,_) -> Some a.a_path
 					| TDynamic _ -> None
-					| _ -> die ""
+					| _ -> die "" __LOC__
 				) in
 				let cond = (match path with
 					| None -> (EConst True,p)
@@ -380,7 +380,7 @@ and gen_expr ctx e =
 				e,
 				List.map (fun (el,e2) ->
 					match List.map (gen_expr ctx) el with
-					| [] -> die ""
+					| [] -> die "" __LOC__
 					| [e] -> e, gen_expr ctx e2
 					| _ -> raise Exit
 				) cases,
@@ -392,7 +392,7 @@ and gen_expr ctx e =
 					(EVars ["@tmp",Some e],p);
 					List.fold_left (fun acc (el,e) ->
 						let cond = (match el with
-							| [] -> die ""
+							| [] -> die "" __LOC__
 							| e :: l ->
 								let eq e = (EBinop ("==",ident p "@tmp",gen_expr ctx e),p) in
 								List.fold_left (fun acc e -> (EBinop ("||",acc,eq e),p)) (eq e) l
@@ -736,7 +736,7 @@ let header() =
 	let p = { psource = "<header>"; pline = 1 } in
 	let fields l =
 		let rec loop = function
-			| [] -> die ""
+			| [] -> die "" __LOC__
 			| [x] -> ident p x
 			| x :: l -> field p (loop l) x
 		in

+ 51 - 51
src/generators/genphp7.ml

@@ -374,7 +374,7 @@ let rec needs_temp_var expr =
 let get_function_signature (field:tclass_field) : (string * bool * Type.t) list * Type.t =
 	match follow field.cf_type with
 		| TFun (args, return_type) -> (args, return_type)
-		| _ -> fail field.cf_pos
+		| _ -> fail field.cf_pos __LOC__
 
 (**
 	Check if `target` is 100% guaranteed to be a scalar type in PHP.
@@ -690,14 +690,14 @@ let need_boot_equal expr1 expr2 =
 *)
 let ensure_return_in_block block_expr =
 	match block_expr.eexpr with
-		| TBlock [] -> fail block_expr.epos
+		| TBlock [] -> fail block_expr.epos __LOC__
 		| TBlock exprs ->
 			let reversed = List.rev exprs in
 			let last_expr = List.hd reversed in
 			let return_expr = { last_expr with eexpr = TReturn (Some last_expr) } in
 			let reversed = return_expr::(List.tl reversed) in
 			{ block_expr with eexpr = TBlock (List.rev reversed) }
-		| _ -> fail block_expr.epos
+		| _ -> fail block_expr.epos __LOC__
 
 (**
 	If `expr` is a block, then return list of expressions in that block.
@@ -716,7 +716,7 @@ let unpack_block expr =
 let unpack_single_expr_block expr =
 		match expr.eexpr with
 			| TBlock [ e ] -> e
-			| TBlock _ -> fail expr.epos
+			| TBlock _ -> fail expr.epos __LOC__
 			| _ -> expr
 
 (**
@@ -1125,10 +1125,10 @@ class local_vars =
 		*)
 		method pop : string list * string list * string list =
 			match used_locals with
-				| [] -> die ""
+				| [] -> die "" __LOC__
 				| used :: rest_used ->
 					match declared_locals with
-						| [] -> die ""
+						| [] -> die "" __LOC__
 						| declared :: rest_declared ->
 							let higher_vars = diff_lists (hashtbl_keys used) (hashtbl_keys declared)
 							and declared_vars = hashtbl_keys declared in
@@ -1158,14 +1158,14 @@ class local_vars =
 		*)
 		method declared (name:string) : unit =
 			match declared_locals with
-				| [] -> die ""
+				| [] -> die "" __LOC__
 				| current :: _ -> Hashtbl.replace current name name
 		(**
 			Specify local var name used in current scope
 		*)
 		method used (name:string) : unit =
 			match used_locals with
-				| [] -> die ""
+				| [] -> die "" __LOC__
 				| current :: _ -> Hashtbl.replace current name name
 		(**
 			Mark specified vars as captured by closures.
@@ -1274,7 +1274,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 						let alias_source = ref (List.rev module_path) in
 						let get_alias_next_part () =
 							match !alias_source with
-								| [] ->  fail ~msg:("Failed to find already used type: " ^ get_full_type_name type_path) self#pos
+								| [] ->  fail ~msg:("Failed to find already used type: " ^ get_full_type_name type_path) self#pos __LOC__
 								| name :: rest ->
 									alias_source := (match rest with
 										| [] -> [name]
@@ -1304,7 +1304,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 								| Not_found ->
 									Hashtbl.add use_table !alias_upper { ut_alias = !alias; ut_type_path = type_path; };
 									added := true
-								| _ -> fail self#pos
+								| _ -> fail self#pos __LOC__
 						done;
 						!alias
 			end
@@ -1327,13 +1327,13 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 				| TFun _ -> self#use ~prefix:false ([], "Closure")
 				| TAnon _ -> "object"
 				| TDynamic _ -> "mixed"
-				| TLazy _ -> fail ~msg:"TLazy not implemented" self#pos
+				| TLazy _ -> fail ~msg:"TLazy not implemented" self#pos __LOC__
 				| TMono mono ->
 					(match mono.tm_type with
 						| None -> "mixed"
 						| Some t -> self#use_t t
 					)
-				| TType _ -> fail ~msg:"TType not implemented" self#pos
+				| TType _ -> fail ~msg:"TType not implemented" self#pos __LOC__
 				| TAbstract (abstr, _) ->
 					match abstr.a_path with
 						| ([],"Int") -> "int"
@@ -1470,7 +1470,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 							access_expr
 						)
 					}
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 		(**
 			Writes specified string to output buffer
 		*)
@@ -1581,7 +1581,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 				| TArrayDecl exprs -> self#write_expr_array_decl exprs
 				| TCall (target, [arg1; arg2]) when is_std_is target -> self#write_expr_std_is target arg1 arg2
 				| TCall (_, [arg]) when is_native_struct_array_cast expr && is_object_declaration arg ->
-					(match (reveal_expr arg).eexpr with TObjectDecl fields -> self#write_assoc_array_decl fields | _ -> fail self#pos)
+					(match (reveal_expr arg).eexpr with TObjectDecl fields -> self#write_assoc_array_decl fields | _ -> fail self#pos __LOC__)
 				| TCall ({ eexpr = TIdent name}, args) when is_magic expr -> self#write_expr_magic name args
 				| TCall ({ eexpr = TField (expr, access) }, args) when is_string expr -> self#write_expr_call_string expr access args
 				| TCall (expr, args) when is_syntax_extern expr -> self#write_expr_call_syntax_extern expr args
@@ -1594,7 +1594,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 				| TFunction fn -> self#write_expr_function fn
 				| TVar (var, expr) -> self#write_expr_var var expr
 				| TBlock exprs -> self#write_expr_block expr
-				| TFor (var, iterator, body) -> fail self#pos
+				| TFor (var, iterator, body) -> fail self#pos __LOC__
 				| TIf (condition, if_expr, else_expr) -> self#write_expr_if condition if_expr else_expr
 				| TWhile (condition, expr, do_while) ->
 					(match (reveal_expr_with_parenthesis condition).eexpr with
@@ -1924,14 +1924,14 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 			DeprecationCheck.warn_deprecation ctx.pgc_common msg self#pos;
 			let error = ("Invalid arguments for " ^ name ^ " magic call") in
 			match args with
-				| [] -> fail ~msg:error self#pos
+				| [] -> fail ~msg:error self#pos __LOC__
 				| { eexpr = TConst (TString code) } as expr :: args ->
 					(match name with
 						| "__php__" ->
 							(match expr.eexpr with
 								| TConst (TString php) ->
 									Codegen.interpolate_code ctx.pgc_common php args self#write self#write_expr self#pos
-								| _ -> fail self#pos
+								| _ -> fail self#pos __LOC__
 							)
 						| "__call__" ->
 							self#write (code ^ "(");
@@ -1940,7 +1940,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 						| "__physeq__" ->
 							(match args with
 								| [expr2] -> self#write_expr_binop OpEq expr expr2
-								| _ -> fail ~msg:error self#pos
+								| _ -> fail ~msg:error self#pos __LOC__
 							)
 						| "__var__" ->
 							(match args with
@@ -1950,20 +1950,20 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 									self#write ("$" ^ code ^ "[");
 									self#write_expr expr2;
 									self#write "]"
-								| _ -> fail ~msg:error self#pos
+								| _ -> fail ~msg:error self#pos __LOC__
 							)
-						| _ -> fail ~msg:error self#pos
+						| _ -> fail ~msg:error self#pos __LOC__
 					)
 				| [expr1; expr2] ->
 					(match name with
 						| "__physeq__" ->
 							(match args with
 								| [expr1; expr2] -> self#write_expr_binop OpEq expr1 expr2
-								| _ -> fail ~msg:error self#pos
+								| _ -> fail ~msg:error self#pos __LOC__
 							)
-						| _ -> fail ~msg:error self#pos
+						| _ -> fail ~msg:error self#pos __LOC__
 					)
-				| _ -> fail ~msg:error self#pos
+				| _ -> fail ~msg:error self#pos __LOC__
 		(**
 			Writes TTypeExpr to output buffer
 		*)
@@ -2211,7 +2211,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 					self#write ((self#use hxstring_type_path) ^ "::" ^ (field_name field) ^ "(");
 					write_args self#write self#write_expr (expr :: args);
 					self#write ")"
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 		(**
 			Writes FStatic field access for methods to output buffer
 		*)
@@ -2308,7 +2308,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 		method write_expr_call_syntax_extern expr args =
 			let name = match expr.eexpr with
 				| TField (_, FStatic (_, field)) -> field_name field
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 			in
 			match name with
 				| "code" | "codeDeref" -> self#write_expr_syntax_code args
@@ -2332,7 +2332,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 		*)
 		method write_expr_syntax_code args =
 			match args with
-				| [] -> fail self#pos
+				| [] -> fail self#pos __LOC__
 				| { eexpr = TConst (TString php) } :: args ->
 					let args = List.map
 						(fun arg ->
@@ -2352,7 +2352,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 				| [ args_expr ] ->
 					self#write "@";
 					self#write_expr args_expr
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 		(**
 			Writes native array declaration (for `php.Syntax.arrayDecl()`)
 		*)
@@ -2393,7 +2393,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 					self#write "(";
 					write_args self#write (fun e -> self#write_expr e) args;
 					self#write ")"
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 		(**
 			Writes a call to a static method (for `php.Syntax.staticCall()`)
 		*)
@@ -2406,7 +2406,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 					self#write "(";
 					write_args self#write (fun e -> self#write_expr e) args;
 					self#write ")"
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 		(**
 			Writes field access for reading (for `php.Syntax.getField()`)
 		*)
@@ -2416,7 +2416,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 					self#write_expr obj_expr;
 					self#write "->";
 					self#write_syntax_field_expr field_expr;
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 		(**
 			Writes field access for writing (for `php.Syntax.setField()`)
 		*)
@@ -2429,7 +2429,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 					self#write "}";
 					self#write " = ";
 					self#write_expr value_expr
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 		(**
 			Writes static field access for reading (for `php.Syntax.getStaticField()`)
 		*)
@@ -2440,7 +2440,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 					self#write "::${";
 					self#write_expr field_expr;
 					self#write "}"
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 		(**
 			Writes static field access for writing (for `php.Syntax.setField()`)
 		*)
@@ -2453,14 +2453,14 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 					self#write "}";
 					self#write " = ";
 					self#write_expr value_expr
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 		(**
 			Writes `new` expression with class name taken local variable (for `php.Syntax.construct()`)
 		*)
 		method write_expr_syntax_construct args =
 			let (class_expr, args) = match args with
 				| class_expr :: args -> (class_expr, args)
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 			in
 			self#write "new ";
 			self#write_expr class_expr;
@@ -2482,7 +2482,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 					self#write " ?? ";
 					self#write_expr right;
 					self#write ")";
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 		(**
 			Writes `instanceof` expression to output buffer (for `php.Syntax.instanceof()`)
 		*)
@@ -2500,7 +2500,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 							if not (is_string type_expr) then self#write "->phpClassName"
 					);
 					self#write ")"
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 		(**
 			Writes either a "Cls::class" expression (if class is passed directly) or a `$cls->phpClassName` expression
 			(if class is passed as a variable) to output buffer (for `php.Syntax.nativeClassName()`)
@@ -2516,7 +2516,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 							self#write_expr cls_expr;
 							self#write "->phpClassName"
 					);
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 		(**
 			Writes `foreach` expression to output buffer (for `php.Syntax.foreach()`)
 		*)
@@ -2535,7 +2535,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 					self#write (" as $" ^ key.v_name ^ " => $" ^ value.v_name ^ ") ");
 					self#write_as_block ~unset_locals:true { body with eexpr = TBlock body_exprs };
 				| _ ->
-					fail self#pos
+					fail self#pos __LOC__
 		(**
 			Writes TCall to output buffer
 		*)
@@ -2600,7 +2600,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 		method write_expr_php_global target_expr =
 			match target_expr.eexpr with
 				| TField (_, FStatic (_, field)) -> self#write (field_name field)
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 		(**
 			Writes access to PHP class constant
 		*)
@@ -2608,7 +2608,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 			match target_expr.eexpr with
 				| TField (_, FStatic (ecls, field)) ->
 					self#write ((self#use_t (TInst (ecls, []))) ^ "::" ^ (field_name field))
-				| _ -> fail self#pos
+				| _ -> fail self#pos __LOC__
 		(**
 			Writes TNew to output buffer
 		*)
@@ -2649,7 +2649,7 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
 			in
 			if is_ternary then
 				match else_expr with
-					| None -> fail self#pos
+					| None -> fail self#pos __LOC__
 					| Some expr ->
 						self#write_expr_ternary condition if_expr expr self#pos
 			else begin
@@ -3179,7 +3179,7 @@ class enum_builder ctx (enm:tenum) =
 				match follow field.ef_type with
 					| TFun (args, _) -> args
 					| TEnum _ -> []
-					| _ -> fail field.ef_pos
+					| _ -> fail field.ef_pos __LOC__
 			in
 			writer#indent 1;
 			self#write_doc (DocMethod (args, TEnum (enm, []), (gen_doc_text_opt field.ef_doc)));
@@ -3250,7 +3250,7 @@ class enum_builder ctx (enm:tenum) =
 					let count = match follow field.ef_type with
 						| TFun (params, _) -> List.length params
 						| TEnum _ -> 0
-						| _ -> fail field.ef_pos
+						| _ -> fail field.ef_pos __LOC__
 					in
 					writer#write_line ("'" ^ name ^ "' => " ^ (string_of_int count) ^ ",")
 				)
@@ -3537,7 +3537,7 @@ class class_builder ctx (cls:tclass) =
 				writer#write_with_indentation (field_access ^ " = ");
 				(match field.cf_expr with
 					| Some expr -> writer#write_expr expr
-					| None -> fail field.cf_pos
+					| None -> fail field.cf_pos __LOC__
 				);
 				writer#write ";\n"
 			in
@@ -3628,7 +3628,7 @@ class class_builder ctx (cls:tclass) =
 		*)
 		method private write_const field =
 			match field.cf_expr with
-				| None -> fail writer#pos
+				| None -> fail writer#pos __LOC__
 				(* Do not generate a PHP constant of `inline var` field if expression is not compatible with PHP const *)
 				| Some expr when not (is_constant expr) -> ()
 				| Some expr ->
@@ -3661,7 +3661,7 @@ class class_builder ctx (cls:tclass) =
 					let name = if field.cf_name = "new" then "__construct" else (field_name field) in
 					self#write_method name fn is_static;
 					writer#write "\n"
-				| _ -> fail field.cf_pos
+				| _ -> fail field.cf_pos __LOC__
 		(**
 			Writes dynamic method to output buffer.
 			Only for non-static methods. Static methods are created as static vars in `__hx__init`.
@@ -3694,7 +3694,7 @@ class class_builder ctx (cls:tclass) =
 					writer#write_line "}";
 					(* Don't forget to create a field for default value *)
 					writer#write_statement ("protected $__hx__default__" ^ (field_name field))
-				| _ -> fail field.cf_pos
+				| _ -> fail field.cf_pos __LOC__
 			);
 		(**
 			Since PHP function names are case-insensitive we must check for method names clashes.
@@ -3810,7 +3810,7 @@ class generator (ctx:php_generator_context) =
 			self#generate_entry_point;
 			match polyfills_source_path, polyfills_dest_path with
 				| Some src, Some dst -> copy_file src dst
-				| _ -> fail null_pos
+				| _ -> fail null_pos __LOC__
 		(**
 			Generates calls to static __init__ methods in Boot.php
 		*)
@@ -3819,7 +3819,7 @@ class generator (ctx:php_generator_context) =
 				| [] -> ()
 				| _ ->
 					match boot with
-						| None -> fail null_pos
+						| None -> fail null_pos __LOC__
 						| Some (_, filename) ->
 							let channel = open_out_gen [Open_creat; Open_text; Open_append] 0o644 filename in
 							List.iter
@@ -3848,7 +3848,7 @@ class generator (ctx:php_generator_context) =
 					output_string channel "	}\n";
 					output_string channel ");\n";
 					(match boot with
-						| None -> fail null_pos
+						| None -> fail null_pos __LOC__
 						| Some (builder, filename) ->
 							let boot_class = get_full_type_name (add_php_prefix ctx builder#get_type_path) in
 							output_string channel (boot_class ^ "::__hx__init();\n")
@@ -3897,7 +3897,7 @@ let get_boot com : tclass =
 			| TClassDecl cls -> cls
 			| _ -> raise Not_found
 	with
-		| Not_found -> fail ~msg:"php.Boot not found" null_pos
+		| Not_found -> fail ~msg:"php.Boot not found" null_pos __LOC__
 
 (**
 	Entry point to Genphp7

+ 29 - 29
src/generators/genpy.ml

@@ -47,7 +47,7 @@ module Utils = struct
 		let ef = mk_static_field c cf p in
 		let tr = match follow ef.etype with
 			| TFun(args,tr) -> tr
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		in
 		mk (TCall(ef,el)) tr p
 
@@ -221,7 +221,7 @@ module Transformer = struct
 		let op = match unop with
 		| Increment -> OpAdd
 		| Decrement -> OpSub
-		| _ -> die ""
+		| _ -> die "" __LOC__
 		in
 		let one = mk (TConst(TInt(Int32.of_int(1)))) t p in
 
@@ -299,7 +299,7 @@ module Transformer = struct
 			let tf = { tf with tf_expr = { tf.tf_expr with eexpr = TBlock(List.rev el)}} in
 			{e with eexpr = TFunction tf}
 		| _ ->
-			die ""
+			die "" __LOC__
 
 	let rec transform_function tf ae is_value =
 		let p = tf.tf_expr.epos in
@@ -391,7 +391,7 @@ module Transformer = struct
 			let mk_eq e = mk (TBinop(OpEq,e1,e)) !t_bool (punion e1.epos e.epos) in
 			let cond = match val_reversed with
 				| [] ->
-					die ""
+					die "" __LOC__
 				| [e] ->
 					mk_eq e
 				| e :: el ->
@@ -420,7 +420,7 @@ module Transformer = struct
 				edef
 			| [],None ->
 				(* I don't think that can happen? *)
-				die ""
+				die "" __LOC__
 			| [case],_ ->
 				case_to_if case edef
 			| case :: cases,_ ->
@@ -463,10 +463,10 @@ module Transformer = struct
 			in
 			let cases = Hashtbl.fold (fun i el acc ->
 				let eint = mk (TConst (TInt (Int32.of_int i))) !t_int e1.epos in
-				let fs = match List.fold_left (fun eacc ec -> Some (mk_if ec eacc)) edef !el with Some e -> e | None -> die "" in
+				let fs = match List.fold_left (fun eacc ec -> Some (mk_if ec eacc)) edef !el with Some e -> e | None -> die "" __LOC__ in
 				([eint],fs) :: acc
 			) length_map [] in
-			let c_string = match !t_string with TInst(c,_) -> c | _ -> die "" in
+			let c_string = match !t_string with TInst(c,_) -> c | _ -> die "" __LOC__ in
 			let cf_length = PMap.find "length" c_string.cl_fields in
 			let ef = mk (TField(e1,FInstance(c_string,[],cf_length))) !t_int e1.epos in
 			let res_var = alloc_var (ae.a_next_id()) ef.etype ef.epos in
@@ -552,7 +552,7 @@ module Transformer = struct
 					transform_exprs_to_block block ae.a_expr.etype false ae.a_expr.epos ae.a_next_id
 			| _ ->
 				debug_expr e1_.a_expr;
-				die ""
+				die "" __LOC__
 
 	and var_to_treturn_expr ?(capture = false) n t p =
 		let x = mk (TLocal (to_tvar ~capture:capture n t p)) t p in
@@ -576,17 +576,17 @@ module Transformer = struct
 		in
 		let def =
 			(let ex = match exprs with
-			| [] -> die ""
+			| [] -> die "" __LOC__
 			| [x] ->
 				(let exs = convert_return_expr x in
 				match exs with
-				| [] -> die ""
+				| [] -> die "" __LOC__
 				| [x] -> x
 				| x ->
 					match List.rev x with
 					| x::xs ->
 						mk (TBlock exs) x.etype base.a_expr.epos
-					| _ -> die "")
+					| _ -> die "" __LOC__)
 
 			| x ->
 				match List.rev x with
@@ -597,8 +597,8 @@ module Transformer = struct
 					match List.rev block with
 					| x::_ ->
 						mk (TBlock block) x.etype base.a_expr.epos
-					| _ -> die "")
-				| _ -> die ""
+					| _ -> die "" __LOC__)
+				| _ -> die "" __LOC__
 			in
 			let f1 = { tf_args = []; tf_type = TFun([],ex.etype); tf_expr = ex} in
 			let fexpr = mk (TFunction f1) ex.etype ex.epos in
@@ -653,7 +653,7 @@ module Transformer = struct
 				| e :: el ->
 					List.rev ((mk (TReturn (Some e)) t_dynamic e.epos) :: el),e.etype
 				| [] ->
-					die ""
+					die "" __LOC__
 			in
 			let my_block = transform_exprs_to_block block tr false ae.a_expr.epos ae.a_next_id in
 			let fn = mk (TFunction {
@@ -861,7 +861,7 @@ module Transformer = struct
 			let op = match unop with
 			| Increment -> OpAdd
 			| Decrement -> OpSub
-			| _ -> die "" in
+			| _ -> die "" __LOC__ in
 			transform_op_assign_op ae e op one is_value is_postfix
 		| (_, TUnop(op, Prefix, e)) ->
 			let e1 = trans true [] e in
@@ -954,7 +954,7 @@ module Transformer = struct
 			let r = { a_expr with eexpr = TArrayDecl exprs } in
 			lift_expr ae.a_next_id ~blocks:blocks r
 		| (is_value, TCast(e1,Some mt)) ->
-			let e = Codegen.default_cast ~vtmp:(ae.a_next_id()) (match !como with Some com -> com | None -> die "") e1 mt ae.a_expr.etype ae.a_expr.epos in
+			let e = Codegen.default_cast ~vtmp:(ae.a_next_id()) (match !como with Some com -> com | None -> die "" __LOC__) e1 mt ae.a_expr.etype ae.a_expr.epos in
 			transform_expr ae.a_next_id ~is_value:is_value e
 		| (is_value, TCast(e,None)) ->
 			let e = trans is_value [] e in
@@ -972,7 +972,7 @@ module Transformer = struct
 
 		| ( _, TConst _ ) -> lift_expr ae.a_next_id a_expr
 		| ( _, TTypeExpr _ ) -> lift_expr ae.a_next_id a_expr
-		| ( _, TUnop _ ) -> die ""
+		| ( _, TUnop _ ) -> die "" __LOC__
 		| ( true, TWhile(econd, ebody, DoWhile) ) ->
 			let new_expr = trans false [] a_expr in
 			let f = exprs_to_func (new_expr.a_blocks @ [new_expr.a_expr]) (ae.a_next_id()) ae in
@@ -1054,7 +1054,7 @@ module Printer = struct
 		KeywordHandler.handle_keywords s
 
 	let print_unop = function
-		| Increment | Decrement -> die ""
+		| Increment | Decrement -> die "" __LOC__
 		| Not -> "not "
 		| Neg -> "-";
 		| NegBits -> "~"
@@ -1080,7 +1080,7 @@ module Printer = struct
 		| OpShr -> ">>"
 		| OpUShr -> ">>"
 		| OpMod -> "%"
-		| OpInterval | OpArrow | OpIn | OpAssignOp _ -> die ""
+		| OpInterval | OpArrow | OpIn | OpAssignOp _ -> die "" __LOC__
 
 	let print_string s =
 		Printf.sprintf "\"%s\"" (StringHelper.s_escape s)
@@ -1247,10 +1247,10 @@ module Printer = struct
 							| "string" -> Printf.sprintf "Std._hx_is(%s, str)" (print_expr pctx e1)
 							| "boolean" -> Printf.sprintf "Std._hx_is(%s, bool)" (print_expr pctx e1)
 							| "number" -> Printf.sprintf "Std._hx_is(%s, float)" (print_expr pctx e1)
-							| _ -> die ""
+							| _ -> die "" __LOC__
 						end
 					| _ ->
-						die ""
+						die "" __LOC__
 				end
 			| TBinop(OpEq,e1,({eexpr = TConst TNull} as e2)) ->
 				Printf.sprintf "(%s is %s)" (print_expr pctx e1) (print_expr pctx e2)
@@ -1260,7 +1260,7 @@ module Printer = struct
 				let ops = match op with
 					| OpEq -> "is", "==", "HxOverrides.eq"
 					| OpNotEq -> "is not", "!=", "not HxOverrides.eq"
-					| _ -> die ""
+					| _ -> die "" __LOC__
 				in
 				let third (_,_,x) = x in
 				let fst (x,_,_) = x in
@@ -1403,7 +1403,7 @@ module Printer = struct
 			| TIdent s ->
 				s
 			| TSwitch _ | TCast(_, Some _) | TFor _ | TUnop(_,Postfix,_) ->
-				die ""
+				die "" __LOC__
 
 	and print_if_else pctx econd eif eelse as_elif =
 		let econd1 = match econd.eexpr with
@@ -1515,7 +1515,7 @@ module Printer = struct
 					| {eexpr = TObjectDecl fields} :: el ->
 						List.rev el,fields
 					| _ ->
-						die ""
+						die "" __LOC__
 				in
 				begin match res with
 					| e1 :: [] ->
@@ -1607,7 +1607,7 @@ module Printer = struct
 			| TField(_, (FStatic({cl_path = ["python"; "_KwArgs"], "KwArgs_Impl_"},{ cf_name="fromT" }))), [e2]  ->
 				let t = match follow call_expr.etype with
 				| TAbstract(_, [t]) -> t
-				| _ -> die ""
+				| _ -> die "" __LOC__
 				in
 				let native_fields = get_native_fields t in
 				if PMap.is_empty native_fields then
@@ -1836,7 +1836,7 @@ module Generator = struct
 						let call_f = mk (TCall(f_name,[])) e_last.etype e_last.epos in
 						Some new_block,call_f
 					| _ ->
-						die ""
+						die "" __LOC__
 				end
 			| _ ->
 				None,expr2
@@ -1928,7 +1928,7 @@ module Generator = struct
 				newline ctx;
 				gen_func_expr ctx ef c "__init__" py_metas true "    " false cf.cf_pos
 			| _ ->
-				die ""
+				die "" __LOC__
 		end
 
 	let gen_class_field ctx c p cf =
@@ -2002,7 +2002,7 @@ module Generator = struct
 			has_static_methods := true;
 			let field = handle_keywords cf.cf_name in
 			let py_metas = filter_py_metas cf.cf_meta in
-			let e = match cf.cf_expr with Some e -> e | _ -> die "" in
+			let e = match cf.cf_expr with Some e -> e | _ -> die "" __LOC__ in
 			newline ctx;
 			gen_func_expr ctx e c field py_metas false "    " true cf.cf_pos;
 		) methods;
@@ -2213,7 +2213,7 @@ module Generator = struct
 				newline ctx;
 				print ctx "    @staticmethod\n    def %s(%s):\n" f param_str;
 				print ctx "        return %s(\"%s\", %i, (%s))" p ef.ef_name ef.ef_index args_str;
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		) param_constructors;
 
 		List.iter (fun ef ->

+ 7 - 7
src/generators/genshared.ml

@@ -130,7 +130,7 @@ let pfm_of_typedef td = match follow td.t_type with
 		pfm_fields = an.a_fields;
 	}
 	| _ ->
-		die ""
+		die "" __LOC__
 
 exception Typedef_result of path_field_mapping
 
@@ -302,7 +302,7 @@ class ['a] preprocessor (basic : basic_types) (convert : Type.t -> 'a) =
 		let find_super_ctor el =
 			let csup,map_type = match c.cl_super with
 				| Some(c,tl) -> c,apply_params c.cl_params tl
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			in
 			match find_overload_rec' true map_type csup "new" el with
 			| Some(c,cf,_) ->
@@ -312,7 +312,7 @@ class ['a] preprocessor (basic : basic_types) (convert : Type.t -> 'a) =
 						| Some(c',_) ->
 							self#add_implicit_ctor csup c' cf;
 							loop c'
-						| None -> die ""
+						| None -> die "" __LOC__
 					end
 				in
 				loop csup;
@@ -324,7 +324,7 @@ class ['a] preprocessor (basic : basic_types) (convert : Type.t -> 'a) =
 			(* This is a bit hacky: We always want the direct super class, not the one that actually holds
 			   the ctor. It will be implicitly copied to it anyway. *)
 			match c.cl_super with
-			| None -> die ""
+			| None -> die "" __LOC__
 			| Some(c,_) -> c,cf
 		in
 		let rec promote_this_before_super c cf = match self#get_field_info cf.cf_meta with
@@ -370,18 +370,18 @@ class ['a] preprocessor (basic : basic_types) (convert : Type.t -> 'a) =
 		| fields ->
 			let csup,map_type = match c.cl_super with
 				| Some(c,tl) -> c,apply_params c.cl_params tl
-				| None -> die ""
+				| None -> die "" __LOC__
 			in
 			let fix_covariant_return cf =
 				let tl = match follow cf.cf_type with
 					| TFun(tl,_) -> tl
-					| _ -> die ""
+					| _ -> die "" __LOC__
 				in
 				match find_overload_rec' false map_type csup cf.cf_name (List.map (fun (_,_,t) -> Texpr.Builder.make_null t null_pos) tl) with
 				| Some(_,cf',_) ->
 					let tr = match follow cf'.cf_type with
 						| TFun(_,tr) -> tr
-						| _ -> die ""
+						| _ -> die "" __LOC__
 					in
 					cf.cf_type <- TFun(tl,tr);
 					cf.cf_expr <- begin match cf.cf_expr with

+ 25 - 25
src/generators/genswf9.ml

@@ -288,7 +288,7 @@ let classify ctx t =
 	| TDynamic _ ->
 		KDynamic
 	| TLazy _ ->
-		die ""
+		die "" __LOC__
 
 (* some field identifiers might cause issues with SWC *)
 let reserved i =
@@ -317,7 +317,7 @@ let ns_access cf =
 			Some (HMName (cf.cf_name, HNNamespace ns))
 		| [(EConst (String(ns,_)),_); (EConst (Ident "internal"),_)] ->
 			Some (HMName (cf.cf_name, HNInternal (Some ns)))
-		| _ -> die ""
+		| _ -> die "" __LOC__
 	with Not_found ->
 		None
 
@@ -447,7 +447,7 @@ let coerce ctx t =
 		| KBool -> HToBool
 		| KType t -> HCast t
 		| KDynamic -> HAsAny
-		| KNone -> die ""
+		| KNone -> die "" __LOC__
 	)
 
 let set_reg ctx r =
@@ -477,7 +477,7 @@ let pop ctx n =
 			loop (n - 1)
 		end
 	in
-	if n < 0 then die "";
+	if n < 0 then die "" __LOC__;
 	let old = ctx.infos.istack in
 	loop n;
 	ctx.infos.istack <- old
@@ -542,7 +542,7 @@ let rec setvar ctx (acc : write access) kret =
 		else
 			set_reg ctx r;
 	| VGlobal _ | VId _ | VCast _ | VArray | VScope _ | VSuper _ when kret <> None ->
-		let r = alloc_reg ctx (match kret with None -> die "" | Some k -> k) in
+		let r = alloc_reg ctx (match kret with None -> die "" __LOC__ | Some k -> k) in
 		set_reg_dup ctx r;
 		setvar ctx acc None;
 		write ctx (HReg r.rid);
@@ -598,7 +598,7 @@ let open_block ctx retval =
 	let old_regs = DynArray.map (fun r -> r.rused) ctx.infos.iregs in
 	let old_locals = ctx.locals in
 	(fun() ->
-		if ctx.infos.istack <> old_stack + (if retval then 1 else 0) then die "";
+		if ctx.infos.istack <> old_stack + (if retval then 1 else 0) then die "" __LOC__;
 		let rcount = DynArray.length old_regs + 1 in
 		DynArray.iter (fun r ->
 			if r.rid < rcount then
@@ -683,7 +683,7 @@ let gen_constant ctx c t p =
 	| TThis ->
 		write ctx HThis
 	| TSuper ->
-		die ""
+		die "" __LOC__
 
 let end_fun ctx args dparams tret =
 	{
@@ -702,7 +702,7 @@ let end_fun ctx args dparams tret =
 		hlmt_function = None;
 	}
 
-let gen_expr_ref = ref (fun _ _ _ -> die "")
+let gen_expr_ref = ref (fun _ _ _ -> die "" __LOC__)
 let gen_expr ctx e retval = (!gen_expr_ref) ctx e retval
 
 let begin_fun ctx args tret el stat p =
@@ -746,7 +746,7 @@ let begin_fun ctx args tret el stat p =
 			| TConst (TFloat s) -> HVFloat (float_of_string s)
 			| TConst (TBool b) -> HVBool b
 			| TConst TNull -> abort ("In Flash9, null can't be used as basic type " ^ s_type (print_context()) t) p
-			| _ -> die "")
+			| _ -> die "" __LOC__)
 		| _, Some {eexpr = TConst TNull} -> HVNone
 		| k, Some c ->
 			write ctx (HReg r.rid);
@@ -882,7 +882,7 @@ let begin_loop ctx =
 	ctx.breaks <- [];
 	ctx.continues <- [];
 	(fun cont_pos ->
-		if ctx.infos.istack <> ctx.infos.iloop then die "";
+		if ctx.infos.istack <> ctx.infos.iloop then die "" __LOC__;
 		List.iter (fun j -> j()) ctx.breaks;
 		List.iter (fun j -> j cont_pos) ctx.continues;
 		ctx.infos.iloop <- old_loop;
@@ -1195,7 +1195,7 @@ let rec gen_expr_content ctx retval e =
 					write ctx HScope);
 				(* store the exception into local var, using a tmp register if needed *)
 				define_local ctx v e.epos;
-				let r = (match snd (try PMap.find v.v_id ctx.locals with Not_found -> die "") with
+				let r = (match snd (try PMap.find v.v_id ctx.locals with Not_found -> die "" __LOC__) with
 					| LReg _ -> None
 					| _ ->
 						let r = alloc_reg ctx (classify ctx t) in
@@ -1318,7 +1318,7 @@ let rec gen_expr_content ctx retval e =
 			(!prev)();
 			let rec loop = function
 				| [] ->
-					die ""
+					die "" __LOC__
 				| [v] ->
 					write ctx (HReg r.rid);
 					gen_expr ctx true v;
@@ -1372,7 +1372,7 @@ let rec gen_expr_content ctx retval e =
 				(* manual cast *)
 				let tid = (match gen_access ctx (mk (TTypeExpr t) t_dynamic e.epos) Read with
 					| VGlobal id -> id
-					| _ -> die ""
+					| _ -> die "" __LOC__
 				) in
 				match classify ctx e.etype with
 				| KType n when (match n with HMPath ([],"String") -> false | _ -> true) ->
@@ -1504,7 +1504,7 @@ and gen_call ctx retval e el r =
 			| 2l -> A3OMemSet32
 			| 3l -> A3OMemSetFloat
 			| 4l -> A3OMemSetDouble
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		))
 	| TIdent "__vmem_get__", [{ eexpr = TConst (TInt code) };e] ->
 		gen_expr ctx true e;
@@ -1514,7 +1514,7 @@ and gen_call ctx retval e el r =
 			| 2l -> A3OMemGet32
 			| 3l -> A3OMemGetFloat
 			| 4l -> A3OMemGetDouble
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		))
 	| TIdent "__vmem_sign__", [{ eexpr = TConst (TInt code) };e] ->
 		gen_expr ctx true e;
@@ -1522,10 +1522,10 @@ and gen_call ctx retval e el r =
 			| 0l -> A3OSign1
 			| 1l -> A3OSign8
 			| 2l -> A3OSign16
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		))
 	| TIdent "__vector__", [] ->
-		let t = match r with TAbstract ({a_path = [],"Class"}, [vt]) -> vt | _ -> die "" in
+		let t = match r with TAbstract ({a_path = [],"Class"}, [vt]) -> vt | _ -> die "" __LOC__ in
 		gen_type ctx (type_id ctx t)
 	| TIdent "__vector__", [ep] ->
 		gen_type ctx (type_id ctx r);
@@ -1538,7 +1538,7 @@ and gen_call ctx retval e el r =
 			write ctx (HFindPropStrict id);
 			List.iter (gen_expr ctx true) el;
 			write ctx (HCallProperty (id,List.length el));
-		| _ -> die "")
+		| _ -> die "" __LOC__)
 	| TConst TSuper , _ ->
 		write ctx HThis;
 		List.iter (gen_expr ctx true) el;
@@ -1699,7 +1699,7 @@ and gen_binop ctx retval op e1 e2 t p =
 			| OpShr -> A3OShr
 			| OpUShr -> A3OUShr
 			| OpMod -> A3OMod
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		) in
 		match iop with
 		| Some iop ->
@@ -1729,7 +1729,7 @@ and gen_binop ctx retval op e1 e2 t p =
 		| None ->
 			gen_op A3OEq
 		| Some c ->
-			let f = FStatic (c,try PMap.find "compare" c.cl_statics with Not_found -> die "") in
+			let f = FStatic (c,try PMap.find "compare" c.cl_statics with Not_found -> die "" __LOC__) in
 			gen_expr ctx true (mk (TCall (mk (TField (mk (TTypeExpr (TClassDecl c)) t_dynamic p,f)) t_dynamic p,[e1;e2])) ctx.com.basic.tbool p);
 	in
 	match op with
@@ -1782,7 +1782,7 @@ and gen_binop ctx retval op e1 e2 t p =
 	| OpLte ->
 		gen_op A3OLte
 	| OpInterval | OpArrow | OpIn ->
-		die ""
+		die "" __LOC__
 
 and gen_expr ctx retval e =
 	let old = ctx.infos.istack in
@@ -2398,7 +2398,7 @@ let realize_required_accessors ctx cl =
 					end
 				end;
 			end
-		| _ -> die ""
+		| _ -> die "" __LOC__
 	) interface_props;
 	!fields
 
@@ -2427,7 +2427,7 @@ let generate_class ctx c =
 				check_constructor ctx c fdata;
 				old();
 				m
-			| _ -> die ""
+			| _ -> die "" __LOC__
 	) in
 	let has_protected = ref None in
 	let make_name f stat =
@@ -2568,7 +2568,7 @@ let generate_class ctx c =
 		match generate_field_kind ctx f c true with
 		| None -> acc
 		| Some k ->
-			let count = (match k with HFMethod _ -> st_meth_count | HFVar _ -> st_field_count | _ -> die "") in
+			let count = (match k with HFMethod _ -> st_meth_count | HFVar _ -> st_field_count | _ -> die "" __LOC__) in
 			incr count;
 			{
 				hlf_name = make_name f true;
@@ -2784,7 +2784,7 @@ let generate_resource ctx name =
 	let t = TClassDecl c in
 	match generate_type ctx t with
 	| Some (m,f) -> (t,m,f)
-	| None -> die ""
+	| None -> die "" __LOC__
 
 let generate com boot_name =
 	let ctx = {

+ 24 - 24
src/generators/hl2c.ml

@@ -223,7 +223,7 @@ let hash ctx sid =
 		h
 
 let type_name ctx t =
-	try PMap.find t ctx.htypes with Not_found -> Globals.die ""
+	try PMap.find t ctx.htypes with Not_found -> Globals.die "" __LOC__
 
 let define ctx s =
 	if not (Hashtbl.mem ctx.hdefines s) then begin
@@ -241,7 +241,7 @@ let rec define_type ctx t =
 		define_type ctx ret
 	| HEnum _ | HObj _ | HStruct _ when not (PMap.exists t ctx.defined_types) ->
 		ctx.defined_types <- PMap.add t () ctx.defined_types;
-		define ctx (sprintf "#include <%s.h>" (try PMap.find t ctx.type_module with Not_found -> Globals.die "").m_name)
+		define ctx (sprintf "#include <%s.h>" (try PMap.find t ctx.type_module with Not_found -> Globals.die "" __LOC__).m_name)
 	| HVirtual vp when not (PMap.exists t ctx.defined_types) ->
 		ctx.defined_types <- PMap.add t () ctx.defined_types;
 		Array.iter (fun (_,_,t) -> define_type ctx t) vp.vfields
@@ -260,7 +260,7 @@ let enum_constr_type ctx e i =
 		"venum"
 	else
 	let name = if e.eid = 0 then
-		let name = (try PMap.find (HEnum e) ctx.htypes with Not_found -> Globals.die "") in
+		let name = (try PMap.find (HEnum e) ctx.htypes with Not_found -> Globals.die "" __LOC__) in
 		"Enum" ^ name
 	else
 		String.concat "_" (ExtString.String.nsplit e.ename ".")
@@ -548,7 +548,7 @@ let generate_function ctx f =
 		if t = HVoid then "" else
 		let assign = reg r ^ " = " in
 		if tsame t rt then assign else
-		if not (safe_cast t rt) then Globals.die ""
+		if not (safe_cast t rt) then Globals.die "" __LOC__
 		else assign ^ "(" ^ ctype rt ^ ")"
 	in
 
@@ -593,7 +593,7 @@ let generate_function ctx f =
 	in
 
 	let mcall r fid = function
-		| [] -> Globals.die ""
+		| [] -> Globals.die "" __LOC__
 		| o :: args ->
 			match rtype o with
 			| HObj _ | HStruct _ ->
@@ -620,7 +620,7 @@ let generate_function ctx f =
 				unblock();
 				sline "}"
 			| _ ->
-				Globals.die ""
+				Globals.die "" __LOC__
 	in
 
 	let set_field obj fid v =
@@ -633,7 +633,7 @@ let generate_function ctx f =
 			let dset = sprintf "hl_dyn_set%s(%s->value,%ld/*%s*/%s,%s)" (dyn_prefix t) (reg obj) (hash ctx nid) name (type_value_opt (rtype v)) (reg v) in
 			sexpr "if( hl_vfields(%s)[%d] ) *(%s*)(hl_vfields(%s)[%d]) = (%s)%s; else %s" (reg obj) fid (ctype t) (reg obj) fid (ctype t) (reg v) dset
 		| _ ->
-			Globals.die ""
+			Globals.die "" __LOC__
 	in
 
 	let get_field r obj fid =
@@ -646,7 +646,7 @@ let generate_function ctx f =
 			let dget = sprintf "(%s)hl_dyn_get%s(%s->value,%ld/*%s*/%s)" (ctype t) (dyn_prefix t) (reg obj) (hash ctx nid) name (type_value_opt t) in
 			sexpr "%shl_vfields(%s)[%d] ? (*(%s*)(hl_vfields(%s)[%d])) : %s" (rassign r t) (reg obj) fid (ctype t) (reg obj) fid dget
 		| _ ->
-			Globals.die ""
+			Globals.die "" __LOC__
 	in
 
 	let fret = (match f.ftype with
@@ -654,7 +654,7 @@ let generate_function ctx f =
 		sline "%s %s(%s) {" (ctype t) (funname f.findex) (String.concat "," (List.map (fun t -> incr rid; var_type (reg !rid) t) args));
 		t
 	| _ ->
-		Globals.die ""
+		Globals.die "" __LOC__
 	) in
 	block();
 	let var_map = Hashtbl.create 0 in
@@ -770,7 +770,7 @@ let generate_function ctx f =
 				else if op = CNeq then
 					sexpr "if( %s != %s && (!%s || !%s || !%s->value || !%s->value || %s->value != %s->value) ) goto %s" (reg a) (reg b) (reg a) (reg b) (reg a) (reg b) (reg a) (reg b) (label d)
 				else
-					Globals.die ""
+					Globals.die "" __LOC__
 			| HEnum _, HEnum _ | HDynObj, HDynObj | HAbstract _, HAbstract _ ->
 				phys_compare()
 			| HVirtual _, HObj _->
@@ -779,7 +779,7 @@ let generate_function ctx f =
 				else if op = CNeq then
 					sexpr "if( %s ? (%s == NULL || %s->value != (vdynamic*)%s) : (%s != NULL) ) goto %s" (reg a) (reg b) (reg a) (reg b) (reg b) (label d)
 				else
-					Globals.die ""
+					Globals.die "" __LOC__
 			| HObj _, HVirtual _ ->
 				compare_op op b a d
 			| ta, tb ->
@@ -828,7 +828,7 @@ let generate_function ctx f =
 			| HF64 ->
 				sexpr "%s = fmod(%s,%s)" (reg r) (reg a) (reg b)
 			| _ ->
-				Globals.die "")
+				Globals.die "" __LOC__)
 		| OUMod (r,a,b) ->
 			sexpr "%s = %s == 0 ? 0 : ((unsigned)%s) %% ((unsigned)%s)" (reg r) (reg b) (reg a) (reg b)
 		| OShl (r,a,b) ->
@@ -875,7 +875,7 @@ let generate_function ctx f =
 				let sargs = String.concat "," (List.map2 rcast pl args) in
 				sexpr "%s%s->hasValue ? %s((vdynamic*)%s->value%s) : %s(%s)" (rassign r ret) (reg cl) (rfun cl (HDyn :: args) ret) (reg cl) (if sargs = "" then "" else "," ^ sargs) (rfun cl args ret) sargs
 			| _ ->
-				Globals.die "")
+				Globals.die "" __LOC__)
 		| OStaticClosure (r,fid) ->
 			sexpr "%s = &cl$%d" (reg r) (!cl_id);
 			incr cl_id
@@ -960,7 +960,7 @@ let generate_function ctx f =
 			| HObj o | HStruct o -> sexpr "%s = (%s)hl_alloc_obj(%s)" (reg r) (tname o.pname) (type_value (rtype r))
 			| HDynObj -> sexpr "%s = hl_alloc_dynobj()" (reg r)
 			| HVirtual _ as t -> sexpr "%s = hl_alloc_virtual(%s)" (reg r) (type_value t)
-			| _ -> Globals.die "")
+			| _ -> Globals.die "" __LOC__)
 		| OField (r,obj,fid) ->
 			get_field r obj fid
 		| OSetField (obj,fid,v) ->
@@ -1022,7 +1022,7 @@ let generate_function ctx f =
 			let h = hash ctx sid in
 			sexpr "hl_dyn_set%s((vdynamic*)%s,%ld/*%s*/%s,%s)" (dyn_prefix (rtype v)) (reg o) h code.strings.(sid) (type_value_opt (rtype v)) (reg v)
 		| OMakeEnum (r,cid,rl) ->
-			let e, et = (match rtype r with HEnum e -> e, enum_constr_type ctx e cid | _ -> Globals.die "") in
+			let e, et = (match rtype r with HEnum e -> e, enum_constr_type ctx e cid | _ -> Globals.die "" __LOC__) in
 			let need_tmp = List.mem r rl in
 			let tmp = if not need_tmp then reg r else begin
 				sexpr "{ venum *tmp";
@@ -1039,10 +1039,10 @@ let generate_function ctx f =
 		| OEnumIndex (r,v) ->
 			sexpr "%s = HL__ENUM_INDEX__(%s)" (reg r) (reg v)
 		| OEnumField (r,e,cid,pid) ->
-			let tname,(_,_,tl) = (match rtype e with HEnum e -> enum_constr_type ctx e cid, e.efields.(cid) | _ -> Globals.die "") in
+			let tname,(_,_,tl) = (match rtype e with HEnum e -> enum_constr_type ctx e cid, e.efields.(cid) | _ -> Globals.die "" __LOC__) in
 			sexpr "%s((%s*)%s)->p%d" (rassign r tl.(pid)) tname (reg e) pid
 		| OSetEnumField (e,pid,r) ->
-			let tname, (_,_,tl) = (match rtype e with HEnum e -> enum_constr_type ctx e 0, e.efields.(0) | _ -> Globals.die "") in
+			let tname, (_,_,tl) = (match rtype e with HEnum e -> enum_constr_type ctx e 0, e.efields.(0) | _ -> Globals.die "" __LOC__) in
 			sexpr "((%s*)%s)->p%d = (%s)%s" tname (reg e) pid (ctype tl.(pid)) (reg r)
 		| OSwitch (r,idx,eend) ->
 			sline "switch(%s) {" (reg r);
@@ -1074,7 +1074,7 @@ let generate_function ctx f =
 			| HArray ->
 				sexpr "%s = (%s)hl_aptr(%s,void*)" (reg r) (ctype (rtype r)) (reg d)
 			| _ ->
-				Globals.die "")
+				Globals.die "" __LOC__)
 		| ORefOffset (r,r2,off) ->
 			sexpr "%s = %s + %s" (reg r) (reg r2) (reg off)
 		| ONop _ ->
@@ -1192,7 +1192,7 @@ let make_function_table code =
 			ft.fe_args <- args;
 			ft.fe_ret <- t
 		| _ ->
-			Globals.die ""
+			Globals.die "" __LOC__
 	) code.natives;
 	Array.iter (fun f ->
 		let fname = String.concat "_" (ExtString.String.nsplit (fundecl_name f) ".") in
@@ -1203,7 +1203,7 @@ let make_function_table code =
 			ft.fe_args <- args;
 			ft.fe_ret <- t;
 		| _ ->
-			Globals.die "");
+			Globals.die "" __LOC__);
 		ft.fe_decl <- Some f;
 		Array.iter (fun op ->
 			match op with
@@ -1244,7 +1244,7 @@ let make_modules ctx all_types =
 	in
 	let add m fid =
 		let f = ctx.ftable.(fid) in
-		if f.fe_module <> None then Globals.die "";
+		if f.fe_module <> None then Globals.die "" __LOC__;
 		f.fe_module <- Some m;
 		m.m_functions <- f :: m.m_functions;
 	in
@@ -1307,7 +1307,7 @@ let make_modules ctx all_types =
 	) !all_modules;
 	let contexts = ref PMap.empty in
 	Array.iter (fun f ->
-		if f.fe_module = None && ExtString.String.starts_with f.fe_name "fun$" then f.fe_name <- "wrap" ^ type_name ctx (match f.fe_decl with None -> Globals.die "" | Some f -> f.ftype);
+		if f.fe_module = None && ExtString.String.starts_with f.fe_name "fun$" then f.fe_name <- "wrap" ^ type_name ctx (match f.fe_decl with None -> Globals.die "" __LOC__ | Some f -> f.ftype);
 		(* assign context to function module *)
 		match f.fe_args with
 		| (HEnum e) as t :: _ when e.ename = "" ->
@@ -1480,14 +1480,14 @@ let write_c com file (code:code) gnames =
 			| HBytes ->
 				"(vbyte*)" ^ string ctx idx
 			| _ ->
-				Globals.die ""
+				Globals.die "" __LOC__
 		in
 		let fields = match t with
 			| HObj o | HStruct o ->
 				let fields = List.map2 field_value (List.map (fun (_,_,t) -> t) (Array.to_list o.pfields)) (Array.to_list fields) in
 				if is_struct t then fields else type_value ctx t :: fields
 			| _ ->
-				Globals.die ""
+				Globals.die "" __LOC__
 		in
 		sexpr "static struct _%s %s = {%s}" (ctype t) name (String.concat "," fields);
 	) code.constants;

+ 1 - 1
src/generators/hlcode.ml

@@ -416,7 +416,7 @@ let gather_types (code:code) =
 	DynArray.to_array arr, !types
 
 let lookup_type types t =
-	try PMap.find t types with Not_found -> Globals.die ""
+	try PMap.find t types with Not_found -> Globals.die "" __LOC__
 
 (* --------------------------------------------------------------------------------------------------------------------- *)
 (* DUMP *)

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 167 - 167
src/generators/hlinterp.ml


+ 8 - 8
src/generators/hlopt.ml

@@ -508,7 +508,7 @@ let remap_fun ctx f dump get_str old_code =
 	let reg_remap = ctx.r_used_regs <> nregs in
 	let assigns = ref f.assigns in
 	let write str = match dump with None -> () | Some ch -> IO.nwrite ch (Bytes.unsafe_of_string (str ^ "\n")) in
-	let nargs = (match f.ftype with HFun (args,_) -> List.length args | _ -> Globals.die "") in
+	let nargs = (match f.ftype with HFun (args,_) -> List.length args | _ -> Globals.die "" __LOC__) in
 
 	let live_bits = ctx.r_live_bits in
 	let reg_map = ctx.r_reg_map in
@@ -550,7 +550,7 @@ let remap_fun ctx f dump get_str old_code =
 							if bp.bstart > b.bstart then acc else
 							try
 								let wp = PMap.find reg bp.bwrite in
-								if wp > p then Globals.die "";
+								if wp > p then Globals.die "" __LOC__;
 								loop wp @ acc
 							with Not_found ->
 								gather bp @ acc
@@ -682,7 +682,7 @@ let remap_fun ctx f dump get_str old_code =
 			| OJAlways d -> OJAlways (pos d)
 			| OSwitch (r,cases,send) -> OSwitch (r, Array.map pos cases, pos send)
 			| OTrap (r,d) -> OTrap (r,pos d)
-			| _ -> Globals.die "")
+			| _ -> Globals.die "" __LOC__)
 		) !jumps;
 
 		let assigns = !assigns in
@@ -726,7 +726,7 @@ let _optimize (f:fundecl) =
 	let set_live r min max =
 		let offset = r / bit_regs in
 		let mask = 1 lsl (r - offset * bit_regs) in
-		if min < 0 || max >= Array.length f.code then Globals.die "";
+		if min < 0 || max >= Array.length f.code then Globals.die "" __LOC__;
 		for i=min to max do
 			let p = i * stride + offset in
 			Array.unsafe_set live_bits p ((Array.unsafe_get live_bits p) lor mask);
@@ -764,7 +764,7 @@ let _optimize (f:fundecl) =
 		| b2 :: l ->
 			let s = get_state b2 in
 			let s = (match b2.bnext with
-			| [] -> Globals.die ""
+			| [] -> Globals.die "" __LOC__
 			| [_] -> s (* reuse *)
 			| _ :: l ->
 				let s2 = empty_state() in
@@ -964,7 +964,7 @@ let _optimize (f:fundecl) =
 
 	let used_regs = ref 0 in
 	let reg_map = read_counts in
-	let nargs = (match f.ftype with HFun (args,_) -> List.length args | _ -> Globals.die "") in
+	let nargs = (match f.ftype with HFun (args,_) -> List.length args | _ -> Globals.die "" __LOC__) in
 	for i=0 to nregs-1 do
 		if read_counts.(i) > 0 || write_counts.(i) > 0 || i < nargs then begin
 			reg_map.(i) <- !used_regs;
@@ -997,7 +997,7 @@ let optimize dump get_str (f:fundecl) (hxf:Type.tfunc) =
 	try
 		let c = PMap.find hxf (!opt_cache) in
 		c.c_last_used <- !used_mark;
-		if Array.length f.code <> Array.length c.c_code then Globals.die "";
+		if Array.length f.code <> Array.length c.c_code then Globals.die "" __LOC__;
 		let code = c.c_code in
 		Array.iter (fun i ->
 			let op = (match Array.unsafe_get code i, Array.unsafe_get f.code i with
@@ -1018,7 +1018,7 @@ let optimize dump get_str (f:fundecl) (hxf:Type.tfunc) =
 			| ODynGet (r,o,_), ODynGet (_,_,idx) -> ODynGet (r,o,idx)
 			| ODynSet (o,_,v), ODynSet (_,idx,_) -> ODynSet (o,idx,v)
 			| OType (r,_), OType (_,t) -> OType (r,t)
-			| _ -> Globals.die "") in
+			| _ -> Globals.die "" __LOC__) in
 			Array.unsafe_set code i op
 		) c.c_remap_indexes;
 		remap_fun c.c_rctx { f with code = code } dump get_str old_code

+ 3 - 3
src/generators/jvm/jvmCode.ml

@@ -147,7 +147,7 @@ class builder pool = object(self)
 				stack#pop
 			with EmptyStack ->
 				self#stack_error opcode expect cur;
-				Globals.die ""
+				Globals.die "" __LOC__
 			in
 			(* TODO: some unification or something? *)
 			match js,js' with
@@ -173,7 +173,7 @@ class builder pool = object(self)
 	method op_maybe_wide op opw i tl tr = match get_numeric_range_unsigned i with
 		| Int8Range -> self#op op 2 tl tr
 		| Int16Range -> self#op (OpWide opw) 4 tl tr
-		| Int32Range -> Globals.die ""
+		| Int32Range -> Globals.die "" __LOC__
 
 	(* variables *)
 
@@ -253,7 +253,7 @@ class builder pool = object(self)
 		| (Int8Range | Int16Range),(Int8Range | Int16Range) ->
 			self#op (OpWide (OpWIinc(index,i))) 6 [] []
 		| _ ->
-			Globals.die ""
+			Globals.die "" __LOC__
 
 	(* conversions *)
 

+ 1 - 1
src/generators/jvm/jvmFunctions.ml

@@ -144,7 +144,7 @@ class typed_functions = object(self)
 			| [],[] ->
 				()
 			| _,[] ->
-				Globals.die ""
+				Globals.die "" __LOC__
 		in
 		loop args meth_to.dargs;
 		jm#invokevirtual jc#get_this_path meth_to.name (method_sig meth_to.dargs meth_to.dret);

+ 17 - 17
src/generators/jvm/jvmMethod.ml

@@ -127,7 +127,7 @@ module NativeArray = struct
 		| TArray _ ->
 			let offset = pool#add_type (generate_signature false je) in
 			code#anewarray ja offset
-		| TObjectInner _ | TUninitialized _ -> die ""
+		| TObjectInner _ | TUninitialized _ -> die "" __LOC__
 		end;
 		ja
 end
@@ -175,7 +175,7 @@ class builder jc name jsig = object(self)
 						debug_locals <- ld :: debug_locals;
 						loop (i - (signature_size t)) l
 					| [] ->
-						die ""
+						die "" __LOC__
 				end
 			in
 			loop delta locals;
@@ -226,28 +226,28 @@ class builder jc name jsig = object(self)
 		| TMethod(tl,tr) ->
 			let offset = code#get_pool#add_field path name jsigm FKMethod in
 			code#invokevirtual offset (object_path_sig path) tl (match tr with None -> [] | Some tr -> [tr])
-		| _ -> die ""
+		| _ -> die "" __LOC__
 
 	(** Emits an invokeinterface instruction to invoke method [name] on [path] with signature [jsigm]. **)
 	method invokeinterface (path : jpath) (name : string) (jsigm : jsignature) = match jsigm with
 		| TMethod(tl,tr) ->
 			let offset = code#get_pool#add_field path name jsigm FKInterfaceMethod in
 			code#invokeinterface offset (object_path_sig path) tl (match tr with None -> [] | Some tr -> [tr])
-		| _ -> die ""
+		| _ -> die "" __LOC__
 
 	(** Emits an invokespecial instruction to invoke method [name] on [path] with signature [jsigm]. **)
 	method invokespecial (path : jpath) (name : string) (jsigm : jsignature) = match jsigm with
 		| TMethod(tl,tr) ->
 			let offset = code#get_pool#add_field path name jsigm FKMethod in
 			code#invokespecial offset (object_path_sig path) tl (match tr with None -> [] | Some tr -> [tr])
-		| _ -> die ""
+		| _ -> die "" __LOC__
 
 	(** Emits an invokestatic instruction to invoke method [name] on [path] with signature [jsigm]. **)
 	method invokestatic (path : jpath) (name : string) (jsigm : jsignature) = match jsigm with
 		| TMethod(tl,tr) ->
 			let offset = code#get_pool#add_field path name jsigm FKMethod in
 			code#invokestatic offset tl (match tr with None -> [] | Some tr -> [tr])
-		| _ -> die ""
+		| _ -> die "" __LOC__
 
 	(** Emits a getfield instruction to get the value of field [name] on object [path] with signature [jsigf]. **)
 	method getfield (path : jpath) (name : string) (jsigf : jsignature) =
@@ -298,7 +298,7 @@ class builder jc name jsig = object(self)
 			code#ldc offset (TObject(java_class_path,[TType(WNone,object_sig)]))
 		| jsig ->
 			print_endline (generate_signature false jsig);
-			die ""
+			die "" __LOC__
 
 	(** Loads `this` **)
 	method load_this =
@@ -389,7 +389,7 @@ class builder jc name jsig = object(self)
 				code#return_value jsig
 			end;
 		| _ ->
-			die ""
+			die "" __LOC__
 
 	(* casting *)
 
@@ -482,7 +482,7 @@ class builder jc name jsig = object(self)
 				code#d2i;
 				unboxed_to_short ();
 			| _ ->
-				die ""
+				die "" __LOC__
 		in
 		let rec unboxed_to_int () = match code#get_stack#top with
 			| TBool | TByte | TShort | TChar | TInt ->
@@ -495,7 +495,7 @@ class builder jc name jsig = object(self)
 			| TDouble ->
 				code#d2i;
 			| _ ->
-				die ""
+				die "" __LOC__
 		in
 		let rec unboxed_to_long () = match code#get_stack#top with
 			| TBool | TByte | TShort | TChar | TInt ->
@@ -507,7 +507,7 @@ class builder jc name jsig = object(self)
 			| TDouble ->
 				code#d2l;
 			| _ ->
-				die ""
+				die "" __LOC__
 		in
 		let rec unboxed_to_float () = match code#get_stack#top with
 			| TBool | TByte | TShort | TChar | TInt ->
@@ -519,7 +519,7 @@ class builder jc name jsig = object(self)
 			| TDouble ->
 				code#d2f;
 			| _ ->
-				die ""
+				die "" __LOC__
 		in
 		let rec unboxed_to_double () = match code#get_stack#top with
 			| TBool | TByte | TShort | TChar | TInt ->
@@ -531,7 +531,7 @@ class builder jc name jsig = object(self)
 			| TDouble ->
 				()
 			| _ ->
-				die ""
+				die "" __LOC__
 		in
 		let get_conv = function
 			| "Byte" -> unboxed_to_byte
@@ -540,7 +540,7 @@ class builder jc name jsig = object(self)
 			| "Long" -> unboxed_to_long
 			| "Float" -> unboxed_to_float
 			| "Double" -> unboxed_to_double
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		in
 		let number_to name =
 			let boxed_sig = TObject((["java";"lang"],name),[]) in
@@ -791,7 +791,7 @@ class builder jc name jsig = object(self)
 			| [],[] ->
 				()
 			| _ ->
-				die ""
+				die "" __LOC__
 		in
 		loop cases jump_table;
 		(* exprs *)
@@ -986,14 +986,14 @@ class builder jc name jsig = object(self)
 		let rec loop locals = match locals with
 			| [(_,_,jsig)] -> jsig
 			| _ :: locals -> loop locals
-			| [] -> die ""
+			| [] -> die "" __LOC__
 		in
 		loop locals
 
 	method set_this_initialized =
 		let rec loop acc locals = match locals with
 			| [(init,name,_)] -> List.rev ((init,name,jc#get_jsig) :: acc)
-			| [] -> die ""
+			| [] -> die "" __LOC__
 			| l :: locals -> loop (l :: acc) locals
 		in
 		locals <- loop [] locals

+ 1 - 1
src/generators/jvm/jvmVerificationTypeInfo.ml

@@ -42,7 +42,7 @@ let of_signature pool jsig = match jsig with
 	| TTypeParameter _ -> VObject (pool#add_path (["java";"lang"],"Object"))
 	| TUninitialized (Some i) -> VUninitialized i
 	| TUninitialized None -> VUninitializedThis
-    | _ -> Globals.die ""
+    | _ -> Globals.die "" __LOC__
 
 let to_string vtt = match vtt with
 	| VTop -> "top"

+ 1 - 1
src/macro/eval/evalContext.ml

@@ -289,7 +289,7 @@ and context = {
 }
 
 module GlobalState = struct
-	let get_ctx_ref : (unit -> context) ref = ref (fun() -> die "")
+	let get_ctx_ref : (unit -> context) ref = ref (fun() -> die "" __LOC__)
 
 	let sid : int ref = ref (-1)
 

+ 3 - 3
src/macro/eval/evalDebugMisc.ml

@@ -72,7 +72,7 @@ let find_breakpoint ctx sid =
 		);
 		raise Not_found
 	with Exit ->
-		match !found with None -> die "" | Some breakpoint -> breakpoint
+		match !found with None -> die "" __LOC__ | Some breakpoint -> breakpoint
 
 (* Helper *)
 
@@ -114,7 +114,7 @@ let get_capture_slot_by_name capture_infos name =
 		) capture_infos;
 		raise Not_found
 	with Exit ->
-		match !ret with None -> die "" | Some name -> name
+		match !ret with None -> die "" __LOC__ | Some name -> name
 
 let get_variable env capture_infos scopes name env =
 	try
@@ -142,7 +142,7 @@ let resolve_ident ctx env s =
 		let rec loop env = match env.env_info.kind with
 			| EKLocalFunction _ ->
 				begin match env.env_parent with
-					| None -> die ""
+					| None -> die "" __LOC__
 					| Some env -> loop env
 				end
 			| EKMethod _ -> env

+ 1 - 1
src/macro/eval/evalDebugSocket.ml

@@ -38,7 +38,7 @@ let thread_safe_value_string env v =
 	let ctx = get_ctx() in
 	match handle_in_temp_thread ctx env (fun () -> VString (EvalPrinting.s_value 0 v)) with
 	| VString s -> s.sstring
-	| _ -> die ""
+	| _ -> die "" __LOC__
 
 let var_to_json name value vio env =
 	let jv t v num_children =

+ 1 - 1
src/macro/eval/evalEmitter.ml

@@ -353,7 +353,7 @@ let emit_special_super_call fnew execs env =
 	(* This isn't very elegant, but it's probably a rare case to extend these types. *)
 	begin match vthis,vi' with
 		| VInstance vi,VInstance vi' -> vi.ikind <- vi'.ikind
-		| _ -> die ""
+		| _ -> die "" __LOC__
 	end;
 	vnull
 

+ 1 - 1
src/macro/eval/evalExceptions.ml

@@ -112,7 +112,7 @@ let build_exception_stack ctx env =
 			List.rev acc
 		else match env'.env_parent with
 			| Some env -> loop acc env
-			| None -> die ""
+			| None -> die "" __LOC__
 	in
 	let d = match eval.env with
 	| Some env -> loop [] env

+ 11 - 11
src/macro/eval/evalJit.ml

@@ -31,7 +31,7 @@ open EvalMisc
 let rope_path t = match follow t with
 	| TInst({cl_path=path},_) | TEnum({e_path=path},_) | TAbstract({a_path=path},_) -> s_type_path path
 	| TDynamic _ -> "Dynamic"
-	| TFun _ | TAnon _ | TMono _ | TType _ | TLazy _ -> die ""
+	| TFun _ | TAnon _ | TMono _ | TType _ | TLazy _ -> die "" __LOC__
 
 let eone = mk (TConst(TInt (Int32.one))) t_dynamic null_pos
 
@@ -41,7 +41,7 @@ let eval_const = function
 	| TFloat f -> vfloat (float_of_string f)
 	| TBool b -> vbool b
 	| TNull -> vnull
-	| TThis | TSuper -> die ""
+	| TThis | TSuper -> die "" __LOC__
 
 let is_int t = match follow t with
 	| TAbstract({a_path=[],"Int"},_) -> true
@@ -106,7 +106,7 @@ let rec op_assign ctx jit e1 e2 = match e1.eexpr with
 		end
 
 	| _ ->
-		die ""
+		die "" __LOC__
 
 and op_assign_op jit op e1 e2 prefix = match e1.eexpr with
 	| TLocal var ->
@@ -142,7 +142,7 @@ and op_assign_op jit op e1 e2 prefix = match e1.eexpr with
 				emit_array_read_write exec1 ea1.epos exec2 ea2.epos exec3 op prefix
 		end
 	| _ ->
-		die ""
+		die "" __LOC__
 
 and op_incr jit e1 prefix p =
 	op_assign_op jit (get_binop_fun OpAdd p) e1 eone prefix
@@ -258,7 +258,7 @@ and jit_expr jit return e =
 					h := IntMap.add i exec !h;
 					if i > !max then max := i;
 					if i < !min then min := i;
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			) el;
 			pop_scope jit;
 		) cases;
@@ -277,7 +277,7 @@ and jit_expr jit return e =
 			let exec = jit_expr jit return e in
 			List.iter (fun e -> match e.eexpr with
 				| TConst (TString s) -> h := PMap.add s exec !h;
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			) el;
 			pop_scope jit;
 		) cases;
@@ -342,7 +342,7 @@ and jit_expr jit return e =
 			| e :: el ->
 				loop (jit_expr jit false e :: acc) el
 			| [] ->
-				die ""
+				die "" __LOC__
 		in
 		let el = loop [] el in
 		pop_scope jit;
@@ -365,7 +365,7 @@ and jit_expr jit return e =
 			in
 			let length = Array.length a in
 			match loop (length - 1) [] with
-			| [] -> die ""
+			| [] -> die "" __LOC__
 			| [f] -> f
 			| fl -> step fl
 		in
@@ -439,7 +439,7 @@ and jit_expr jit return e =
 				| FStatic({cl_path=[],"StringTools"},{cf_name="fastCodeAt"}) ->
 					begin match execs with
 						| [exec1;exec2] -> emit_string_cca exec1 exec2 e.epos
-						| _ -> die ""
+						| _ -> die "" __LOC__
 					end
 				| FEnum({e_path=path},ef) ->
 					let key = path_hash path in
@@ -479,7 +479,7 @@ and jit_expr jit return e =
 					let v = lazy (match Lazy.force fnew with VFunction (f,_) -> f | v -> cannot_call v e.epos) in
 					emit_super_call v execs e.epos
 				end
-			| _ -> die ""
+			| _ -> die "" __LOC__
 			end
 		| _ ->
 			match e1.eexpr,el with
@@ -613,7 +613,7 @@ and jit_expr jit return e =
 				| OpShr -> emit_op_shr e.epos exec1 exec2
 				| OpUShr -> emit_op_ushr e.epos exec1 exec2
 				| OpMod -> emit_op_mod e.epos exec1 exec2
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			end
 		end
 	| TUnop(op,flag,v1) ->

+ 3 - 3
src/macro/eval/evalJitContext.ml

@@ -73,7 +73,7 @@ let pop_scope jit = match jit.scopes with
 		jit.scopes <- tl;
 		jit.num_locals <- jit.num_locals - (num_locals scope);
 	| [] ->
-		Globals.die ""
+		Globals.die "" __LOC__
 
 (* Increases number of locals and updates maximum number of locals if necessary *)
 let increase_num_locals jit =
@@ -91,7 +91,7 @@ let add_capture jit var declared =
 
 (* Adds variable [var] to the current top scope of context [jit]. *)
 let add_local jit var = match jit.scopes with
-	| [] -> Globals.die ""
+	| [] -> Globals.die "" __LOC__
 	| scope :: _ ->
 		let i = Hashtbl.length scope.locals in
 		Hashtbl.add scope.locals var.v_id i;
@@ -126,7 +126,7 @@ let declare_arg jit var =
 
 (* Declares a variable for `this` in context [jit]. *)
 let declare_local_this jit = match jit.scopes with
-	| [] -> Globals.die ""
+	| [] -> Globals.die "" __LOC__
 	| scope :: _ ->
 		let i = Hashtbl.length scope.locals in
 		Hashtbl.add scope.locals 0 i;

+ 7 - 7
src/macro/eval/evalMain.ml

@@ -149,7 +149,7 @@ let call_path ctx path f vl api =
 		let old = ctx.curapi in
 		ctx.curapi <- api;
 		let path = match List.rev path with
-			| [] -> die ""
+			| [] -> die "" __LOC__
 			| name :: path -> List.rev path,name
 		in
 		catch_exceptions ctx ~final:(fun () -> ctx.curapi <- old) (fun () ->
@@ -316,7 +316,7 @@ let value_signature v =
 			addc 'B';
 			adds (rev_hash path)
 		| VPrototype _ ->
-			die ""
+			die "" __LOC__
 		| VFunction _ | VFieldClosure _ ->
 			(* Custom format: enumerate functions as F0, F1 etc. *)
 			cache v (fun () ->
@@ -361,7 +361,7 @@ let setup get_api =
 			in
 			let v = VFunction (f,b) in
 			Hashtbl.replace GlobalState.macro_lib n v
-		| _ -> die ""
+		| _ -> die "" __LOC__
 	) api;
 	Globals.macro_platform := Globals.Eval
 
@@ -384,14 +384,14 @@ let compiler_error msg pos =
 		set_instance_field i key_pos (encode_pos pos);
 		exc vi
 	| _ ->
-		die ""
+		die "" __LOC__
 
 let rec value_to_expr v p =
 	let path i =
 		let mt = IntMap.find i (get_ctx()).type_cache in
 		let make_path t =
 			let rec loop = function
-				| [] -> die ""
+				| [] -> die "" __LOC__
 				| [name] -> (EConst (Ident name),p)
 				| name :: l -> (EField (loop l,name),p)
 			in
@@ -422,7 +422,7 @@ let rec value_to_expr v p =
 			let expr = path e.epath in
 			let name = match proto.pkind with
 				| PEnum names -> fst (List.nth names e.eindex)
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			in
 			(EField (expr, name), p)
 		in
@@ -534,7 +534,7 @@ let handle_decoding_error f v t =
 			end
 		| TInst _ | TAbstract _ | TFun _ ->
 			(* TODO: might need some more of these, not sure *)
-			die ""
+			die "" __LOC__
 		| TMono r ->
 			begin match r.tm_type with
 				| None -> ()

+ 1 - 1
src/macro/eval/evalMisc.ml

@@ -253,4 +253,4 @@ let get_binop_fun op p = match op with
 	| OpShr -> op_shr p
 	| OpUShr -> op_ushr p
 	| OpMod -> op_mod p
-	| OpAssign | OpBoolAnd | OpBoolOr | OpAssignOp _ | OpInterval | OpArrow | OpIn -> die ""
+	| OpAssign | OpBoolAnd | OpBoolOr | OpAssignOp _ | OpInterval | OpArrow | OpIn -> die "" __LOC__

+ 1 - 1
src/macro/eval/evalPrinting.ml

@@ -99,7 +99,7 @@ and s_enum_value depth ve =
 and s_proto_kind proto = match proto.pkind with
 	| PClass _ -> join empty_string [create_ascii "Class<"; s_hash proto.ppath; rgt]
 	| PEnum _ -> join empty_string [create_ascii "Enum<"; s_hash proto.ppath; rgt]
-	| PInstance | PObject -> die ""
+	| PInstance | PObject -> die "" __LOC__
 
 and s_value depth v =
 	let call_to_string () =

+ 1 - 1
src/macro/eval/evalPrototype.ml

@@ -240,7 +240,7 @@ let create_static_prototype ctx mt =
 		let pctx = PrototypeBuilder.create ctx key None (PClass []) meta in
 		PrototypeBuilder.finalize pctx,[];
 	| _ ->
-		die ""
+		die "" __LOC__
 	in
 	let rec loop v name path = match path with
 		| [] ->

+ 16 - 16
src/macro/eval/evalStdLib.ml

@@ -632,7 +632,7 @@ module StdCompress = struct
 			| 2 -> Z_FULL_FLUSH
 			| 3 -> Z_FINISH
 			| 4 -> Z_PARTIAL_FLUSH
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		in
 		(this vthis).z_flush <- mode;
 		vnull
@@ -1087,7 +1087,7 @@ module StdFileInput = struct
 		r := false;
 		let pos = decode_int pos in
 		let mode,_ = decode_enum mode in
-		seek_in ch (match mode with 0 -> pos | 1 -> pos_in ch + pos | 2 -> in_channel_length ch + pos | _ -> die "");
+		seek_in ch (match mode with 0 -> pos | 1 -> pos_in ch + pos | 2 -> in_channel_length ch + pos | _ -> die "" __LOC__);
 		vnull
 	)
 
@@ -1139,7 +1139,7 @@ module StdFileOutput = struct
 		let this = this vthis in
 		let pos = decode_int pos in
 		let mode,_ = decode_enum mode in
-		seek_out this (match mode with 0 -> pos | 1 -> pos_out this + pos | 2 -> out_channel_length this + pos | _ -> die "");
+		seek_out this (match mode with 0 -> pos | 1 -> pos_out this + pos | 2 -> out_channel_length this + pos | _ -> die "" __LOC__);
 		vnull
 	)
 
@@ -2006,7 +2006,7 @@ module StdSocket = struct
 		let s = catch_unix_error Unix.string_of_inet_addr addr in
 		match List.map Int32.of_string (ExtString.String.nsplit s ".") with
 			| [a;b;c;d] -> Int32.add (Int32.add (Int32.add (Int32.shift_left a 24) (Int32.shift_left b 16)) (Int32.shift_left c 8)) d
-			| _ -> die ""
+			| _ -> die "" __LOC__
 
 	let this vthis = match vthis with
 		| VInstance {ikind = ISocket sock} -> sock
@@ -2046,7 +2046,7 @@ module StdSocket = struct
 				key_ip,vint32 (inet_addr_to_int32 addr);
 				key_port,vint port;
 			]
-		| _ -> die ""
+		| _ -> die "" __LOC__
 	)
 
 	let listen = vifun1 (fun vthis connections ->
@@ -2063,7 +2063,7 @@ module StdSocket = struct
 				key_ip,vint32 (inet_addr_to_int32 addr);
 				key_port,vint port;
 			]
-		| _ -> die ""
+		| _ -> die "" __LOC__
 	)
 
 	let receive = vifun3 (fun vthis buf pos len ->
@@ -3135,7 +3135,7 @@ let init_constructors builtins =
 			match vl with
 			| [size] ->
 				encode_vector_instance (Array.make (decode_int size) vnull)
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		);
 	add key_Date
 		(fun vl ->
@@ -3146,24 +3146,24 @@ let init_constructors builtins =
 					Unix.mktime {t with tm_sec=s;tm_min=mi;tm_hour=h;tm_mday=d;tm_mon=m;tm_year=y - 1900}
 				) () in
 				encode_instance key_Date ~kind:(IDate (fst f))
-			| _ -> die ""
+			| _ -> die "" __LOC__
 			end
 		);
 	add key_EReg
 		(fun vl -> match vl with
 			| [r;opt] -> encode_instance key_EReg ~kind:(StdEReg.create (decode_string r) (decode_string opt))
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		);
 	add key_String
 		(fun vl -> match vl with
 			| [s] -> s
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		);
 	add key_StringBuf (fun _ -> encode_instance key_StringBuf ~kind:(IBuffer (VStringBuffer.create())));
 	add key_haxe_Utf8
 		(fun vl -> match vl with
 			| [size] -> encode_instance key_haxe_Utf8 ~kind:(IUtf8 (UTF8.Buf.create (default_int size 0)))
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		);
 	add key_haxe_ds_StringMap (fun _ -> encode_string_map_direct (StringHashtbl.create ()));
 	add key_haxe_ds_IntMap (fun _ -> encode_int_map_direct (IntHashtbl.create ()));
@@ -3179,7 +3179,7 @@ let init_constructors builtins =
 				Bytes.blit b 0 b' 0 blit_length;
 				encode_bytes b'
 			| _ ->
-				die ""
+				die "" __LOC__
 		);
 	add key_sys_io__Process_NativeProcess
 		(fun vl -> match vl with
@@ -3191,7 +3191,7 @@ let init_constructors builtins =
 					| _ -> unexpected_value args "array"
 				in
 				encode_instance key_sys_io__Process_NativeProcess ~kind:(IProcess (try Process.run cmd args with Failure msg -> exc_string msg))
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		);
 	add key_eval_vm_NativeSocket
 		(fun _ ->
@@ -3203,7 +3203,7 @@ let init_constructors builtins =
 				let level = decode_int level in
 				let z = Extc.zlib_deflate_init level in
 				encode_instance key_haxe_zip_Compress ~kind:(IZip { z = z; z_flush = Extc.Z_NO_FLUSH })
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		);
 	add key_haxe_zip_Uncompress
 		(fun vl -> match vl with
@@ -3211,7 +3211,7 @@ let init_constructors builtins =
 				let windowBits = default_int windowBits 15 in
 				let z = Extc.zlib_inflate_init2 windowBits in
 				encode_instance key_haxe_zip_Uncompress ~kind:(IZip { z = z; z_flush = Extc.Z_NO_FLUSH })
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		);
 	add key_eval_vm_Thread
 		(fun vl -> match vl with
@@ -3220,7 +3220,7 @@ let init_constructors builtins =
 				if ctx.is_macro then exc_string "Creating threads in macros is not supported";
 				let thread = EvalThread.spawn ctx (fun () -> call_value f []) in
 				encode_instance key_eval_vm_Thread ~kind:(IThread thread)
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		);
 	add key_sys_net_Mutex
 		(fun _ ->

+ 1 - 1
src/macro/eval/evalString.ml

@@ -128,7 +128,7 @@ let get_offset' s c_index =
 		in
 		b_offset,r
 	| _ ->
-		Globals.die ""
+		Globals.die "" __LOC__
 
 let get_offset s c_index =
 	let b_offset,(cr_index,br_offset) = get_offset' s c_index in

+ 3 - 3
src/macro/macroApi.ml

@@ -406,7 +406,7 @@ and encode_message msg =
 	let tag, pl = match msg with
 		| CMInfo(msg,p) -> 0, [(encode_string msg); (encode_pos p)]
 		| CMWarning(msg,p) -> 1, [(encode_string msg); (encode_pos p)]
-		| CMError(_,_) -> Globals.die ""
+		| CMError(_,_) -> Globals.die "" __LOC__
 	in
 	encode_enum ~pos:None IMessage tag pl
 
@@ -1725,7 +1725,7 @@ let macro_api ccom get_api =
 						vnull
 					);
 					"setCurrentClass", vfun1 (fun c ->
-						Genjs.set_current_class js_ctx (match decode_type_decl c with TClassDecl c -> c | _ -> Globals.die "");
+						Genjs.set_current_class js_ctx (match decode_type_decl c with TClassDecl c -> c | _ -> Globals.die "" __LOC__);
 						vnull
 					);
 				] in
@@ -1975,7 +1975,7 @@ let macro_api ccom get_api =
 			and fn = prepare_callback fn 1 in
 			match map (fun t -> decode_type (fn [encode_type t])) (TAnon a) with
 			| TAnon a -> encode_ref a encode_tanon (fun() -> "<anonymous>")
-			| _ -> Globals.die ""
+			| _ -> Globals.die "" __LOC__
 		)
 	]
 

+ 4 - 4
src/optimization/analyzer.ml

@@ -129,7 +129,7 @@ module Ssa = struct
 						add_ssa_edge ctx.graph v' bb true i;
 						{e with eexpr = TLocal v'}
 					| _ ->
-						die ""
+						die "" __LOC__
 				) el edge.cfg_to.bb_incoming in
 				let ephi = {ecall with eexpr = TCall(ephi,el)} in
 				set_var_value ctx.graph v0 bb true i;
@@ -302,7 +302,7 @@ module DataFlow (M : DataFlowApi) = struct
 				match e.eexpr with
 					| TBinop(OpAssign,{eexpr = TLocal v},{eexpr = TCall({eexpr = TConst (TString "phi")},el)}) ->
 						set_lattice_cell v (visit_phi bb v el)
-					| _ -> die ""
+					| _ -> die "" __LOC__
 			) bb.bb_phi
 		in
 		let rec loop () = match !cfg_work_list,!ssa_work_list with
@@ -1005,7 +1005,7 @@ module Run = struct
 				in
 				(try loop tf.tf_expr with Exit -> mk (TCall(e,[])) tf.tf_type e.epos)
 			| _ ->
-				die ""
+				die "" __LOC__
 		end in
 		e
 
@@ -1081,7 +1081,7 @@ module Run = struct
 				let e = run_on_expr actx e in
 				let e = match e.eexpr with
 					| TFunction tf -> tf.tf_expr
-					| _ -> die ""
+					| _ -> die "" __LOC__
 				in
 				c.cl_init <- Some e
 		end

+ 1 - 1
src/optimization/analyzerTexpr.ml

@@ -752,7 +752,7 @@ module Fusion = struct
 					in
 					let e,_ = map_values check_assign e1 in
 					let e = match !e' with
-						| None -> die ""
+						| None -> die "" __LOC__
 						| Some(e1,f) ->
 							begin match e1.eexpr with
 								| TLocal v -> state#change_writes v (- !i + 1)

+ 8 - 8
src/optimization/analyzerTexprTransformer.ml

@@ -120,7 +120,7 @@ let rec func ctx bb tf t p =
 		| TBinop(op,e1,e2) ->
 			let bb,e1,e2 = match ordered_value_list bb [e1;e2] with
 				| bb,[e1;e2] -> bb,e1,e2
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			in
 			bb,{e with eexpr = TBinop(op,e1,e2)}
 		| TUnop(op,flag,e1) ->
@@ -141,7 +141,7 @@ let rec func ctx bb tf t p =
 		| TArray(e1,e2) ->
 			let bb,e1,e2 = match ordered_value_list bb [e1;e2] with
 				| bb,[e1;e2] -> bb,e1,e2
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			in
 			bb,{e with eexpr = TArray(e1,e2)}
 		| TMeta(m,e1) ->
@@ -257,7 +257,7 @@ let rec func ctx bb tf t p =
 						if bb == g.g_unreachable then raise Exit;
 						loop2 bb el
 					| [] ->
-						die ""
+						die "" __LOC__
 				in
 				let bb,e = loop2 bb el in
 				loop bb e
@@ -319,7 +319,7 @@ let rec func ctx bb tf t p =
 		let bb,el = ordered_value_list !bb (e1 :: el) in
 		match el with
 			| e1 :: el -> bb,{e with eexpr = TCall(e1,el)}
-			| _ -> die ""
+			| _ -> die "" __LOC__
 	and array_assign_op bb op e ea e1 e2 e3 =
 		let bb,e1 = bind_to_temp bb false e1 in
 		let bb,e2 = bind_to_temp bb false e2 in
@@ -540,7 +540,7 @@ let rec func ctx bb tf t p =
 		| TContinue ->
 			begin match !bb_continue with
 				| Some bb_continue -> add_cfg_edge bb bb_continue CFGGoto
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			end;
 			add_terminator bb e
 		| TThrow e1 ->
@@ -583,7 +583,7 @@ let rec func ctx bb tf t p =
 		| TBinop(OpAssign,({eexpr = TArray(e1,e2)} as ea),e3) ->
 			let bb,e1,e2,e3 = match ordered_value_list bb [e1;e2;e3] with
 				| bb,[e1;e2;e3] -> bb,e1,e2,e3
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			in
 			add_texpr bb {e with eexpr = TBinop(OpAssign,{ea with eexpr = TArray(e1,e2)},e3)};
 			bb
@@ -617,7 +617,7 @@ let rec func ctx bb tf t p =
 		| TObjectDecl fl ->
 			block_el bb (List.map snd fl)
 		| TFor _ | TWhile(_,_,DoWhile) ->
-			die ""
+			die "" __LOC__
 	and block_el bb el =
 		match !b_try_stack with
 		| [] ->
@@ -739,7 +739,7 @@ and func ctx i =
 							let op = match op with
 								| OpAdd -> Increment
 								| OpSub -> Decrement
-								| _ -> die ""
+								| _ -> die "" __LOC__
 							in
 							{e with eexpr = TUnop(op,Prefix,e1)}
 						| _ -> {e with eexpr = TBinop(OpAssignOp op,e1,e3)}

+ 3 - 3
src/optimization/analyzerTypes.ml

@@ -241,7 +241,7 @@ module Graph = struct
 		in
 		match (get_texpr bb is_phi i).eexpr with
 		| TVar(_,Some e) | TBinop(OpAssign,_,e) -> e
-		| _ -> die ""
+		| _ -> die "" __LOC__
 
 	let add_var_origin g v v_origin =
 		(get_var_info g v).vi_origin <- v_origin
@@ -381,7 +381,7 @@ module Graph = struct
 							(bbi_desc,bbi.semi)
 					) (a,a.label.semi) worklist)
 				| [] ->
-					die ""
+					die "" __LOC__
 		in
 		let eval v =
 			let bbi = get_info v in
@@ -393,7 +393,7 @@ module Graph = struct
 		in
 		let rec loop nodes' = match nodes' with
 			| [_] -> ()
-			| [] -> die ""
+			| [] -> die "" __LOC__
 			| w :: nodes' ->
 				let semi = List.fold_left (fun acc v ->
 					min acc (eval v.cfg_from.bb_id).semi) w.semi w.bb.bb_incoming

+ 4 - 4
src/optimization/inline.ml

@@ -108,7 +108,7 @@ let api_inline2 com c field params p =
 
 let api_inline ctx c field params p =
 	let mk_typeexpr path =
-		let m = (try Hashtbl.find ctx.g.modules path with Not_found -> die "") in
+		let m = (try Hashtbl.find ctx.g.modules path with Not_found -> die "" __LOC__) in
 		add_dependency ctx.m.curmod m;
 		ExtList.List.find_map (function
 			| TClassDecl cl when cl.cl_path = path -> Some (make_static_this cl p)
@@ -194,7 +194,7 @@ let api_inline ctx c field params p =
 					TInst(cl,[t])
 				| TInst({ cl_path = [],"Array" }, [t]), TAbstractDecl(a) ->
 					TAbstract(a,[t])
-				| _ -> die ""
+				| _ -> die "" __LOC__
 			in
 			Some ({ (mk_untyped_call "__array__" p args) with etype = t })
 		with | Exit ->
@@ -228,7 +228,7 @@ let inline_default_config cf t =
 		| Some (csup,spl) ->
 			let spl = (match apply_params c.cl_params pl (TInst (csup,spl)) with
 			| TInst (_,pl) -> pl
-			| _ -> die ""
+			| _ -> die "" __LOC__
 			) in
 			let ct, cpl = get_params csup spl in
 			c.cl_params @ ct, pl @ cpl
@@ -740,7 +740,7 @@ let rec type_inline ctx cf f ethis params tret config p ?(self_calling_closure=f
 					if term then t := e.etype;
 					[e]
 				| ({ eexpr = TIf (cond,e1,None) } as e) :: l when term && has_term_return e1 ->
-					loop [{ e with eexpr = TIf (cond,e1,Some (mk (TBlock l) e.etype e.epos)); epos = punion e.epos (match List.rev l with e :: _ -> e.epos | [] -> die "") }]
+					loop [{ e with eexpr = TIf (cond,e1,Some (mk (TBlock l) e.etype e.epos)); epos = punion e.epos (match List.rev l with e :: _ -> e.epos | [] -> die "" __LOC__) }]
 				| e :: l ->
 					let e = map false false e in
 					e :: loop l

+ 1 - 1
src/optimization/inlineConstructors.ml

@@ -421,7 +421,7 @@ let inline_constructors ctx e =
 			| None ->
 				let rve = make_expr_for_rev_list rvel rve.etype rve.epos in
 				begin match lvel with
-				| [] -> die ""
+				| [] -> die "" __LOC__
 				| e::el ->
 					let e = mk (TBinop(OpAssign, e, rve)) e.etype e.epos in
 					(e::el), None

+ 2 - 2
src/optimization/optimizer.ml

@@ -299,7 +299,7 @@ let rec reduce_loop ctx e =
 			| { eexpr = TFunction func } as ef ->
 				let cf = mk_field "" ef.etype e.epos null_pos in
 				let ethis = mk (TConst TThis) t_dynamic e.epos in
-				let rt = (match follow ef.etype with TFun (_,rt) -> rt | _ -> die "") in
+				let rt = (match follow ef.etype with TFun (_,rt) -> rt | _ -> die "" __LOC__) in
 				let inl = (try type_inline ctx cf func ethis el rt None e.epos ~self_calling_closure:true false with Error (Custom _,_) -> None) in
 				(match inl with
 				| None -> reduce_expr ctx e
@@ -308,7 +308,7 @@ let rec reduce_loop ctx e =
 				begin match cf.cf_expr with
 				| Some {eexpr = TFunction tf} ->
 					let config = inline_config (Some cl) cf el e.etype in
-					let rt = (match follow e1.etype with TFun (_,rt) -> rt | _ -> die "") in
+					let rt = (match follow e1.etype with TFun (_,rt) -> rt | _ -> die "" __LOC__) in
 					let inl = (try type_inline ctx cf tf ef el rt config e.epos false with Error (Custom _,_) -> None) in
 					(match inl with
 					| None -> reduce_expr ctx e

+ 2 - 2
src/optimization/optimizerTexpr.ml

@@ -150,12 +150,12 @@ let optimize_binop e op e1 e2 =
 		let fa = (match ca with
 			| TFloat a -> float_of_string a
 			| TInt a -> Int32.to_float a
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		) in
 		let fb = (match cb with
 			| TFloat b -> float_of_string b
 			| TInt b -> Int32.to_float b
-			| _ -> die ""
+			| _ -> die "" __LOC__
 		) in
 		let fop op = check_float op fa fb in
 		let ebool t =

+ 2 - 2
src/syntax/grammar.mly

@@ -1249,7 +1249,7 @@ and expr = parser
 		| [< '(PClose,p2); er = arrow_expr; >] ->
 			arrow_function p1 [] er s
 		| [< '(Question,p2); al = psep Comma parse_fun_param; '(PClose,_); er = arrow_expr; >] ->
-			let al = (match al with | (np,_,_,topt,e) :: al -> (np,true,[],topt,e) :: al | _ -> die "" ) in
+			let al = (match al with | (np,_,_,topt,e) :: al -> (np,true,[],topt,e) :: al | _ -> die "" __LOC__ ) in
 			arrow_function p1 al er s
 		| [<  e = expr; s >] -> (match s with parser
 			| [< '(PClose,p2); s >] -> expr_next (EParenthesis e, punion p1 p2) s
@@ -1374,7 +1374,7 @@ and expr_next' e1 = parser
 	| [< '(BrOpen,p1) when is_dollar_ident e1; eparam = expr; '(BrClose,p2); s >] ->
 		(match fst e1 with
 		| EConst(Ident n) -> expr_next (EMeta((Meta.from_string n,[],snd e1),eparam), punion p1 p2) s
-		| _ -> die "")
+		| _ -> die "" __LOC__)
 	| [< '(Dot,p); e = parse_field e1 p >] -> e
 	| [< '(POpen,p1); e = parse_call_params (fun el p2 -> (ECall(e1,el)),punion (pos e1) p2) p1; s >] -> expr_next e s
 	| [< '(BkOpen,p1); e2 = secure_expr; s >] ->

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно