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

optional enums arguments on Flash9 are now automatically Null

Nicolas Cannasse 18 жил өмнө
parent
commit
1d100193a5
3 өөрчлөгдсөн 3 нэмэгдсэн , 2 устгасан
  1. 1 0
      doc/CHANGES.txt
  2. 1 1
      genxml.ml
  3. 1 1
      typer.ml

+ 1 - 0
doc/CHANGES.txt

@@ -8,6 +8,7 @@
 	error on too much big neko array declaration (neko 1.6 max_stack limit)
 	fixed Flash9 statics slots (FP 9,0,60 compatibility)
 	fixed Flash9 Type.getClassName
+	optional enums arguments on Flash9 are now automatically Null
 
 2007-07-25: 1.14
 	fixed no error when invalid "catch" expression

+ 1 - 1
genxml.ml

@@ -75,7 +75,7 @@ let gen_constr e =
 	let args, t = (match follow e.ef_type with
 		| TFun (args,_) ->
 			["a",String.concat ":" (List.map gen_arg_name args)] ,
-			List.map (fun (_,_,t) -> gen_type t) args @ doc
+			List.map (fun (_,opt,t) -> gen_type (if opt then follow_param t else t)) args @ doc
 		| _ ->
 			[] , doc
 	) in

+ 1 - 1
typer.ml

@@ -2598,7 +2598,7 @@ let type_module ctx m tdecls loadp =
 				if c = "name" && Plugin.defined "js" then error "This identifier cannot be used in Javascript" p;
 				let t = (match t with
 					| [] -> et
-					| l -> TFun (List.map (fun (s,b,t) -> s, b, load_type ctx p t) l, et)
+					| l -> TFun (List.map (fun (s,opt,t) -> s, opt, load_type_opt ~param:opt ctx p (Some t)) l, et)
 				) in
 				if PMap.mem c e.e_constrs then error ("Duplicate constructor " ^ c) p;
 				e.e_constrs <- PMap.add c { ef_name = c; ef_type = t; ef_pos = p; ef_doc = doc } e.e_constrs