diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2014-04-03 13:53:57 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2014-04-23 12:30:58 +1200 |
| commit | c3b2f2b0c6f074fb98add56a1977d407e294c9ed (patch) | |
| tree | 7eb3393df546f2c5b95d97dd3fc4c3cc73984783 /src/libsyntax | |
| parent | 09bfb92fdc3ccff42dfcf91b0af368f88dc3e446 (diff) | |
| download | rust-c3b2f2b0c6f074fb98add56a1977d407e294c9ed.tar.gz rust-c3b2f2b0c6f074fb98add56a1977d407e294c9ed.zip | |
Add a span to ast::TyParam
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/ext/build.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/generic.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/ty.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/fold.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 4 |
6 files changed, 13 insertions, 6 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 2b6f94e6bf5..5d0b24fdb3e 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -181,7 +181,8 @@ pub struct TyParam { pub ident: Ident, pub id: NodeId, pub bounds: OwnedSlice<TyParamBound>, - pub default: Option<P<Ty>> + pub default: Option<P<Ty>>, + pub span: Span } #[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 203edf6590f..c1289ef9858 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -66,6 +66,7 @@ pub trait AstBuilder { fn strip_bounds(&self, bounds: &Generics) -> Generics; fn typaram(&self, + span: Span, id: ast::Ident, bounds: OwnedSlice<ast::TyParamBound>, default: Option<P<ast::Ty>>) -> ast::TyParam; @@ -368,6 +369,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { } fn typaram(&self, + span: Span, id: ast::Ident, bounds: OwnedSlice<ast::TyParamBound>, default: Option<P<ast::Ty>>) -> ast::TyParam { @@ -375,7 +377,8 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ident: id, id: ast::DUMMY_NODE_ID, bounds: bounds, - default: default + default: default, + span: span } } diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index 1d4aa08f9e3..c040361a8eb 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -380,7 +380,7 @@ impl<'a> TraitDef<'a> { // require the current trait bounds.push(cx.typarambound(trait_path.clone())); - cx.typaram(ty_param.ident, OwnedSlice::from_vec(bounds), None) + cx.typaram(self.span, ty_param.ident, OwnedSlice::from_vec(bounds), None) })); let trait_generics = Generics { lifetimes: lifetimes, diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs index c4ca2601f60..a6bbad62b8e 100644 --- a/src/libsyntax/ext/deriving/ty.rs +++ b/src/libsyntax/ext/deriving/ty.rs @@ -193,7 +193,7 @@ fn mk_ty_param(cx: &ExtCtxt, span: Span, name: &str, bounds: &[Path], let path = b.to_path(cx, span, self_ident, self_generics); cx.typarambound(path) }).collect(); - cx.typaram(cx.ident_of(name), bounds, None) + cx.typaram(span, cx.ident_of(name), bounds, None) } fn mk_generics(lifetimes: Vec<ast::Lifetime> , ty_params: Vec<ast::TyParam> ) -> Generics { diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 73ad2664be4..72be633d456 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -448,7 +448,8 @@ pub fn fold_ty_param<T: Folder>(tp: &TyParam, fld: &mut T) -> TyParam { ident: tp.ident, id: id, bounds: tp.bounds.map(|x| fold_ty_param_bound(x, fld)), - default: tp.default.map(|x| fld.fold_ty(x)) + default: tp.default.map(|x| fld.fold_ty(x)), + span: tp.span } } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 6485b5a3622..85480bebc90 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3393,6 +3393,7 @@ impl<'a> Parser<'a> { // matches typaram = IDENT optbounds ( EQ ty )? fn parse_ty_param(&mut self) -> TyParam { let ident = self.parse_ident(); + let span = self.span; let (_, opt_bounds) = self.parse_optional_ty_param_bounds(false); // For typarams we don't care about the difference b/w "<T>" and "<T:>". let bounds = opt_bounds.unwrap_or_default(); @@ -3407,7 +3408,8 @@ impl<'a> Parser<'a> { ident: ident, id: ast::DUMMY_NODE_ID, bounds: bounds, - default: default + default: default, + span: span, } } |
