Browse Source

[display] always generate `@:value`

Simon Krajewski 7 years ago
parent
commit
21f262f410
2 changed files with 5 additions and 12 deletions
  1. 4 11
      src/typing/typeload.ml
  2. 1 1
      src/typing/typeloadFields.ml

+ 4 - 11
src/typing/typeload.ml

@@ -201,18 +201,11 @@ let check_param_constraints ctx types t pl c p =
 
 		) ctl
 
-let requires_value_meta com co =
-	Common.defined com Define.DocGen || com.display.dms_kind <> DMNone || (match co with
-		| None -> false
-		| Some c -> c.cl_extern || Meta.has Meta.Rtti c.cl_meta)
-
 let generate_value_meta com co fadd args =
-	if requires_value_meta com co then begin
-		let values = List.fold_left (fun acc ((name,p),_,_,_,eo) -> match eo with Some e -> ((name,p,NoQuotes),e) :: acc | _ -> acc) [] args in
-		match values with
-			| [] -> ()
-			| _ -> fadd (Meta.Value,[EObjectDecl values,null_pos],null_pos)
-	end
+	let values = List.fold_left (fun acc ((name,p),_,_,_,eo) -> match eo with Some e -> ((name,p,NoQuotes),e) :: acc | _ -> acc) [] args in
+	match values with
+		| [] -> ()
+		| _ -> fadd (Meta.Value,[EObjectDecl values,null_pos],null_pos)
 
 let pselect p1 p2 =
 	if p1 = null_pos then p2 else p1

+ 1 - 1
src/typing/typeloadFields.ml

@@ -645,7 +645,7 @@ let bind_var (ctx,cctx,fctx) cf e =
 	| None ->
 		check_field_display ctx fctx c cf;
 	| Some e ->
-		if requires_value_meta ctx.com (Some c) then cf.cf_meta <- ((Meta.Value,[e],null_pos) :: cf.cf_meta);
+		cf.cf_meta <- ((Meta.Value,[e],null_pos) :: cf.cf_meta);
 		let check_cast e =
 			(* insert cast to keep explicit field type (issue #1901) *)
 			if type_iseq e.etype cf.cf_type then