|
@@ -108,6 +108,14 @@ let tid (x : 'a index) : int = Obj.magic x
|
|
let ethis = mk (TConst TThis) (mk_mono()) null_pos
|
|
let ethis = mk (TConst TThis) (mk_mono()) null_pos
|
|
let dynamic_prop = HMMultiNameLate [HNPublic (Some "")]
|
|
let dynamic_prop = HMMultiNameLate [HNPublic (Some "")]
|
|
|
|
|
|
|
|
+let is_special_compare e1 e2 =
|
|
|
|
+ match e1.eexpr, e2.eexpr with
|
|
|
|
+ | TConst TNull, _ | _ , TConst TNull -> None
|
|
|
|
+ | _ ->
|
|
|
|
+ match follow e1.etype, follow e2.etype with
|
|
|
|
+ | TInst ({ cl_path = [],"Xml" } as c,_) , _ | _ , TInst ({ cl_path = [],"Xml" } as c,_) -> Some c
|
|
|
|
+ | _ -> None
|
|
|
|
+
|
|
let write ctx op =
|
|
let write ctx op =
|
|
DynArray.add ctx.code op;
|
|
DynArray.add ctx.code op;
|
|
ctx.infos.ipos <- ctx.infos.ipos + 1;
|
|
ctx.infos.ipos <- ctx.infos.ipos + 1;
|
|
@@ -1554,14 +1562,11 @@ and gen_binop ctx retval op e1 e2 t p =
|
|
write ctx (HOp o)
|
|
write ctx (HOp o)
|
|
in
|
|
in
|
|
let gen_eq() =
|
|
let gen_eq() =
|
|
- match e1.eexpr, e2.eexpr with
|
|
|
|
- | TConst TNull, _ | _ , TConst TNull -> gen_op A3OEq
|
|
|
|
- | _ ->
|
|
|
|
- match follow e1.etype, follow e2.etype with
|
|
|
|
- | TInst ({ cl_path = [],"Xml" } as c,_) , _ | _ , TInst ({ cl_path = [],"Xml" } as c,_) ->
|
|
|
|
- gen_expr ctx true (mk (TCall (mk (TField (mk (TTypeExpr (TClassDecl c)) t_dynamic p,"compare")) t_dynamic p,[e1;e2])) ctx.com.basic.tbool p);
|
|
|
|
- | _ ->
|
|
|
|
|
|
+ match is_special_compare e1 e2 with
|
|
|
|
+ | None ->
|
|
gen_op A3OEq
|
|
gen_op A3OEq
|
|
|
|
+ | Some c ->
|
|
|
|
+ gen_expr ctx true (mk (TCall (mk (TField (mk (TTypeExpr (TClassDecl c)) t_dynamic p,"compare")) t_dynamic p,[e1;e2])) ctx.com.basic.tbool p);
|
|
in
|
|
in
|
|
match op with
|
|
match op with
|
|
| OpAssign ->
|
|
| OpAssign ->
|
|
@@ -1664,8 +1669,8 @@ and jump_expr_gen ctx e jif jfun =
|
|
jfun (if jif then t else f)
|
|
jfun (if jif then t else f)
|
|
in
|
|
in
|
|
(match op with
|
|
(match op with
|
|
- | OpEq -> j J3Eq J3Neq
|
|
|
|
- | OpNotEq -> j J3Neq J3Eq
|
|
|
|
|
|
+ | OpEq when is_special_compare e1 e2 = None -> j J3Eq J3Neq
|
|
|
|
+ | OpNotEq when is_special_compare e1 e2 = None -> j J3Neq J3Eq
|
|
| OpGt -> j J3Gt J3NotGt
|
|
| OpGt -> j J3Gt J3NotGt
|
|
| OpGte -> j J3Gte J3NotGte
|
|
| OpGte -> j J3Gte J3NotGte
|
|
| OpLt -> j J3Lt J3NotLt
|
|
| OpLt -> j J3Lt J3NotLt
|