aboutsummaryrefslogtreecommitdiff
path: root/src/boot/me
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-09-14 10:52:32 -0700
committerGraydon Hoare <[email protected]>2010-09-14 10:52:32 -0700
commit7287d3aaa0545a9b22cea874f2d751de4fefd23d (patch)
treed35680fc38e9a559d466be476066bb34243415e2 /src/boot/me
parentUpdate manual to cover change to nominal tag items. (diff)
downloadrust-7287d3aaa0545a9b22cea874f2d751de4fefd23d.tar.xz
rust-7287d3aaa0545a9b22cea874f2d751de4fefd23d.zip
Teach front-end about simple, first-cut version of const items.
Diffstat (limited to 'src/boot/me')
-rw-r--r--src/boot/me/semant.ml1
-rw-r--r--src/boot/me/type.ml1
-rw-r--r--src/boot/me/walk.ml3
3 files changed, 5 insertions, 0 deletions
diff --git a/src/boot/me/semant.ml b/src/boot/me/semant.ml
index 9521df94..463acadb 100644
--- a/src/boot/me/semant.ml
+++ b/src/boot/me/semant.ml
@@ -1366,6 +1366,7 @@ let ty_of_mod_item (item:Ast.mod_item) : Ast.ty =
Ast.MOD_ITEM_type _ -> Ast.TY_type
| Ast.MOD_ITEM_fn f -> (Ast.TY_fn (ty_fn_of_fn f))
| Ast.MOD_ITEM_mod _ -> bug () "Semant.ty_of_mod_item on mod"
+ | Ast.MOD_ITEM_const (ty, _) -> ty
| Ast.MOD_ITEM_obj ob ->
let taux = { Ast.fn_effect = Ast.PURE;
Ast.fn_is_iter = false }
diff --git a/src/boot/me/type.ml b/src/boot/me/type.ml
index ccf5c534..b576af86 100644
--- a/src/boot/me/type.ml
+++ b/src/boot/me/type.ml
@@ -295,6 +295,7 @@ let check_stmt (cx:Semant.ctxt) : (fn_ctx -> Ast.stmt -> unit) =
LTYPE_mono ty
else
LTYPE_poly ((Array.map (fun p -> p.Common.node) params), ty)
+ | Ast.MOD_ITEM_const (ty, _) -> LTYPE_mono ty
| Ast.MOD_ITEM_type _ ->
Common.err None "Type-item used in non-type context"
in
diff --git a/src/boot/me/walk.ml b/src/boot/me/walk.ml
index 09cde999..7b89cbd8 100644
--- a/src/boot/me/walk.ml
+++ b/src/boot/me/walk.ml
@@ -173,6 +173,9 @@ and walk_mod_item
let children _ =
match item.node.Ast.decl_item with
Ast.MOD_ITEM_type (_, ty) -> walk_ty v ty
+ | Ast.MOD_ITEM_const (ty, e) ->
+ walk_ty v ty;
+ walk_option (walk_expr v) e
| Ast.MOD_ITEM_fn f -> walk_fn v f item.id
| Ast.MOD_ITEM_tag (hdr, _, _) ->
walk_header_slots v hdr