Browse Source

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

Aleksandr Kuzmenko 6 năm trước cách đây
mục cha
commit
d15bbe0b43
2 tập tin đã thay đổi với 5 bổ sung1 xóa
  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;
 				{ e with eexpr = TBlock(List.rev ret) }
 			| 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_vt = is_null_t v.etype in
 				(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
 	**/
 	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