diff options
| author | bors <bors@rust-lang.org> | 2014-06-17 02:51:53 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-06-17 02:51:53 +0000 |
| commit | 09967665eaa5ca3d259f0f59ef26c8d236bf47a7 (patch) | |
| tree | ae450abfecbe1fdec6f583cf7cf743c35663a4c7 /src/libsyntax | |
| parent | cc30abbcad282634fb99089eb9297e7cc4f26729 (diff) | |
| parent | b9adb6c717627ab6dcc9298b79a8d44cfe2fc616 (diff) | |
| download | rust-09967665eaa5ca3d259f0f59ef26c8d236bf47a7.tar.gz rust-09967665eaa5ca3d259f0f59ef26c8d236bf47a7.zip | |
auto merge of #14955 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/crateid.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/fold.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 2 |
6 files changed, 19 insertions, 10 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 08f412cd763..86dd736ceea 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -464,7 +464,7 @@ pub enum Expr_ { ExprAssign(Gc<Expr>, Gc<Expr>), ExprAssignOp(BinOp, Gc<Expr>, Gc<Expr>), - ExprField(Gc<Expr>, Ident, Vec<P<Ty>>), + ExprField(Gc<Expr>, SpannedIdent, Vec<P<Ty>>), ExprIndex(Gc<Expr>, Gc<Expr>), /// Expression that looks like a "name". For example, @@ -977,7 +977,7 @@ pub enum ViewItem_ { // ident: name used to refer to this crate in the code // optional (InternedString,StrStyle): if present, this is a location // (containing arbitrary characters) from which to fetch the crate sources - // For example, extern crate whatever = "github.com/mozilla/rust" + // For example, extern crate whatever = "github.com/rust-lang/rust" ViewItemExternCrate(Ident, Option<(InternedString,StrStyle)>, NodeId), ViewItemUse(Gc<ViewPath>), } diff --git a/src/libsyntax/crateid.rs b/src/libsyntax/crateid.rs index 8ac54a191f2..a3112cbb8be 100644 --- a/src/libsyntax/crateid.rs +++ b/src/libsyntax/crateid.rs @@ -12,8 +12,8 @@ use std::fmt; /// CrateIds identify crates and include the crate name and optionally a path /// and version. In the full form, they look like relative URLs. Example: -/// `github.com/mozilla/rust#std:1.0` would be a package ID with a path of -/// `github.com/mozilla/rust` and a crate name of `std` with a version of +/// `github.com/rust-lang/rust#std:1.0` would be a package ID with a path of +/// `github.com/rust-lang/rust` and a crate name of `std` with a version of /// `1.0`. If no crate name is given after the hash, the name is inferred to /// be the last component of the path. If no version is given, it is inferred /// to be `0.0`. diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index b99ab50c326..8d48401f9c2 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -13,7 +13,7 @@ use ast::{P, Ident, Generics, NodeId, Expr}; use ast; use ast_util; use attr; -use codemap::{Span, respan, Spanned, DUMMY_SP}; +use codemap::{Span, respan, Spanned, DUMMY_SP, Pos}; use ext::base::ExtCtxt; use fold::Folder; use owned_slice::OwnedSlice; @@ -560,7 +560,15 @@ impl<'a> AstBuilder for ExtCtxt<'a> { } fn expr_field_access(&self, sp: Span, expr: Gc<ast::Expr>, ident: ast::Ident) -> Gc<ast::Expr> { - self.expr(sp, ast::ExprField(expr, ident, Vec::new())) + let field_name = token::get_ident(ident); + let field_span = Span { + lo: sp.lo - Pos::from_uint(field_name.get().len()), + hi: sp.hi, + expn_info: sp.expn_info, + }; + + let id = Spanned { node: ident, span: field_span }; + self.expr(sp, ast::ExprField(expr, id, Vec::new())) } fn expr_addr_of(&self, sp: Span, e: Gc<ast::Expr>) -> Gc<ast::Expr> { self.expr(sp, ast::ExprAddrOf(ast::MutImmutable, e)) diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 2e538c9579b..6d2b0ceed8b 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -876,7 +876,7 @@ pub fn noop_fold_expr<T: Folder>(e: Gc<Expr>, folder: &mut T) -> Gc<Expr> { } ExprField(el, id, ref tys) => { ExprField(folder.fold_expr(el), - folder.fold_ident(id), + respan(id.span, folder.fold_ident(id.node)), tys.iter().map(|&x| folder.fold_ty(x)).collect()) } ExprIndex(el, er) => { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 8b50a6270bc..bbe0680ef14 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1796,7 +1796,7 @@ impl<'a> Parser<'a> { ExprIndex(expr, idx) } - pub fn mk_field(&mut self, expr: Gc<Expr>, ident: Ident, + pub fn mk_field(&mut self, expr: Gc<Expr>, ident: ast::SpannedIdent, tys: Vec<P<Ty>>) -> ast::Expr_ { ExprField(expr, ident, tys) } @@ -2090,7 +2090,8 @@ impl<'a> Parser<'a> { e = self.mk_expr(lo, hi, nd); } _ => { - let field = self.mk_field(e, i, tys); + let id = spanned(dot, hi, i); + let field = self.mk_field(e, id, tys); e = self.mk_expr(lo, hi, field) } } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 63acdb1a6ca..badfbe7eb15 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1487,7 +1487,7 @@ impl<'a> State<'a> { ast::ExprField(ref expr, id, ref tys) => { try!(self.print_expr(&**expr)); try!(word(&mut self.s, ".")); - try!(self.print_ident(id)); + try!(self.print_ident(id.node)); if tys.len() > 0u { try!(word(&mut self.s, "::<")); try!(self.commasep( |
