diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-05-10 15:15:06 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-05-12 16:35:18 -0700 |
| commit | 5d3559e6455757c5508bba5b5add69477ebac53e (patch) | |
| tree | 71e166364df7f828c4c98c5853597d2c62c37fac /src/libsyntax/ext/deriving | |
| parent | 06ef889cdc77db862d526bf6a607ecdf3ee80beb (diff) | |
librustc: Make `self` and `static` into keywords
Diffstat (limited to 'src/libsyntax/ext/deriving')
| -rw-r--r-- | src/libsyntax/ext/deriving/encodable.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/mod.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/ty.rs | 4 |
3 files changed, 7 insertions, 12 deletions
diff --git a/src/libsyntax/ext/deriving/encodable.rs b/src/libsyntax/ext/deriving/encodable.rs index 2786c9c6eb5..a5edd92022f 100644 --- a/src/libsyntax/ext/deriving/encodable.rs +++ b/src/libsyntax/ext/deriving/encodable.rs @@ -204,8 +204,6 @@ fn expand_deriving_encodable_struct_method( type_ident: ident, struct_def: &struct_def ) -> @method { - let self_ident = cx.ident_of("self"); - // Create the body of the method. let mut idx = 0; let mut statements = ~[]; @@ -213,12 +211,10 @@ fn expand_deriving_encodable_struct_method( match struct_field.node.kind { named_field(ident, _) => { // Create the accessor for this field. - let self_field = build::mk_access( - cx, - span, - ~[self_ident], - ident - ); + let self_field = build::mk_access_(cx, + span, + build::make_self(cx, span), + ident); // Call the substructure method. let encode_expr = call_substructure_encode_method( diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index 78eacafe3d7..3b94a95dfe0 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -371,8 +371,7 @@ pub fn expand_enum_or_struct_match(cx: @ext_ctxt, span: span, arms: ~[ ast::arm ]) -> @expr { - let self_ident = cx.ident_of("self"); - let self_expr = build::mk_path(cx, span, ~[ self_ident ]); + let self_expr = build::make_self(cx, span); let self_expr = build::mk_unary(cx, span, ast::deref, self_expr); let self_match_expr = ast::expr_match(self_expr, arms); build::mk_expr(cx, span, self_match_expr) diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs index 08947efa7b7..0bb88dae26b 100644 --- a/src/libsyntax/ext/deriving/ty.rs +++ b/src/libsyntax/ext/deriving/ty.rs @@ -191,7 +191,7 @@ fn mk_generics(lifetimes: ~[ast::Lifetime], ty_params: ~[ast::TyParam]) -> Gene } } -/// Lifetimes and bounds on type paramers +/// Lifetimes and bounds on type parameters pub struct LifetimeBounds { lifetimes: ~[~str], bounds: ~[(~str, ~[Path])] @@ -218,7 +218,7 @@ pub impl LifetimeBounds { pub fn get_explicit_self(cx: @ext_ctxt, span: span, self_ptr: Option<PtrTy>) -> (@expr, ast::self_ty) { - let self_path = build::mk_path(cx, span, ~[cx.ident_of("self")]); + let self_path = build::make_self(cx, span); match self_ptr { None => { (self_path, respan(span, ast::sty_value)) |
