Nicolas Cannasse 19 سال پیش
والد
کامیت
535e734fdc
3فایلهای تغییر یافته به همراه7 افزوده شده و 0 حذف شده
  1. 3 0
      std/flash/Boot.hx
  2. 2 0
      std/neko/Boot.hx
  3. 2 0
      typer.ml

+ 3 - 0
std/flash/Boot.hx

@@ -283,6 +283,9 @@ class Boot {
 			Lib._root = _root;
 			Lib.current = current;
 			Int = __new__(obj);
+			Bool = __new__(obj);
+			Bool["true"] = true;
+			Bool["false"] = false;
 			Float = _global["Number"];
 			// prevent closure creation by setting untyped
 			current["@instanceof"] = untyped __instanceof;

+ 2 - 0
std/neko/Boot.hx

@@ -64,6 +64,8 @@ class Boot {
 			Date = NekoDate__;
 			Int = __dollar__new(null);
 			Float = __dollar__new(null);
+			Bool.true = true;
+			Bool.false = false;
 		}
 	}
 

+ 2 - 0
typer.ml

@@ -695,6 +695,8 @@ and type_switch ctx e cases def need_val p =
 		| TMono _ -> lookup_enum (List.map fst cases)
 		| _ -> None
 	) in
+	(* does not treat Bool as an matchable enum, since it's a native type *)
+	let enum = (match enum with None | Some ({ e_path = ([],"Bool") },_) -> None | _ -> enum) in
 	let ecases = ref PMap.empty in
 	let cases = List.map (fun (e1,e2) ->
 		let locals = save_locals ctx in