From 7fa0a5d52f23152b26b2f46ba05fa584d7638037 Mon Sep 17 00:00:00 2001 From: Bourgerie Quentin Date: Mon, 16 Apr 2012 15:28:32 +0200 Subject: [PATCH] [feature] compiler, database: Inspect the next node when seletc id for compute default values --- libqmlcompil/dbGen/dbGen_private.ml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/libqmlcompil/dbGen/dbGen_private.ml b/libqmlcompil/dbGen/dbGen_private.ml index bed33700..a3f032db 100644 --- a/libqmlcompil/dbGen/dbGen_private.ml +++ b/libqmlcompil/dbGen/dbGen_private.ml @@ -102,11 +102,20 @@ module Default = struct H.make_dot ~ty (expr_aux sch (E.src e)) (SchemaGraphLib.fieldname_of_edge e) else match (V.label n).C.nlabel with - | C.Multi -> (match SchemaGraphLib.multi_key sch n with - | C.Kint -> H.make_record ["empty", H.make_record []] - | C.Kstring -> H.make_record ["empty", H.make_record []] - | C.Kfields _ -> H.make_record ["empty", H.make_record []] - (* TODO - ... *)) + | C.Multi -> + begin match select with + | DbAst.SStar | DbAst.SNil -> + begin match SchemaGraphLib.multi_key sch n with + | C.Kint -> H.make_record ["empty", H.make_record []] + | C.Kstring -> H.make_record ["empty", H.make_record []] + | C.Kfields _ -> H.make_record ["empty", H.make_record []] + end + | DbAst.SSlice _ | DbAst.SFlds _ -> + OManager.i_error + "On compute default value unexpected selection on a multi node" + | DbAst.SId (_, select) -> expr_aux ~select sch (SchemaGraph.unique_next sch n) + + end | C.Hidden -> expr_aux sch (SchemaGraph.unique_next sch n) | C.Sum -> H.convert_case_to_sum ty (expr_aux sch (E.dst (Schema_private.find_nonrec_child_edge sch n))) | C.Product ->