about summary refs log tree commit diff
path: root/src/libsyntax/ext/deriving/cmp
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2013-05-18 00:19:28 +1000
committerHuon Wilson <dbau.pp+github@gmail.com>2013-05-22 00:15:36 +1000
commit6e5051553050974eb9362e1465cc2d40e2c9a610 (patch)
tree7ad6c6fb53488402e7392008847cd2e60037bb12 /src/libsyntax/ext/deriving/cmp
parent8c15a0ec4cf023a08078d74ed615ecef0cc10a66 (diff)
syntax/ext: migrate build.rs functions to AstBuilder methods.
Diffstat (limited to 'src/libsyntax/ext/deriving/cmp')
-rw-r--r--src/libsyntax/ext/deriving/cmp/eq.rs6
-rw-r--r--src/libsyntax/ext/deriving/cmp/ord.rs24
-rw-r--r--src/libsyntax/ext/deriving/cmp/totaleq.rs4
-rw-r--r--src/libsyntax/ext/deriving/cmp/totalord.rs6
4 files changed, 20 insertions, 20 deletions
diff --git a/src/libsyntax/ext/deriving/cmp/eq.rs b/src/libsyntax/ext/deriving/cmp/eq.rs
index 197366b09ae..1af66404489 100644
--- a/src/libsyntax/ext/deriving/cmp/eq.rs
+++ b/src/libsyntax/ext/deriving/cmp/eq.rs
@@ -11,7 +11,7 @@
 use ast::{meta_item, item, expr};
 use codemap::span;
 use ext::base::ExtCtxt;
-use ext::build;
+use ext::build::AstBuilder;
 use ext::deriving::generic::*;
 
 pub fn expand_deriving_eq(cx: @ExtCtxt,
@@ -21,11 +21,11 @@ pub fn expand_deriving_eq(cx: @ExtCtxt,
     // structures are equal if all fields are equal, and non equal, if
     // any fields are not equal or if the enum variants are different
     fn cs_eq(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
-        cs_and(|cx, span, _, _| build::mk_bool(cx, span, false),
+        cs_and(|cx, span, _, _| cx.mk_bool(span, false),
                                  cx, span, substr)
     }
     fn cs_ne(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
-        cs_or(|cx, span, _, _| build::mk_bool(cx, span, true),
+        cs_or(|cx, span, _, _| cx.mk_bool(span, true),
               cx, span, substr)
     }
 
diff --git a/src/libsyntax/ext/deriving/cmp/ord.rs b/src/libsyntax/ext/deriving/cmp/ord.rs
index 29fc2c7271c..41b5bf63aca 100644
--- a/src/libsyntax/ext/deriving/cmp/ord.rs
+++ b/src/libsyntax/ext/deriving/cmp/ord.rs
@@ -12,7 +12,7 @@
 use ast::{meta_item, item, expr_if, expr};
 use codemap::span;
 use ext::base::ExtCtxt;
-use ext::build;
+use ext::build::AstBuilder;
 use ext::deriving::generic::*;
 
 pub fn expand_deriving_ord(cx: @ExtCtxt,
@@ -62,10 +62,10 @@ fn cs_ord(less: bool, equal: bool,
     } else {
         cx.ident_of("gt")
     };
-    let false_blk_expr = build::mk_block(cx, span,
+    let false_blk_expr = cx.mk_block(span,
                                          ~[], ~[],
-                                         Some(build::mk_bool(cx, span, false)));
-    let base = build::mk_bool(cx, span, equal);
+                                         Some(cx.mk_bool(span, false)));
+    let base = cx.mk_bool(span, equal);
 
     cs_fold(
         false, // need foldr,
@@ -98,19 +98,19 @@ fn cs_ord(less: bool, equal: bool,
                 cx.span_bug(span, "Not exactly 2 arguments in `deriving(Ord)`");
             }
 
-            let cmp = build::mk_method_call(cx, span,
+            let cmp = cx.mk_method_call(span,
                                             self_f, cx.ident_of("eq"), other_fs.to_owned());
-            let subexpr = build::mk_simple_block(cx, span, subexpr);
+            let subexpr = cx.mk_simple_block(span, subexpr);
             let elseif = expr_if(cmp, subexpr, Some(false_blk_expr));
-            let elseif = build::mk_expr(cx, span, elseif);
+            let elseif = cx.mk_expr(span, elseif);
 
-            let cmp = build::mk_method_call(cx, span,
+            let cmp = cx.mk_method_call(span,
                                             self_f, binop, other_fs.to_owned());
-            let true_blk = build::mk_simple_block(cx, span,
-                                                  build::mk_bool(cx, span, true));
+            let true_blk = cx.mk_simple_block(span,
+                                                  cx.mk_bool(span, true));
             let if_ = expr_if(cmp, true_blk, Some(elseif));
 
-            build::mk_expr(cx, span, if_)
+            cx.mk_expr(span, if_)
         },
         base,
         |cx, span, args, _| {
@@ -119,7 +119,7 @@ fn cs_ord(less: bool, equal: bool,
             match args {
                 [(self_var, _, _),
                  (other_var, _, _)] =>
-                    build::mk_bool(cx, span,
+                    cx.mk_bool(span,
                                    if less {
                                        self_var < other_var
                                    } else {
diff --git a/src/libsyntax/ext/deriving/cmp/totaleq.rs b/src/libsyntax/ext/deriving/cmp/totaleq.rs
index 0ab99430d10..48393efce64 100644
--- a/src/libsyntax/ext/deriving/cmp/totaleq.rs
+++ b/src/libsyntax/ext/deriving/cmp/totaleq.rs
@@ -12,7 +12,7 @@
 use ast::{meta_item, item, expr};
 use codemap::span;
 use ext::base::ExtCtxt;
-use ext::build;
+use ext::build::AstBuilder;
 use ext::deriving::generic::*;
 
 pub fn expand_deriving_totaleq(cx: @ExtCtxt,
@@ -21,7 +21,7 @@ pub fn expand_deriving_totaleq(cx: @ExtCtxt,
                           in_items: ~[@item]) -> ~[@item] {
 
     fn cs_equals(cx: @ExtCtxt, span: span, substr: &Substructure) -> @expr {
-        cs_and(|cx, span, _, _| build::mk_bool(cx, span, false),
+        cs_and(|cx, span, _, _| cx.mk_bool(span, false),
                cx, span, substr)
     }
 
diff --git a/src/libsyntax/ext/deriving/cmp/totalord.rs b/src/libsyntax/ext/deriving/cmp/totalord.rs
index 2b4d8a28fbd..3404a21edd0 100644
--- a/src/libsyntax/ext/deriving/cmp/totalord.rs
+++ b/src/libsyntax/ext/deriving/cmp/totalord.rs
@@ -11,7 +11,7 @@
 use ast::{meta_item, item, expr};
 use codemap::span;
 use ext::base::ExtCtxt;
-use ext::build;
+use ext::build::AstBuilder;
 use ext::deriving::generic::*;
 use core::cmp::{Ordering, Equal, Less, Greater};
 
@@ -47,7 +47,7 @@ pub fn ordering_const(cx: @ExtCtxt, span: span, cnst: Ordering) -> @expr {
         Equal => "Equal",
         Greater => "Greater"
     };
-    build::mk_path_global(cx, span,
+    cx.mk_path_global(span,
                           ~[cx.ident_of("core"),
                             cx.ident_of("cmp"),
                             cx.ident_of(cnst)])
@@ -60,7 +60,7 @@ pub fn cs_cmp(cx: @ExtCtxt, span: span,
         // foldr (possibly) nests the matches in lexical_ordering better
         false,
         |cx, span, old, new| {
-            build::mk_call_global(cx, span,
+            cx.mk_call_global(span,
                                   ~[cx.ident_of("core"),
                                     cx.ident_of("cmp"),
                                     cx.ident_of("lexical_ordering")],