Skip to content

Commit 53125ac

Browse files
committed
---
yaml --- r: 29982 b: refs/heads/incoming c: 7317bf8 h: refs/heads/master v: v3
1 parent 6815447 commit 53125ac

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: 9a7890d73af5ebe4bf862fa727427e290da1391b
9+
refs/heads/incoming: 7317bf8792ebb3f27768109b7d574ee0806cc5e5
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libsyntax/parse/token.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,18 @@ pure fn is_bar(t: token) -> bool {
279279

280280
type ident_interner = util::interner::interner<@~str>;
281281

282+
mod special_idents {
283+
const underscore : uint = 0u;
284+
const anon : uint = 1u;
285+
const destr : uint = 2u; // 'drop', but that's reserved
286+
}
287+
282288
fn mk_ident_interner() -> ident_interner {
283-
let rv = @interner::mk::<@~str>(|x| str::hash(*x),
284-
|x,y| str::eq(*x, *y));
289+
/* the indices here must correspond to the numbers in special_idents */
290+
let init_vec = ~[@~"_", @~"anon", @~"drop"];
291+
292+
let rv = @interner::mk_prefill::<@~str>(|x| str::hash(*x),
293+
|x,y| str::eq(*x, *y), init_vec);
285294
rv
286295
}
287296

branches/incoming/src/libsyntax/util/interner.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ fn mk<T: const copy>(+hasher: hashfn<T>, +eqer: eqfn<T>) -> interner<T> {
1818
return hi as interner::<T>;
1919
}
2020

21+
fn mk_prefill<T: const copy>(hasher: hashfn<T>, eqer: eqfn<T>,
22+
init: ~[T]) -> interner<T> {
23+
24+
let rv = mk(hasher, eqer);
25+
for init.each() |v| { rv.intern(v); }
26+
return rv;
27+
}
28+
29+
2130
/* when traits can extend traits, we should extend index<uint,T> to get [] */
2231
trait interner<T: const copy> {
2332
fn intern(T) -> uint;

0 commit comments

Comments
 (0)