Permalink
Browse files

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

  • Loading branch information...
1 parent 2ab5e46 commit 8c527430cc209df5058ccdb3b9f2dbc12274d348 @Aqua-Ye Aqua-Ye committed Sep 25, 2012
View
2 compiler/libqmlcompil/qmlAst.ml
@@ -675,6 +675,7 @@ end
*)
type ty_def_options = {
opacapi : bool ;
+ is_module : bool ;
warn_x_field : unit ;
}
@@ -685,6 +686,7 @@ type ty_def_options = {
*)
let ty_def_options = {
opacapi = false ;
+ is_module = false ;
warn_x_field = () ;
}
View
6 compiler/opa/pass_OpaDocApi.ml
@@ -546,6 +546,7 @@ struct
JsonTypes.Array params
in
let opacapi = bool type_def.QmlAst.ty_def_options.QmlAst.opacapi in
+ let is_module = bool type_def.QmlAst.ty_def_options.QmlAst.is_module in
let visibility =
match type_def.QmlAst.ty_def_visibility with
| Q.TDV_public ->
@@ -568,7 +569,10 @@ struct
let tuple = JsonTypes.Record [
"ty_def_visibility", visibility ;
"ty_def_params", params ;
- "ty_def_opacapi", opacapi ;
+ "ty_def_options", JsonTypes.Record [
+ "opacapi", opacapi ;
+ "is_module", is_module ;
+ ];
"ty_def_name", name ;
"ty_def_body", body ;
] in
View
15 compiler/opalang/opaToQml.ml
@@ -261,14 +261,8 @@ struct
, ty t)
| SA.TypeModule fields ->
let aux_module_field (s, t) =
- Arg.add_local_scope ();
let t = ty t in
- let (ty_vars, row_vars, col_vars) as vars = Arg.get_local_vars () in
- let t_quantified =
- if vars = ([], [], []) then t
- else QA.TypeForall (ty_vars, row_vars, col_vars, t) in
- Arg.remove_local_scope () ;
- (s, t_quantified) in
+ (s, t) in
let fields = List.map aux_module_field fields in
QA.TypeRecord(QA.TyRow(fields, None))
@@ -332,9 +326,14 @@ struct
QmlAst.TDV_abstract (ObjectFiles.get_current_package_name ())
| SA.TDV_private ->
QmlAst.TDV_private (ObjectFiles.get_current_package_name ())) in
+ let is_module =
+ match fst(ty_def.SurfaceAst.ty_def_body) with
+ | SA.TypeModule _ -> true
+ | _ -> false in
+ let options = { ty_def.SA.ty_def_options with QmlAst.is_module = is_module } in
let SA.Typeident ti = ty_def.SurfaceAst.ty_def_name in
{
- QmlAst.ty_def_options = ty_def.SA.ty_def_options ;
+ QmlAst.ty_def_options = options ;
QmlAst.ty_def_visibility = visibility' ;
QmlAst.ty_def_name = Arg.typeident ~check:false ti ;
QmlAst.ty_def_params = vars ;
View
2 compiler/passes/surfaceAstRenaming.ml
@@ -1005,7 +1005,7 @@ and f_ty_node label (all_env:Ident.t list all_envs) hierar = function
f_env, TypeForall (tvars,rvars,cvars,t)
| TypeModule fields ->
let f_env, fields = f_module_fields all_env hierar fields in
- f_env, TypeRecord (TyRow (fields, None))
+ f_env, TypeModule fields
and f_flatvar label (all_env:Ident.t list all_envs) hierar (Flatvar name) =
let f_env, name = f_typevar label all_env hierar name in

0 comments on commit 8c52743

Please sign in to comment.