Browse Source

check before-super() variable reset for KDynamic as well (close #2371)

Nicolas Cannasse 11 năm trước cách đây
mục cha
commit
6d6353ac5d
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      genswf9.ml

+ 2 - 2
genswf9.ml

@@ -2043,8 +2043,8 @@ let check_constructor ctx c f =
 		Type.iter loop e;
 		match e.eexpr with
 		| TCall ({ eexpr = TConst TSuper },_) -> raise Exit
-		| TBinop (OpAssign,{ eexpr = TField({ eexpr = TConst TThis },FInstance (cc,cf)) },_) when c != cc && classify ctx cf.cf_type = KFloat ->
-			error "You cannot assign a super class Float before calling super() in flash, this will reset it to NaN" e.epos
+		| TBinop (OpAssign,{ eexpr = TField({ eexpr = TConst TThis },FInstance (cc,cf)) },_) when c != cc && (match classify ctx cf.cf_type with KFloat | KDynamic -> true | _ -> false) ->
+			error "You cannot assign some super class vars before calling super() in flash, this will reset them to default value" e.epos
 		| _ -> ()
 	in
 	try