浏览代码

Merge branch 'development' into new_stringmap

Simon Krajewski 10 年之前
父节点
当前提交
70046ab0f5
共有 7 个文件被更改,包括 28 次插入9 次删除
  1. 1 1
      filters.ml
  2. 0 5
      gencs.ml
  3. 12 0
      main.ml
  4. 4 0
      std/flash/Lib.hx
  5. 3 1
      std/haxe/Http.hx
  6. 1 0
      type.ml
  7. 7 2
      typeload.ml

+ 1 - 1
filters.ml

@@ -33,7 +33,7 @@ let rec blockify_ast e =
 		let cases = List.map (fun (el,e) ->
 			el,mk_block (blockify_ast e)
 		) cases in
-		let def = match def with None -> None | Some e -> Some (blockify_ast e) in
+		let def = match def with None -> None | Some e -> Some (mk_block (blockify_ast e)) in
 		{e with eexpr = TSwitch(e1,cases,def)}
 	| _ ->
 		Type.map_expr blockify_ast e

+ 0 - 5
gencs.ml

@@ -3316,11 +3316,6 @@ let convert_ilmethod ctx p m is_explicit_impl =
 	) ([acc],None) m.mflags.mf_contract in
 
 	let meta = [Meta.Overload, [], p] in
-	let meta = match is_final with
-		| None | Some false ->
-			(Meta.Final, [], p) :: meta
-		| _ -> meta
-	in
 	let meta = if is_explicit_impl then
 			(Meta.NoCompletion,[],p) :: (Meta.SkipReflection,[],p) :: meta
 		else

+ 12 - 0
main.ml

@@ -741,6 +741,18 @@ and wait_loop boot_com host port =
 				if m.m_extra.m_mark <= start_mark then begin
 					(match m.m_extra.m_kind with
 					| MFake | MSub -> () (* don't get classpath *)
+					| MExtern ->
+						(* if we have a file then this will override our extern type *)
+						let has_file = (try ignore(Typeload.resolve_module_file com2 m.m_path (ref[]) p); true with Not_found -> false) in
+						if has_file then raise Not_found;
+						let rec loop = function
+							| [] -> raise Not_found (* no extern registration *)
+							| load :: l ->
+								match load m.m_path p with
+								| None -> loop l
+								| Some (file,_) -> if Common.unique_full_path file <> m.m_extra.m_file then raise Not_found
+						in
+						loop com2.load_extern_type
 					| MCode -> if not (check_module_path com2 m p) then raise Not_found;
 					| MMacro when ctx.Typecore.in_macro -> if not (check_module_path com2 m p) then raise Not_found;
 					| MMacro ->

+ 4 - 0
std/flash/Lib.hx

@@ -64,6 +64,10 @@ class Lib {
 	public static function trace( arg : Dynamic ) {
 		untyped __global__["trace"](arg);
 	}
+	
+	public static function describeType( value : Dynamic ) : flash.xml.XML {
+		return untyped __global__["flash.utils.describeType"](value);
+	}
 
 	public static function attach( name : String ) : flash.display.MovieClip {
 		var cl = untyped __as__(__global__["flash.utils.getDefinitionByName"](name),Class);

+ 3 - 1
std/haxe/Http.hx

@@ -380,7 +380,9 @@ class Http {
 			me.responseData = output.getBytes().toString();
 			#end
 			err = true;
-			old(e);
+			// Resetting back onError before calling it allows for a second "retry" request to be sent without onError being wrapped twice
+			onError = old;
+			onError(e);
 		}
 		customRequest(post,output);
 		if( !err )

+ 1 - 0
type.ml

@@ -298,6 +298,7 @@ and module_kind =
 	| MMacro
 	| MFake
 	| MSub
+	| MExtern
 
 and dt =
 	| DTSwitch of texpr * (texpr * dt) list * dt option

+ 7 - 2
typeload.ml

@@ -861,6 +861,7 @@ let check_overriding ctx c =
 					() (* allow to redefine a method as inlined *)
 				| _ ->
 					display_error ctx ("Field " ^ i ^ " has different property access than in superclass") p);
+				if has_meta Meta.Final f2.cf_meta then display_error ctx ("Cannot override @:final method " ^ i) p;
 				try
 					let t = apply_params csup.cl_params params t in
 					valid_redefinition ctx f f.cf_type f2 t
@@ -2741,8 +2742,9 @@ let rec init_module_type ctx context_init do_init (decl,p) =
 				error "Abstract is missing underlying type declaration" a.a_pos
 		end
 
-let type_module ctx m file tdecls p =
+let type_module ctx m file ?(is_extern=false) tdecls p =
 	let m, decls, tdecls = make_module ctx m file tdecls p in
+	if is_extern then m.m_extra.m_kind <- MExtern;
 	add_module ctx m p;
 	(* define the per-module context for the next pass *)
 	let ctx = {
@@ -2905,6 +2907,7 @@ let load_module ctx m p =
 			match !type_module_hook ctx m p with
 			| Some m -> m
 			| None ->
+			let is_extern = ref false in
 			let file, decls = (try
 				parse_module ctx m p
 			with Not_found ->
@@ -2916,10 +2919,12 @@ let load_module ctx m p =
 						| None -> loop l
 						| Some (file,(_,a)) -> file, a
 				in
+				is_extern := true;
 				loop ctx.com.load_extern_type
 			) in
+			let is_extern = !is_extern in
 			try
-				type_module ctx m file decls p
+				type_module ctx m file ~is_extern decls p
 			with Forbid_package (inf,pl,pf) when p <> Ast.null_pos ->
 				raise (Forbid_package (inf,p::pl,pf))
 	) in