aboutsummaryrefslogtreecommitdiff
path: root/src/comp
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-04-22 13:45:21 -0700
committerPatrick Walton <[email protected]>2011-04-22 13:45:21 -0700
commit14d1c53a9c3570f91ede7d7ad9c8c1ad9ddef7f3 (patch)
treeb3691a5b69f2ff8bf0683b66b3e4470698f1b364 /src/comp
parentrustc: Switch @ty.t to ty.t so that we can change it to a uint (diff)
downloadrust-14d1c53a9c3570f91ede7d7ad9c8c1ad9ddef7f3.tar.xz
rust-14d1c53a9c3570f91ede7d7ad9c8c1ad9ddef7f3.zip
rustc: Remove direct access to the cname field of types
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/ty.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs
index eca80aff..29b2aeee 100644
--- a/src/comp/middle/ty.rs
+++ b/src/comp/middle/ty.rs
@@ -217,6 +217,9 @@ fn mk_native(@type_store ts) -> t { ret gen_ty(ts, ty_native); }
// Returns the one-level-deep type structure of the given type.
fn struct(t typ) -> sty { ret typ.struct; }
+// Returns the canonical name of the given type.
+fn cname(t typ) -> option.t[str] { ret typ.cname; }
+
// Stringification
@@ -346,7 +349,7 @@ fn ty_to_str(&t typ) -> str {
}
case (ty_obj(?meths)) {
- alt (typ.cname) {
+ alt (cname(typ)) {
case (some[str](?cs)) {
s += cs;
}
@@ -1214,15 +1217,15 @@ fn eq_ty_full(&t a, &t b) -> bool {
}
// Check canonical names.
- alt (a.cname) {
+ alt (cname(a)) {
case (none[str]) {
- alt (b.cname) {
+ alt (cname(b)) {
case (none[str]) { /* ok */ }
case (_) { ret false; }
}
}
case (some[str](?s_a)) {
- alt (b.cname) {
+ alt (cname(b)) {
case (some[str](?s_b)) {
if (!_str.eq(s_a, s_b)) { ret false; }
}