rustc: Generate shapes
This commit is contained in:
parent
6bb6922c28
commit
4061ca2bbd
6 changed files with 625 additions and 19 deletions
|
|
@ -20,6 +20,7 @@ fn mk[@T](hasher: hashfn[T], eqer: eqfn[T]) -> interner[T] {
|
|||
let m = map::mk_hashmap[T, uint](hasher, eqer);
|
||||
ret {map: m, mutable vect: ~[], hasher: hasher, eqer: eqer};
|
||||
}
|
||||
|
||||
fn intern[@T](itr: &interner[T], val: &T) -> uint {
|
||||
alt itr.map.find(val) {
|
||||
some(idx) { ret idx; }
|
||||
|
|
@ -31,5 +32,8 @@ fn intern[@T](itr: &interner[T], val: &T) -> uint {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get[T](itr: &interner[T], idx: uint) -> T { ret itr.vect.(idx); }
|
||||
|
||||
fn len[T](itr : &interner[T]) -> uint { ret ivec::len(itr.vect); }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue