瀏覽代碼

[java/cs] "never" accessor will not generate getter/setter code anymore. Fixed issue #1638

Caue Waneck 12 年之前
父節點
當前提交
267d192690
共有 1 個文件被更改,包括 9 次插入1 次删除
  1. 9 1
      gencommon.ml

+ 9 - 1
gencommon.ml

@@ -6891,7 +6891,15 @@ struct
 
       let get_fields static =
         let ret = collect_fields cl ( if is_float || is_set then Some (false) else None ) (Some static) in
-        let ret = if is_set then List.filter (fun (_,cf) -> not (Meta.has Meta.ReadOnly cf.cf_meta)) ret else ret in
+        let ret = if is_set then List.filter (fun (_,cf) ->
+          match cf.cf_kind with
+          | Var { v_write = AccNever } -> false
+          | _ -> not (Meta.has Meta.ReadOnly cf.cf_meta)) ret
+        else
+          List.filter (fun (_,cf) ->
+          match cf.cf_kind with
+          | Var { v_read = AccNever } -> false
+          | _ -> true) ret in
         if is_float then
           List.filter (fun (_,cf) -> (* TODO: maybe really apply_params in cf.cf_type. The benefits would be limited, though *)
             match follow (ctx.rcf_gen.greal_type (ctx.rcf_gen.gfollow#run_f cf.cf_type)) with