[Pkg-ocaml-maint-commits] [atdgen] 03/16: Imported Upstream version 1.4.1

Stéphane Glondu glondu at moszumanska.debian.org
Thu Jan 28 10:29:22 UTC 2016


This is an automated email from the git hooks/post-receive script.

glondu pushed a commit to branch master
in repository atdgen.

commit 5ff4559ca16048b19caf3d446844025c72cb3e97
Author: Stephane Glondu <steph at glondu.net>
Date:   Thu Jan 28 09:51:46 2016 +0100

    Imported Upstream version 1.4.1
---
 Makefile      |  2 +-
 ag_ob_emit.ml |  3 ++-
 ag_oj_emit.ml |  3 ++-
 ag_ov_emit.ml | 37 +++++++++++++++++++------------------
 ag_ox_emit.ml |  5 +++++
 test.atd      |  3 +++
 6 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/Makefile b/Makefile
index 36be845..1555641 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION = 1.4.0
+VERSION = 1.4.1
 ifeq "$(shell ocamlc -config |grep os_type)" "os_type: Win32"
 EXE=.exe
 else
diff --git a/ag_ob_emit.ml b/ag_ob_emit.ml
index 59eb60b..86f8339 100644
--- a/ag_ob_emit.ml
+++ b/ag_ob_emit.ml
@@ -122,7 +122,7 @@ val %s_of_string :%s
           full_name
           s;
 
-        if with_create then
+        if with_create && Ag_ox_emit.is_exportable x then
           let create_record_intf, create_record_impl =
             Ag_ox_emit.make_record_creator deref x
           in
@@ -1419,6 +1419,7 @@ let make_ocaml_biniou_impl ~with_create ~original_types buf deref defs =
   if with_create then
     List.iter (
       fun (is_rec, l) ->
+        let l = List.filter Ag_ox_emit.is_exportable l in
         List.iter (
           fun x ->
             let intf, impl = Ag_ox_emit.make_record_creator deref x in
diff --git a/ag_oj_emit.ml b/ag_oj_emit.ml
index 257283f..c967190 100644
--- a/ag_oj_emit.ml
+++ b/ag_oj_emit.ml
@@ -98,7 +98,7 @@ val %s_of_string :%s
           full_name
           s;
 
-        if with_create then
+        if with_create && Ag_ox_emit.is_exportable x then
           let create_record_intf, create_record_impl =
             Ag_ox_emit.make_record_creator deref x
           in
@@ -1275,6 +1275,7 @@ let make_ocaml_json_impl
   if with_create then
     List.iter (
       fun (is_rec, l) ->
+        let l = List.filter Ag_ox_emit.is_exportable l in
         List.iter (
           fun x ->
             let intf, impl = Ag_ox_emit.make_record_creator deref x in
diff --git a/ag_ov_emit.ml b/ag_ov_emit.ml
index 2ceabdc..d884130 100644
--- a/ag_ov_emit.ml
+++ b/ag_ov_emit.ml
@@ -14,25 +14,25 @@ let name_of_var s = "_" ^ s
 let make_ocaml_validate_intf ~with_create buf deref defs =
   List.iter (
     fun x ->
-      let s = x.def_name in
-      if s <> "" && s.[0] <> '_' && x.def_value <> None then (
-        if with_create then (
-          let create_record_intf, create_record_impl =
-            Ag_ox_emit.make_record_creator deref x
-          in
-          bprintf buf "%s" create_record_intf;
-        );
-
-        let full_name = Ag_ox_emit.get_full_type_name x in
-        let validator_params =
-          String.concat "" (
-            List.map
-              (fun s ->
-                sprintf "\n  (Ag_util.Validation.path -> '%s -> \
-                             Ag_util.Validation.error option) ->" s)
-              x.def_param
-          )
+      if with_create && Ag_ox_emit.is_exportable x then (
+        let create_record_intf, create_record_impl =
+          Ag_ox_emit.make_record_creator deref x
         in
+        bprintf buf "%s" create_record_intf;
+      );
+
+      let full_name = Ag_ox_emit.get_full_type_name x in
+      let validator_params =
+        String.concat "" (
+          List.map
+            (fun s ->
+               sprintf "\n  (Ag_util.Validation.path -> '%s -> \
+                        Ag_util.Validation.error option) ->" s)
+            x.def_param
+        )
+      in
+      let s = x.def_name in
+      if Ag_ox_emit.is_exportable x then (
         bprintf buf "\
 val validate_%s :%s
   Ag_util.Validation.path -> %s -> Ag_util.Validation.error option
@@ -413,6 +413,7 @@ let make_ocaml_validate_impl ~with_create ~original_types buf deref defs =
   if with_create then
     List.iter (
       fun (is_rec, l) ->
+        let l = List.filter Ag_ox_emit.is_exportable l in
         List.iter (
           fun x ->
             let intf, impl = Ag_ox_emit.make_record_creator deref x in
diff --git a/ag_ox_emit.ml b/ag_ox_emit.ml
index e80185f..90c8efe 100644
--- a/ag_ox_emit.ml
+++ b/ag_ox_emit.ml
@@ -242,6 +242,11 @@ end
         write_file (prefix ^ ".mli") mli;
         write_file (prefix ^ ".ml") ml
 
+let is_exportable def =
+  let s = def.def_name in
+  s <> "" && s.[0] <> '_'
+  && def.def_value <> None
+
 let make_record_creator deref x =
   match x.def_value with
       Some (`Record (loc, a, `Record `Record, _)) ->
diff --git a/test.atd b/test.atd
index a5e2004..7e3f5d1 100644
--- a/test.atd
+++ b/test.atd
@@ -196,3 +196,6 @@ type precision = {
   small_2 : float <json precision="2">;
   large_2 : float <json precision="2">;
 }
+
+type 'a generic = { x294623: int; }
+type specialized = string generic

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/atdgen.git



More information about the Pkg-ocaml-maint-commits mailing list