diff options
| author | varkor <github@varkor.com> | 2018-05-26 19:16:21 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2018-06-20 12:21:08 +0100 |
| commit | 2c6ff2469a94e37b9605a43bc861de66830a94d4 (patch) | |
| tree | 36c1ad6aed0cceb2980e97878c48436fe2d9d757 /src/libsyntax/ext | |
| parent | fba1fe21084bf248334ad46b0b0a8c40a6d5ee7b (diff) | |
| download | rust-2c6ff2469a94e37b9605a43bc861de66830a94d4.tar.gz rust-2c6ff2469a94e37b9605a43bc861de66830a94d4.zip | |
Refactor ast::GenericParam as a struct
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/build.rs | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index 1c74a2bd5be..42745c14965 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -69,7 +69,7 @@ pub trait AstBuilder { id: ast::Ident, attrs: Vec<ast::Attribute>, bounds: ast::TyParamBounds, - default: Option<P<ast::Ty>>) -> ast::TyParam; + default: Option<P<ast::Ty>>) -> ast::GenericParamAST; fn trait_ref(&self, path: ast::Path) -> ast::TraitRef; fn poly_trait_ref(&self, span: Span, path: ast::Path) -> ast::PolyTraitRef; @@ -80,7 +80,7 @@ pub trait AstBuilder { ident: ast::Ident, attrs: Vec<ast::Attribute>, bounds: Vec<ast::Lifetime>) - -> ast::LifetimeDef; + -> ast::GenericParamAST; // statements fn stmt_expr(&self, expr: P<ast::Expr>) -> ast::Stmt; @@ -437,13 +437,15 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ident: ast::Ident, attrs: Vec<ast::Attribute>, bounds: ast::TyParamBounds, - default: Option<P<ast::Ty>>) -> ast::TyParam { - ast::TyParam { + default: Option<P<ast::Ty>>) -> ast::GenericParamAST { + ast::GenericParamAST { ident: ident.with_span_pos(span), id: ast::DUMMY_NODE_ID, attrs: attrs.into(), - bounds, - default, + kind: ast::GenericParamKindAST::Type { + bounds, + default, + } } } @@ -475,11 +477,16 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ident: ast::Ident, attrs: Vec<ast::Attribute>, bounds: Vec<ast::Lifetime>) - -> ast::LifetimeDef { - ast::LifetimeDef { + -> ast::GenericParamAST { + let lifetime = self.lifetime(span, ident); + ast::GenericParamAST { + ident: lifetime.ident, + id: lifetime.id, attrs: attrs.into(), - lifetime: self.lifetime(span, ident), - bounds, + kind: ast::GenericParamKindAST::Lifetime { + lifetime, + bounds, + } } } |
