|
@@ -40,6 +40,16 @@ type context = {
|
|
|
mutable constructor_block : bool;
|
|
mutable constructor_block : bool;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+let is_var_field e v =
|
|
|
|
|
+ match e.eexpr, follow e.etype with
|
|
|
|
|
+ | TTypeExpr (TClassDecl c),_
|
|
|
|
|
+ | _,TInst(c,_) ->
|
|
|
|
|
+ (try
|
|
|
|
|
+ let f = try PMap.find v c.cl_fields with Not_found -> PMap.find v c.cl_statics in
|
|
|
|
|
+ (match f.cf_kind with Var _ -> true | _ -> false)
|
|
|
|
|
+ with Not_found -> false)
|
|
|
|
|
+ | _ -> false
|
|
|
|
|
+
|
|
|
let protect name =
|
|
let protect name =
|
|
|
match name with
|
|
match name with
|
|
|
| "Error" | "Namespace" -> "_" ^ name
|
|
| "Error" | "Namespace" -> "_" ^ name
|
|
@@ -407,6 +417,13 @@ let rec gen_call ctx e el r =
|
|
|
print ctx ")";
|
|
print ctx ")";
|
|
|
| _ -> assert false)
|
|
| _ -> assert false)
|
|
|
| _ -> assert false)
|
|
| _ -> assert false)
|
|
|
|
|
+ | TField(ee,v),args when is_var_field ee v ->
|
|
|
|
|
+ spr ctx "(";
|
|
|
|
|
+ gen_value ctx e;
|
|
|
|
|
+ spr ctx ")";
|
|
|
|
|
+ spr ctx "(";
|
|
|
|
|
+ concat ctx "," (gen_value ctx) el;
|
|
|
|
|
+ spr ctx ")"
|
|
|
| _ ->
|
|
| _ ->
|
|
|
gen_value ctx e;
|
|
gen_value ctx e;
|
|
|
spr ctx "(";
|
|
spr ctx "(";
|