about summary refs log tree commit diff
path: root/src/comp/syntax/util
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-07-01 16:59:03 -0700
committerPatrick Walton <pcwalton@mimiga.net>2011-07-06 11:09:06 -0700
commitbd7a072266d07352bf221d0664865069a1bc3dcd (patch)
treed63854f2d3a37cd1814fc4c89d601e118e6b7e2d /src/comp/syntax/util
parentb9a2117475be082b2f93bbcb836b1f05ea52b5e2 (diff)
downloadrust-bd7a072266d07352bf221d0664865069a1bc3dcd.tar.gz
rust-bd7a072266d07352bf221d0664865069a1bc3dcd.zip
rustc: Move the interner over to interior vectors
Diffstat (limited to 'src/comp/syntax/util')
-rw-r--r--src/comp/syntax/util/interner.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/comp/syntax/util/interner.rs b/src/comp/syntax/util/interner.rs
index e096b953a89..9717e30d6e6 100644
--- a/src/comp/syntax/util/interner.rs
+++ b/src/comp/syntax/util/interner.rs
@@ -1,7 +1,7 @@
 // An "interner" is a data structure that associates values with uint tags and
 // allows bidirectional lookup; i.e. given a value, one can easily find the
 // type, and vice versa.
-import std::vec;
+import std::ivec;
 import std::map;
 import std::map::hashmap;
 import std::map::hashfn;
@@ -12,24 +12,24 @@ import std::option::some;
 
 type interner[T] =
     rec(hashmap[T, uint] map,
-        mutable vec[T] vect,
+        mutable T[] vect,
         hashfn[T] hasher,
         eqfn[T] eqer);
 
 fn mk[T](hashfn[T] hasher, eqfn[T] eqer) -> interner[T] {
     auto m = map::mk_hashmap[T, uint](hasher, eqer);
-    let vec[T] vect = [];
-    ret rec(map=m, mutable vect=vect, hasher=hasher, eqer=eqer);
+    ret rec(map=m, mutable vect=~[], hasher=hasher, eqer=eqer);
 }
 fn intern[T](&interner[T] itr, &T val) -> uint {
     alt (itr.map.find(val)) {
         case (some(?idx)) { ret idx; }
         case (none) {
-            auto new_idx = vec::len[T](itr.vect);
+            auto new_idx = ivec::len[T](itr.vect);
             itr.map.insert(val, new_idx);
-            itr.vect += [val];
+            itr.vect += ~[val];
             ret new_idx;
         }
     }
 }
 fn get[T](&interner[T] itr, uint idx) -> T { ret itr.vect.(idx); }
+