Quellcode durchsuchen

[cs] use the type of `v` in `TLocal v` instead of the type of `TLocal v`

Aleksandr Kuzmenko vor 6 Jahren
Ursprung
Commit
d15bbe0b43
2 geänderte Dateien mit 5 neuen und 1 gelöschten Zeilen
  1. 4 0
      src/codegen/gencommon/hardNullableSynf.ml
  2. 1 1
      std/cs/Flags.hx

+ 4 - 0
src/codegen/gencommon/hardNullableSynf.ml

@@ -127,6 +127,10 @@ let configure gen unwrap_null wrap_val null_to_dynamic has_value opeq_handler =
 				cur_block := lst;
 				cur_block := lst;
 				{ e with eexpr = TBlock(List.rev ret) }
 				{ e with eexpr = TBlock(List.rev ret) }
 			| TCast(v, _) ->
 			| TCast(v, _) ->
+				let v = match v.eexpr with
+					| TLocal l -> { v with etype = l.v_type }
+					| _ -> v
+				in
 				let null_et = is_null_t e.etype in
 				let null_et = is_null_t e.etype in
 				let null_vt = is_null_t v.etype in
 				let null_vt = is_null_t v.etype in
 				(match null_vt, null_et with
 				(match null_vt, null_et with

+ 1 - 1
std/cs/Flags.hx

@@ -38,7 +38,7 @@ abstract Flags<T:EnumValue>(T) from T to T {
 		the default enum value for an empty flags attribute is specified
 		the default enum value for an empty flags attribute is specified
 	**/
 	**/
 	extern inline public function new(?initial:T)
 	extern inline public function new(?initial:T)
-		this = initial;
+		this = initial == null ? cast null : initial;
 
 
 	/**
 	/**
 		Accessible through the bitwise OR operator (`|`). Returns a new `Flags` type with the flags
 		Accessible through the bitwise OR operator (`|`). Returns a new `Flags` type with the flags