Skip to content
This repository
Browse code

[enhance] opadoc: add is_module info to .api file

  • Loading branch information...
commit 8c527430cc209df5058ccdb3b9f2dbc12274d348 1 parent 2ab5e46
Frederic Ye authored September 25, 2012
2  compiler/libqmlcompil/qmlAst.ml
@@ -675,6 +675,7 @@ end
675 675
 *)
676 676
 type ty_def_options = {
677 677
   opacapi : bool ;
  678
+  is_module : bool ;
678 679
   warn_x_field : unit ;
679 680
 }
680 681
 
@@ -685,6 +686,7 @@ type ty_def_options = {
685 686
 *)
686 687
 let ty_def_options = {
687 688
   opacapi = false ;
  689
+  is_module = false ;
688 690
   warn_x_field = () ;
689 691
 }
690 692
 
6  compiler/opa/pass_OpaDocApi.ml
@@ -546,6 +546,7 @@ struct
546 546
         JsonTypes.Array params
547 547
       in
548 548
       let opacapi = bool type_def.QmlAst.ty_def_options.QmlAst.opacapi in
  549
+      let is_module = bool type_def.QmlAst.ty_def_options.QmlAst.is_module in
549 550
       let visibility =
550 551
         match type_def.QmlAst.ty_def_visibility with
551 552
         | Q.TDV_public ->
@@ -568,7 +569,10 @@ struct
568 569
       let tuple = JsonTypes.Record [
569 570
         "ty_def_visibility", visibility ;
570 571
         "ty_def_params", params ;
571  
-	"ty_def_opacapi", opacapi ;
  572
+	"ty_def_options", JsonTypes.Record [
  573
+	  "opacapi", opacapi ;
  574
+	  "is_module", is_module ;
  575
+	];
572 576
         "ty_def_name", name ;
573 577
         "ty_def_body", body ;
574 578
       ] in
15  compiler/opalang/opaToQml.ml
@@ -261,14 +261,8 @@ struct
261 261
          , ty t)
262 262
     | SA.TypeModule fields ->
263 263
         let aux_module_field (s, t) =
264  
-          Arg.add_local_scope ();
265 264
           let t = ty t in
266  
-          let (ty_vars, row_vars, col_vars) as vars = Arg.get_local_vars () in
267  
-          let t_quantified =
268  
-            if vars = ([], [], []) then t
269  
-            else QA.TypeForall (ty_vars, row_vars, col_vars, t) in
270  
-          Arg.remove_local_scope () ;
271  
-          (s, t_quantified) in
  265
+          (s, t) in
272 266
         let fields = List.map aux_module_field fields in
273 267
         QA.TypeRecord(QA.TyRow(fields, None))
274 268
 
@@ -332,9 +326,14 @@ struct
332 326
            QmlAst.TDV_abstract (ObjectFiles.get_current_package_name ())
333 327
        | SA.TDV_private ->
334 328
            QmlAst.TDV_private (ObjectFiles.get_current_package_name ())) in
  329
+    let is_module =
  330
+      match fst(ty_def.SurfaceAst.ty_def_body) with
  331
+      | SA.TypeModule _ -> true
  332
+      | _ -> false in
  333
+    let options = { ty_def.SA.ty_def_options with QmlAst.is_module = is_module } in
335 334
     let SA.Typeident ti = ty_def.SurfaceAst.ty_def_name in
336 335
     {
337  
-      QmlAst.ty_def_options = ty_def.SA.ty_def_options ;
  336
+      QmlAst.ty_def_options = options ;
338 337
       QmlAst.ty_def_visibility = visibility' ;
339 338
       QmlAst.ty_def_name = Arg.typeident ~check:false ti ;
340 339
       QmlAst.ty_def_params = vars ;
2  compiler/passes/surfaceAstRenaming.ml
@@ -1005,7 +1005,7 @@ and f_ty_node label (all_env:Ident.t list all_envs) hierar = function
1005 1005
       f_env, TypeForall (tvars,rvars,cvars,t)
1006 1006
   | TypeModule fields ->
1007 1007
       let f_env, fields = f_module_fields all_env hierar fields in
1008  
-      f_env, TypeRecord (TyRow (fields, None))
  1008
+      f_env, TypeModule fields
1009 1009
 
1010 1010
 and f_flatvar label (all_env:Ident.t list all_envs) hierar (Flatvar name) =
1011 1011
   let f_env, name = f_typevar label all_env hierar name in

0 notes on commit 8c52743

Please sign in to comment.
Something went wrong with that request. Please try again.