Skip to content

Commit 7d6f2c2

Browse files
pcwaltonhuonw
authored andcommitted
---
yaml --- r: 107875 b: refs/heads/dist-snap c: e5dc347 h: refs/heads/master i: 107873: 86e14d6 107871: 5623e1d v: v3
1 parent 6e03c31 commit 7d6f2c2

File tree

6 files changed

+14
-35
lines changed

6 files changed

+14
-35
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: f64fdf524a434f0e5cd0bc91d09c144723f3c90d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: a695b62118ffd1ed1df5e4898cb34d7d58b91bc1
9+
refs/heads/dist-snap: e5dc347ccfe92d9d1dd23f0b4a257a1cb3532462
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libsyntax/ast.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use codemap::{Span, Spanned, DUMMY_SP};
1414
use abi::AbiSet;
1515
use ast_util;
1616
use opt_vec::OptVec;
17-
use parse::token::{InternedString, interner_get, special_idents};
18-
use parse::token::{str_to_ident};
17+
use parse::token::{InternedString, special_idents, str_to_ident};
18+
use parse::token;
1919

2020
use std::cell::RefCell;
2121
use std::hashmap::HashMap;
@@ -126,7 +126,8 @@ pub type Mrk = u32;
126126

127127
impl<S:Encoder> Encodable<S> for Ident {
128128
fn encode(&self, s: &mut S) {
129-
s.emit_str(interner_get(self.name));
129+
let string = token::get_ident(self.name);
130+
s.emit_str(string.get());
130131
}
131132
}
132133

branches/dist-snap/src/libsyntax/ast_util.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ use std::num;
2525

2626
pub fn path_name_i(idents: &[Ident]) -> ~str {
2727
// FIXME: Bad copies (#2543 -- same for everything else that says "bad")
28-
idents.map(|i| token::interner_get(i.name)).connect("::")
28+
idents.map(|i| {
29+
let string = token::get_ident(i.name);
30+
string.get().to_str()
31+
}).connect("::")
2932
}
3033

3134
// totally scary function: ignores all but the last element, should have

branches/dist-snap/src/libsyntax/parse/parser.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4178,7 +4178,8 @@ impl Parser {
41784178
outer_attrs, "path") {
41794179
Some(d) => dir_path.join(d),
41804180
None => {
4181-
let mod_name = token::interner_get(id.name).to_owned();
4181+
let mod_string = token::get_ident(id.name);
4182+
let mod_name = mod_string.get().to_owned();
41824183
let default_path_str = mod_name + ".rs";
41834184
let secondary_path_str = mod_name + "/mod.rs";
41844185
let default_path = dir_path.join(default_path_str.as_slice());

branches/dist-snap/src/libsyntax/parse/token.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,6 @@ pub fn gensym(str : &str) -> Name {
651651
interner.gensym(str)
652652
}
653653

654-
// map an interned representation back to a string
655-
pub fn interner_get(name : Name) -> @str {
656-
get_ident_interner().get(name)
657-
}
658-
659654
// maps a string to an identifier with an empty syntax context
660655
pub fn str_to_ident(str : &str) -> ast::Ident {
661656
ast::Ident::new(intern(str))
@@ -679,28 +674,6 @@ pub fn fresh_name(src : &ast::Ident) -> Name {
679674
gensym(format!("{}_{}",ident_to_str(src),num))*/
680675
}
681676

682-
// it looks like there oughta be a str_ptr_eq fn, but no one bothered to implement it?
683-
684-
// determine whether two @str values are pointer-equal
685-
pub fn str_ptr_eq(a : @str, b : @str) -> bool {
686-
unsafe {
687-
let p : uint = cast::transmute(a);
688-
let q : uint = cast::transmute(b);
689-
let result = p == q;
690-
// got to transmute them back, to make sure the ref count is correct:
691-
let _junk1 : @str = cast::transmute(p);
692-
let _junk2 : @str = cast::transmute(q);
693-
result
694-
}
695-
}
696-
697-
// return true when two identifiers refer (through the intern table) to the same ptr_eq
698-
// string. This is used to compare identifiers in places where hygienic comparison is
699-
// not wanted (i.e. not lexical vars).
700-
pub fn ident_spelling_eq(a : &ast::Ident, b : &ast::Ident) -> bool {
701-
str_ptr_eq(interner_get(a.name),interner_get(b.name))
702-
}
703-
704677
// create a fresh mark.
705678
pub fn fresh_mark() -> Mrk {
706679
gensym("mark")

branches/dist-snap/src/libsyntax/print/pprust.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use codemap::{CodeMap, BytePos};
1919
use codemap;
2020
use diagnostic;
2121
use parse::classify::expr_is_simple_block;
22-
use parse::token::{IdentInterner, interner_get};
22+
use parse::token::IdentInterner;
2323
use parse::{comments, token};
2424
use parse;
2525
use print::pp::{break_offset, word, space, zerobreak, hardbreak};
@@ -1544,7 +1544,8 @@ pub fn print_ident(s: &mut State, ident: ast::Ident) {
15441544
}
15451545

15461546
pub fn print_name(s: &mut State, name: ast::Name) {
1547-
word(&mut s.s, interner_get(name));
1547+
let string = token::get_ident(name);
1548+
word(&mut s.s, string.get());
15481549
}
15491550

15501551
pub fn print_for_decl(s: &mut State, loc: &ast::Local, coll: &ast::Expr) {

0 commit comments

Comments
 (0)