summary refs log tree commit diff
path: root/src/comp/metadata/tyencode.rs
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2011-07-19 17:52:34 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2011-07-19 18:57:28 -0700
commitbd4aeef78bcc8e03ef9275e7652f91b936f5dec6 (patch)
treedebdaf33fc8968b764b2782ea05fdea5cd5e4ae3 /src/comp/metadata/tyencode.rs
parentda2a7e5bd25055de1573a7f862986522213ed1ca (diff)
Beginnings of support for constrained types
Programs with constrained types now parse and typecheck, but
typestate doesn't check them specially, so the one relevant test
case so far is XFAILed.

Also rewrote all of the constraint-related data structures in the
process (again), for some reason. I got rid of a superfluous
data structure in the context that was mapping front-end constraints
to resolved constraints, instead handling constraints in the same
way in which everything else gets resolved.
Diffstat (limited to 'src/comp/metadata/tyencode.rs')
-rw-r--r--src/comp/metadata/tyencode.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/comp/metadata/tyencode.rs b/src/comp/metadata/tyencode.rs
index 3b3ce6b3866..e239d678174 100644
--- a/src/comp/metadata/tyencode.rs
+++ b/src/comp/metadata/tyencode.rs
@@ -8,7 +8,7 @@ import std::int;
 import std::uint;
 import syntax::ast::*;
 import middle::ty;
-import syntax::print::pprust::lit_to_str;
+import syntax::print::pprust::*;
 import util::common;
 
 export ctxt;
@@ -199,8 +199,9 @@ fn enc_proto(&ioivec::writer w, proto proto) {
         case (proto_fn) { w.write_char('F'); }
     }
 }
+
 fn enc_ty_fn(&ioivec::writer w, &@ctxt cx, &ty::arg[] args, &ty::t out,
-             &controlflow cf, &(@ty::constr_def)[] constrs) {
+             &controlflow cf, &(@ty::constr)[] constrs) {
     w.write_char('[');
     for (ty::arg arg in args) {
         alt (arg.mode) {
@@ -214,7 +215,7 @@ fn enc_ty_fn(&ioivec::writer w, &@ctxt cx, &ty::arg[] args, &ty::t out,
     }
     w.write_char(']');
     auto colon = true;
-    for (@ty::constr_def c in constrs) {
+    for (@ty::constr c in constrs) {
         if (colon) {
             w.write_char(':');
             colon = false;
@@ -227,7 +228,8 @@ fn enc_ty_fn(&ioivec::writer w, &@ctxt cx, &ty::arg[] args, &ty::t out,
     }
 
 }
-fn enc_constr(&ioivec::writer w, &@ctxt cx, &@ty::constr_def c) {
+
+fn enc_constr(&ioivec::writer w, &@ctxt cx, &@ty::constr c) {
     w.write_str(path_to_str(c.node.path));
     w.write_char('(');
     w.write_str(cx.ds(c.node.id));