diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-01-10 14:02:36 -0800 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2014-02-02 01:44:48 +1100 |
| commit | 8e52b85d5a6f6e3aaa2f15d7c1e907d0ce8589ee (patch) | |
| tree | afcac214c65f792304926a71117ffdf37a0fd060 /src/libsyntax/ext/build.rs | |
| parent | 70c5a0fbf784d6a89b1c2c50f9fe83093bd21abc (diff) | |
libsyntax: De-`@str` literal strings in the AST
Diffstat (limited to 'src/libsyntax/ext/build.rs')
| -rw-r--r-- | src/libsyntax/ext/build.rs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 884bd831ce8..c5ee1948466 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -19,6 +19,7 @@ use fold::Folder; use opt_vec; use opt_vec::OptVec; use parse::token::special_idents; +use parse::token; pub struct Field { ident: ast::Ident, @@ -134,13 +135,13 @@ pub trait AstBuilder { fn expr_vec(&self, sp: Span, exprs: ~[@ast::Expr]) -> @ast::Expr; fn expr_vec_uniq(&self, sp: Span, exprs: ~[@ast::Expr]) -> @ast::Expr; fn expr_vec_slice(&self, sp: Span, exprs: ~[@ast::Expr]) -> @ast::Expr; - fn expr_str(&self, sp: Span, s: @str) -> @ast::Expr; - fn expr_str_uniq(&self, sp: Span, s: @str) -> @ast::Expr; + fn expr_str(&self, sp: Span, s: InternedString) -> @ast::Expr; + fn expr_str_uniq(&self, sp: Span, s: InternedString) -> @ast::Expr; fn expr_some(&self, sp: Span, expr: @ast::Expr) -> @ast::Expr; fn expr_none(&self, sp: Span) -> @ast::Expr; - fn expr_fail(&self, span: Span, msg: @str) -> @ast::Expr; + fn expr_fail(&self, span: Span, msg: InternedString) -> @ast::Expr; fn expr_unreachable(&self, span: Span) -> @ast::Expr; fn pat(&self, span: Span, pat: ast::Pat_) -> @ast::Pat; @@ -589,10 +590,10 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn expr_vec_slice(&self, sp: Span, exprs: ~[@ast::Expr]) -> @ast::Expr { self.expr_vstore(sp, self.expr_vec(sp, exprs), ast::ExprVstoreSlice) } - fn expr_str(&self, sp: Span, s: @str) -> @ast::Expr { + fn expr_str(&self, sp: Span, s: InternedString) -> @ast::Expr { self.expr_lit(sp, ast::LitStr(s, ast::CookedStr)) } - fn expr_str_uniq(&self, sp: Span, s: @str) -> @ast::Expr { + fn expr_str_uniq(&self, sp: Span, s: InternedString) -> @ast::Expr { self.expr_vstore(sp, self.expr_str(sp, s), ast::ExprVstoreUniq) } @@ -620,7 +621,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { self.expr_path(none) } - fn expr_fail(&self, span: Span, msg: @str) -> @ast::Expr { + fn expr_fail(&self, span: Span, msg: InternedString) -> @ast::Expr { let loc = self.codemap().lookup_char_pos(span.lo); self.expr_call_global( span, @@ -631,13 +632,16 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ], ~[ self.expr_str(span, msg), - self.expr_str(span, loc.file.name), + self.expr_str(span, + token::intern_and_get_ident(loc.file.name)), self.expr_uint(span, loc.line), ]) } fn expr_unreachable(&self, span: Span) -> @ast::Expr { - self.expr_fail(span, @"internal error: entered unreachable code") + self.expr_fail(span, + InternedString::new( + "internal error: entered unreachable code")) } |
